1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016, NVIDIA CORPORATION.
6 #ifndef _RESET_UCLASS_H
7 #define _RESET_UCLASS_H
9 /* See reset.h for background documentation. */
13 struct ofnode_phandle_args;
17 * struct reset_ops - The functions that a reset controller driver must
22 * of_xlate - Translate a client's device-tree (OF) reset specifier.
24 * The reset core calls this function as the first step in implementing
25 * a client's reset_get_by_*() call.
27 * If this function pointer is set to NULL, the reset core will use a
28 * default implementation, which assumes #reset-cells = <1>, and that
29 * the DT cell contains a simple integer reset signal ID.
31 * At present, the reset API solely supports device-tree. If this
32 * changes, other xxx_xlate() functions may be added to support those
35 * @reset_ctl: The reset control struct to hold the translation result.
36 * @args: The reset specifier values from device tree.
37 * @return 0 if OK, or a negative error code.
39 int (*of_xlate)(struct reset_ctl *reset_ctl,
40 struct ofnode_phandle_args *args);
42 * request - Request a translated reset control.
44 * The reset core calls this function as the second step in
45 * implementing a client's reset_get_by_*() call, following a
46 * successful xxx_xlate() call.
48 * @reset_ctl: The reset control struct to request; this has been
49 * filled in by a previoux xxx_xlate() function call.
50 * @return 0 if OK, or a negative error code.
52 int (*request)(struct reset_ctl *reset_ctl);
54 * free - Free a previously requested reset control.
56 * This is the implementation of the client reset_free() API.
58 * @reset_ctl: The reset control to free.
59 * @return 0 if OK, or a negative error code.
61 int (*free)(struct reset_ctl *reset_ctl);
63 * rst_assert - Assert a reset signal.
65 * Note: This function is named rst_assert not assert to avoid
66 * conflicting with global macro assert().
68 * @reset_ctl: The reset signal to assert.
69 * @return 0 if OK, or a negative error code.
71 int (*rst_assert)(struct reset_ctl *reset_ctl);
73 * rst_deassert - Deassert a reset signal.
75 * @reset_ctl: The reset signal to deassert.
76 * @return 0 if OK, or a negative error code.
78 int (*rst_deassert)(struct reset_ctl *reset_ctl);