1 /* 2 * Copyright (c) 2016, NVIDIA CORPORATION. 3 * 4 * SPDX-License-Identifier: GPL-2.0 5 */ 6 7 #ifndef _RESET_UCLASS_H 8 #define _RESET_UCLASS_H 9 10 /* See reset.h for background documentation. */ 11 12 #include <reset.h> 13 14 struct fdtdec_phandle_args; 15 struct udevice; 16 17 /** 18 * struct reset_ops - The functions that a reset controller driver must 19 * implement. 20 */ 21 struct reset_ops { 22 /** 23 * of_xlate - Translate a client's device-tree (OF) reset specifier. 24 * 25 * The reset core calls this function as the first step in implementing 26 * a client's reset_get_by_*() call. 27 * 28 * If this function pointer is set to NULL, the reset core will use a 29 * default implementation, which assumes #reset-cells = <1>, and that 30 * the DT cell contains a simple integer reset signal ID. 31 * 32 * At present, the reset API solely supports device-tree. If this 33 * changes, other xxx_xlate() functions may be added to support those 34 * other mechanisms. 35 * 36 * @reset_ctl: The reset control struct to hold the translation result. 37 * @args: The reset specifier values from device tree. 38 * @return 0 if OK, or a negative error code. 39 */ 40 int (*of_xlate)(struct reset_ctl *reset_ctl, 41 struct fdtdec_phandle_args *args); 42 /** 43 * request - Request a translated reset control. 44 * 45 * The reset core calls this function as the second step in 46 * implementing a client's reset_get_by_*() call, following a 47 * successful xxx_xlate() call. 48 * 49 * @reset_ctl: The reset control struct to request; this has been 50 * filled in by a previoux xxx_xlate() function call. 51 * @return 0 if OK, or a negative error code. 52 */ 53 int (*request)(struct reset_ctl *reset_ctl); 54 /** 55 * free - Free a previously requested reset control. 56 * 57 * This is the implementation of the client reset_free() API. 58 * 59 * @reset_ctl: The reset control to free. 60 * @return 0 if OK, or a negative error code. 61 */ 62 int (*free)(struct reset_ctl *reset_ctl); 63 /** 64 * rst_assert - Assert a reset signal. 65 * 66 * Note: This function is named rst_assert not assert to avoid 67 * conflicting with global macro assert(). 68 * 69 * @reset_ctl: The reset signal to assert. 70 * @return 0 if OK, or a negative error code. 71 */ 72 int (*rst_assert)(struct reset_ctl *reset_ctl); 73 /** 74 * rst_deassert - Deassert a reset signal. 75 * 76 * @reset_ctl: The reset signal to deassert. 77 * @return 0 if OK, or a negative error code. 78 */ 79 int (*rst_deassert)(struct reset_ctl *reset_ctl); 80 }; 81 82 #endif 83