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