Reset controller API¶
Introduction¶
Reset controllers are central units that control the reset signals to multipleperipherals.The reset controller API is split into two parts:theconsumer driver interface (API reference), which allows peripheral drivers to request controlover their reset input signals, and thereset controller driver interface (API reference), which is used by drivers for resetcontroller devices to register their reset controls to provide them to theconsumers.
While some reset controller hardware units also implement system restartfunctionality, restart handlers are out of scope for the reset controller API.
Glossary¶
The reset controller API uses these terms with a specific meaning:
Reset line
Physical reset line carrying a reset signal from a reset controllerhardware unit to a peripheral module.
Reset control
Control method that determines the state of one or multiple reset lines.Most commonly this is a single bit in reset controller register space thateither allows direct control over the physical state of the reset line, oris self-clearing and can be used to trigger a predetermined pulse on thereset line.In more complicated reset controls, a single trigger action can launch acarefully timed sequence of pulses on multiple reset lines.
Reset controller
A hardware module that provides a number of reset controls to control anumber of reset lines.
Reset consumer
Peripheral module or external IC that is put into reset by the signal on areset line.
Consumer driver interface¶
This interface provides an API that is similar to the kernel clock framework.Consumer drivers use get and put operations to acquire and release resetcontrols.Functions are provided to assert and deassert the controlled reset lines,trigger reset pulses, or to query reset line status.
When requesting reset controls, consumers can use symbolic names for theirreset inputs, which are mapped to an actual reset control on an existing resetcontroller device by the core.
A stub version of this API is provided when the reset controller framework isnot in use in order to minimize the need to use ifdefs.
Shared and exclusive resets¶
The reset controller API provides either reference counted deassertion andassertion or direct, exclusive control.The distinction between shared and exclusive reset controls is made at the timethe reset control is requested, either viadevm_reset_control_get_shared() orviadevm_reset_control_get_exclusive().This choice determines the behavior of the API calls made with the resetcontrol.
Shared resets behave similarly to clocks in the kernel clock framework.They provide reference counted deassertion, where only the first deassert,which increments the deassertion reference count to one, and the last assertwhich decrements the deassertion reference count back to zero, have a physicaleffect on the reset line.
Exclusive resets on the other hand guarantee direct control.That is, an assert causes the reset line to be asserted immediately, and adeassert causes the reset line to be deasserted immediately.
Assertion and deassertion¶
Consumer drivers use thereset_control_assert() andreset_control_deassert()functions to assert and deassert reset lines.For shared reset controls, calls to the two functions must be balanced.
Note that since multiple consumers may be using a shared reset control, thereis no guarantee that callingreset_control_assert() on a shared reset controlwill actually cause the reset line to be asserted.Consumer drivers using shared reset controls should assume that the reset linemay be kept deasserted at all times.The API only guarantees that the reset line can not be asserted as long as anyconsumer has requested it to be deasserted.
Triggering¶
Consumer drivers usereset_control_reset() to trigger a reset pulse on aself-deasserting reset control.In general, these resets can not be shared between multiple consumers, sincerequesting a pulse from any consumer driver will reset all connectedperipherals.
The reset controller API allows requesting self-deasserting reset controls asshared, but for those only the first trigger request causes an actual pulse tobe issued on the reset line.All further calls to this function have no effect until all consumers havecalledreset_control_rearm().For shared reset controls, calls to the two functions must be balanced.This allows devices that only require an initial reset at any point before thedriver is probed or resumed to share a pulsed reset line.
Querying¶
Only some reset controllers support querying the current status of a resetline, viareset_control_status().If supported, this function returns a positive non-zero value if the givenreset line is asserted.Thereset_control_status() function does not accept areset control array handle as its input parameter.
Optional resets¶
Often peripherals require a reset line on some platforms but not on others.For this, reset controls can be requested as optional usingdevm_reset_control_get_optional_exclusive() ordevm_reset_control_get_optional_shared().These functions return a NULL pointer instead of an error when the requestedreset control is not specified in the device tree.Passing a NULL pointer to the reset_control functions causes them to returnquietly without an error.
Reset control arrays¶
Some drivers need to assert a bunch of reset lines in no particular order.devm_reset_control_array_get() returns an opaque reset control handle that canbe used to assert, deassert, or trigger all specified reset controls at once.The reset control API does not guarantee the order in which the individualcontrols therein are handled.
Reset controller driver interface¶
Drivers for reset controller modules provide the functionality necessary toassert or deassert reset signals, to trigger a reset pulse on a reset line, orto query its current state.All functions are optional.
Initialization¶
Drivers fill a structreset_controller_dev and register it withreset_controller_register() in their probe function.The actual functionality is implemented in callback functions via a structreset_control_ops.
API reference¶
The reset controller API is documented here in two parts:thereset consumer API and thereset controllerdriver API.
Reset consumer API¶
Reset consumers can control a reset line using an opaque reset control handle,which can be obtained fromdevm_reset_control_get_exclusive() ordevm_reset_control_get_shared().Given the reset control, consumers can callreset_control_assert() andreset_control_deassert(), trigger a reset pulse usingreset_control_reset(), orquery the reset line status usingreset_control_status().
- structreset_control_bulk_data¶
Data used for bulk reset control operations.
Definition:
struct reset_control_bulk_data { const char *id; struct reset_control *rstc;};Members
idreset control consumer ID
rstcstructreset_control* to store the associated reset control
Description
The reset APIs provide a series of reset_control_bulk_*() API calls asa convenience to consumers which require multiple reset controls.This structure is used to manage data for these calls.
- enumreset_control_flags¶
Flags that can be passed to the reset_control_get functions to determine the type of reset control. These values cannot be OR’d.
Constants
RESET_CONTROL_EXCLUSIVEexclusive, acquired,
RESET_CONTROL_EXCLUSIVE_DEASSERTEDexclusive, acquired, deasserted
RESET_CONTROL_EXCLUSIVE_RELEASEDexclusive, released,
RESET_CONTROL_SHAREDshared
RESET_CONTROL_SHARED_DEASSERTEDshared, deasserted
RESET_CONTROL_OPTIONAL_EXCLUSIVEoptional, exclusive, acquired
RESET_CONTROL_OPTIONAL_EXCLUSIVE_DEASSERTEDoptional, exclusive, acquired, deasserted
RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASEDoptional, exclusive, released
RESET_CONTROL_OPTIONAL_SHAREDoptional, shared
RESET_CONTROL_OPTIONAL_SHARED_DEASSERTEDoptional, shared, deasserted
- structreset_control*reset_control_get_exclusive(structdevice*dev,constchar*id)¶
Lookup and obtain an exclusive reference to a reset controller.
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Returns astructreset_control orIS_ERR() condition containing errno.If this function is called more than once for the same reset_control it willreturn -EBUSY.
Seereset_control_get_shared() for details on shared references toreset-controls.
Use of id names is optional.
- intreset_control_bulk_get_exclusive(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
Lookup and obtain exclusive references to multiple reset controllers.
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Fills the rstcs array with pointers to exclusive reset controls andreturns 0, or anIS_ERR() condition containing errno.
- structreset_control*reset_control_get_exclusive_released(structdevice*dev,constchar*id)¶
Lookup and obtain a temoprarily exclusive reference to a reset controller.
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Returns astructreset_control orIS_ERR() condition containing errno.reset-controls returned by this function must be acquired viareset_control_acquire() before they can be used and should be releasedviareset_control_release() afterwards.
Use of id names is optional.
- intreset_control_bulk_get_exclusive_released(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
Lookup and obtain temporarily exclusive references to multiple reset controllers.
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Fills the rstcs array with pointers to exclusive reset controls andreturns 0, or anIS_ERR() condition containing errno.reset-controls returned by this function must be acquired viareset_control_bulk_acquire() before they can be used and should be releasedviareset_control_bulk_release() afterwards.
- intreset_control_bulk_get_optional_exclusive_released(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
Lookup and obtain optional temporarily exclusive references to multiple reset controllers.
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Optional variant ofreset_control_bulk_get_exclusive_released(). If therequested reset is not specified in the device tree, this function returns 0instead of an error and missing rtsc is set to NULL.
Seereset_control_bulk_get_exclusive_released() for more information.
- structreset_control*reset_control_get_shared(structdevice*dev,constchar*id)¶
Lookup and obtain a shared reference to a reset controller.
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Returns astructreset_control orIS_ERR() condition containing errno.This function is intended for use with reset-controls which are sharedbetween hardware blocks.
When a reset-control is shared, the behavior of reset_control_assert /deassert is changed, the reset-core will keep track of a deassert_countand only (re-)assert the reset after reset_control_assert has been calledas many times as reset_control_deassert was called. Also see the remarkabout shared reset-controls in the reset_control_assert docs.
Calling reset_control_assert without first calling reset_control_deassertis not allowed on a shared reset control. Calling reset_control_reset isalso not allowed on a shared reset control.
Use of id names is optional.
- intreset_control_bulk_get_shared(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
Lookup and obtain shared references to multiple reset controllers.
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Fills the rstcs array with pointers to shared reset controls andreturns 0, or anIS_ERR() condition containing errno.
- structreset_control*reset_control_get_optional_exclusive(structdevice*dev,constchar*id)¶
optional
reset_control_get_exclusive()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Optional variant ofreset_control_get_exclusive(). If the requested resetis not specified in the device tree, this function returns NULL instead ofan error.
Seereset_control_get_exclusive() for more information.
- intreset_control_bulk_get_optional_exclusive(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Optional variant ofreset_control_bulk_get_exclusive(). If any of therequested resets are not specified in the device tree, this function setsthem to NULL instead of returning an error.
Seereset_control_bulk_get_exclusive() for more information.
- structreset_control*reset_control_get_optional_shared(structdevice*dev,constchar*id)¶
optional
reset_control_get_shared()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Optional variant ofreset_control_get_shared(). If the requested resetis not specified in the device tree, this function returns NULL instead ofan error.
Seereset_control_get_shared() for more information.
- intreset_control_bulk_get_optional_shared(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
optional
reset_control_bulk_get_shared()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Optional variant ofreset_control_bulk_get_shared(). If the requested resetsare not specified in the device tree, this function sets them to NULLinstead of returning an error.
Seereset_control_bulk_get_shared() for more information.
- structreset_control*of_reset_control_get_exclusive(structdevice_node*node,constchar*id)¶
Lookup and obtain an exclusive reference to a reset controller.
Parameters
structdevice_node*nodedevice to be reset by the controller
constchar*idreset line name
Description
Returns astructreset_control orIS_ERR() condition containing errno.
Use of id names is optional.
- structreset_control*of_reset_control_get_optional_exclusive(structdevice_node*node,constchar*id)¶
Lookup and obtain an optional exclusive reference to a reset controller.
Parameters
structdevice_node*nodedevice to be reset by the controller
constchar*idreset line name
Description
Optional variant ofof_reset_control_get_exclusive(). If the requested resetis not specified in the device tree, this function returns NULL instead ofan error.
Returns astructreset_control orIS_ERR() condition containing errno.
Use of id names is optional.
- structreset_control*of_reset_control_get_shared(structdevice_node*node,constchar*id)¶
Lookup and obtain a shared reference to a reset controller.
Parameters
structdevice_node*nodedevice to be reset by the controller
constchar*idreset line name
Description
When a reset-control is shared, the behavior of reset_control_assert /deassert is changed, the reset-core will keep track of a deassert_countand only (re-)assert the reset after reset_control_assert has been calledas many times as reset_control_deassert was called. Also see the remarkabout shared reset-controls in the reset_control_assert docs.
Calling reset_control_assert without first calling reset_control_deassertis not allowed on a shared reset control. Calling reset_control_reset isalso not allowed on a shared reset control.Returns astructreset_control orIS_ERR() condition containing errno.
Use of id names is optional.
- structreset_control*of_reset_control_get_exclusive_by_index(structdevice_node*node,intindex)¶
Lookup and obtain an exclusive reference to a reset controller by index.
Parameters
structdevice_node*nodedevice to be reset by the controller
intindexindex of the reset controller
Description
This is to be used to perform a list of resets for a device or power domainin whatever order. Returns astructreset_control orIS_ERR() conditioncontaining errno.
- structreset_control*of_reset_control_get_shared_by_index(structdevice_node*node,intindex)¶
Lookup and obtain a shared reference to a reset controller by index.
Parameters
structdevice_node*nodedevice to be reset by the controller
intindexindex of the reset controller
Description
When a reset-control is shared, the behavior of reset_control_assert /deassert is changed, the reset-core will keep track of a deassert_countand only (re-)assert the reset after reset_control_assert has been calledas many times as reset_control_deassert was called. Also see the remarkabout shared reset-controls in the reset_control_assert docs.
Calling reset_control_assert without first calling reset_control_deassertis not allowed on a shared reset control. Calling reset_control_reset isalso not allowed on a shared reset control.Returns astructreset_control orIS_ERR() condition containing errno.
This is to be used to perform a list of resets for a device or power domainin whatever order. Returns astructreset_control orIS_ERR() conditioncontaining errno.
- structreset_control*devm_reset_control_get_exclusive(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_exclusive()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_exclusive(). For reset controllers returnedfrom this function,reset_control_put() is called automatically on driverdetach.
Seereset_control_get_exclusive() for more information.
- structreset_control*devm_reset_control_get_exclusive_deasserted(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_exclusive()+reset_control_deassert()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_exclusive() +reset_control_deassert(). For resetcontrollers returned from this function,reset_control_assert() +reset_control_put() is called automatically on driver detach.
Seereset_control_get_exclusive() for more information.
- intdevm_reset_control_bulk_get_exclusive(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_get_exclusive()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_get_exclusive(). For reset controllers returnedfrom this function,reset_control_put() is called automatically on driverdetach.
Seereset_control_bulk_get_exclusive() for more information.
- structreset_control*devm_reset_control_get_exclusive_released(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_exclusive_released()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_exclusive_released(). For reset controllersreturned from this function,reset_control_put() is called automatically ondriver detach.
Seereset_control_get_exclusive_released() for more information.
- intdevm_reset_control_bulk_get_exclusive_released(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_get_exclusive_released()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_get_exclusive_released(). For reset controllersreturned from this function,reset_control_put() is called automatically ondriver detach.
Seereset_control_bulk_get_exclusive_released() for more information.
- structreset_control*devm_reset_control_get_optional_exclusive_released(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_optional_exclusive_released()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managed-and-optional variant ofreset_control_get_exclusive_released(). Forreset controllers returned from this function,reset_control_put() is calledautomatically on driver detach.
Seereset_control_get_exclusive_released() for more information.
- intdevm_reset_control_bulk_get_optional_exclusive_released(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_optional_get_exclusive_released()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_optional_get_exclusive_released(). For resetcontrollers returned from this function,reset_control_put() is calledautomatically on driver detach.
Seereset_control_bulk_optional_get_exclusive_released() for more information.
- structreset_control*devm_reset_control_get_shared(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_shared()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_shared(). For reset controllers returned fromthis function,reset_control_put() is called automatically on driver detach.Seereset_control_get_shared() for more information.
- structreset_control*devm_reset_control_get_shared_deasserted(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_shared()+reset_control_deassert()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_shared() +reset_control_deassert(). For resetcontrollers returned from this function,reset_control_assert() +reset_control_put() is called automatically on driver detach.
Seedevm_reset_control_get_shared() for more information.
- intdevm_reset_control_bulk_get_shared(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_get_shared()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_get_shared(). For reset controllers returnedfrom this function,reset_control_put() is called automatically on driverdetach.
Seereset_control_bulk_get_shared() for more information.
- intdevm_reset_control_bulk_get_shared_deasserted(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_get_shared()+reset_control_bulk_deassert()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_get_shared() +reset_control_bulk_deassert(). Forreset controllers returned from this function,reset_control_bulk_assert() +reset_control_bulk_put() are called automatically on driver detach.
Seedevm_reset_control_bulk_get_shared() for more information.
- structreset_control*devm_reset_control_get_optional_exclusive(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_optional_exclusive()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_optional_exclusive(). For reset controllersreturned from this function,reset_control_put() is called automatically ondriver detach.
Seereset_control_get_optional_exclusive() for more information.
- structreset_control*devm_reset_control_get_optional_exclusive_deasserted(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_optional_exclusive()+reset_control_deassert()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_optional_exclusive() +reset_control_deassert().For reset controllers returned from this function,reset_control_assert() +reset_control_put() is called automatically on driver detach.
Seedevm_reset_control_get_optional_exclusive() for more information.
- intdevm_reset_control_bulk_get_optional_exclusive(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_get_optional_exclusive()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_get_optional_exclusive(). For reset controllersreturned from this function,reset_control_put() is called automatically ondriver detach.
Seereset_control_bulk_get_optional_exclusive() for more information.
- structreset_control*devm_reset_control_get_optional_shared(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_optional_shared()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_optional_shared(). For reset controllers returnedfrom this function,reset_control_put() is called automatically on driverdetach.
Seereset_control_get_optional_shared() for more information.
- structreset_control*devm_reset_control_get_optional_shared_deasserted(structdevice*dev,constchar*id)¶
resource managed
reset_control_get_optional_shared()+reset_control_deassert()
Parameters
structdevice*devdevice to be reset by the controller
constchar*idreset line name
Description
Managedreset_control_get_optional_shared() +reset_control_deassert(). Forreset controllers returned from this function,reset_control_assert() +reset_control_put() is called automatically on driver detach.
Seedevm_reset_control_get_optional_shared() for more information.
- intdevm_reset_control_bulk_get_optional_shared(structdevice*dev,intnum_rstcs,structreset_control_bulk_data*rstcs)¶
resource managed
reset_control_bulk_get_optional_shared()
Parameters
structdevice*devdevice to be reset by the controller
intnum_rstcsnumber of entries in rstcs array
structreset_control_bulk_data*rstcsarray of
structreset_control_bulk_datawith reset line names set
Description
Managedreset_control_bulk_get_optional_shared(). For reset controllersreturned from this function,reset_control_put() is called automatically ondriver detach.
Seereset_control_bulk_get_optional_shared() for more information.
- structreset_control*devm_reset_control_get_exclusive_by_index(structdevice*dev,intindex)¶
resource managed
reset_control_get_exclusive()
Parameters
structdevice*devdevice to be reset by the controller
intindexindex of the reset controller
Description
Managedreset_control_get_exclusive(). For reset controllers returned fromthis function,reset_control_put() is called automatically on driverdetach.
Seereset_control_get_exclusive() for more information.
- structreset_control*devm_reset_control_get_shared_by_index(structdevice*dev,intindex)¶
resource managed reset_control_get_shared
Parameters
structdevice*devdevice to be reset by the controller
intindexindex of the reset controller
Description
Managedreset_control_get_shared(). For reset controllers returned fromthis function,reset_control_put() is called automatically on driver detach.Seereset_control_get_shared() for more information.
- intreset_control_reset(structreset_control*rstc)¶
reset the controlled device
Parameters
structreset_control*rstcreset controller
Description
On a shared reset line the actual reset pulse is only triggered once for thelifetime of the reset_control instance: for all but the first caller this isa no-op.Consumers must not use reset_control_(de)assert on shared reset lines whenreset_control_reset has been used.
If rstc is NULL it is an optional reset and the function will justreturn 0.
- intreset_control_rearm(structreset_control*rstc)¶
allow shared reset line to be re-triggered”
Parameters
structreset_control*rstcreset controller
Description
On a shared reset line the actual reset pulse is only triggered once for thelifetime of the reset_control instance, except if this call is used.
Calls to this function must be balanced with calls to reset_control_reset,a warning is thrown in case triggered_count ever dips below 0.
Consumers must not use reset_control_(de)assert on shared reset lines whenreset_control_reset or reset_control_rearm have been used.
If rstc is NULL the function will just return 0.
- intreset_control_assert(structreset_control*rstc)¶
asserts the reset line
Parameters
structreset_control*rstcreset controller
Description
Calling this on an exclusive reset controller guarantees that the resetwill be asserted. When called on a shared reset controller the line maystill be deasserted, as long as other users keep it so.
For shared reset controls a driver cannot expect the hw’s registers andinternal state to be reset, but must be prepared for this to happen.Consumers must not use reset_control_reset on shared reset lines whenreset_control_(de)assert has been used.
If rstc is NULL it is an optional reset and the function will justreturn 0.
- intreset_control_deassert(structreset_control*rstc)¶
deasserts the reset line
Parameters
structreset_control*rstcreset controller
Description
After calling this function, the reset is guaranteed to be deasserted.Consumers must not use reset_control_reset on shared reset lines whenreset_control_(de)assert has been used.
If rstc is NULL it is an optional reset and the function will justreturn 0.
- intreset_control_status(structreset_control*rstc)¶
returns a negative errno if not supported, a positive value if the reset line is asserted, or zero if the reset line is not asserted or if the desc is NULL (optional reset).
Parameters
structreset_control*rstcreset controller
- intreset_control_acquire(structreset_control*rstc)¶
acquires a reset control for exclusive use
Parameters
structreset_control*rstcreset control
Description
This is used to explicitly acquire a reset control for exclusive use. Notethat exclusive resets are requested as acquired by default. In order for asecond consumer to be able to control the reset, the first consumer has torelease it first. Typically the easiest way to achieve this is to call thereset_control_get_exclusive_released() to obtain an instance of the resetcontrol. Such reset controls are not acquired by default.
Consumers implementing shared access to an exclusive reset need to followa specific protocol in order to work together. Before consumers can changea reset they must acquire exclusive access usingreset_control_acquire().After they are done operating the reset, they must release exclusive accesswith a call toreset_control_release(). Consumers are not granted exclusiveaccess to the reset as long as another consumer hasn’t released a reset.
See also:reset_control_release()
- voidreset_control_release(structreset_control*rstc)¶
releases exclusive access to a reset control
Parameters
structreset_control*rstcreset control
Description
Releases exclusive access right to a reset control previously obtained by acall toreset_control_acquire(). Until a consumer calls this function, noother consumers will be granted exclusive access.
See also:reset_control_acquire()
- voidreset_control_put(structreset_control*rstc)¶
free the reset controller
Parameters
structreset_control*rstcreset controller
- intof_reset_control_get_count(structdevice_node*node)¶
Count number of resets available with a device
Parameters
structdevice_node*nodedevice node that contains ‘resets’.
Description
Returns positive reset count on success, or error number on failure andon count being zero.
- structreset_control*of_reset_control_array_get(structdevice_node*np,enumreset_control_flagsflags)¶
Get a list of reset controls using device node.
Parameters
structdevice_node*npdevice node for the device that requests the reset controls array
enumreset_control_flagsflagswhether reset controls are shared, optional, acquired
Description
Returns pointer to allocated reset_control on success or error on failure
- structreset_control*devm_reset_control_array_get(structdevice*dev,enumreset_control_flagsflags)¶
Resource managed reset control array get
Parameters
structdevice*devdevice that requests the list of reset controls
enumreset_control_flagsflagswhether reset controls are shared, optional, acquired
Description
The reset control array APIs are intended for a list of resetsthat just have to be asserted or deasserted, without anyrequirements on the order.
Returns pointer to allocated reset_control on success or error on failure
Parameters
structdevice*devdevice for which to return the number of resets
Description
Returns positive reset count on success, or error number on failure andon count being zero.
Reset controller driver API¶
Reset controller drivers are supposed to implement the necessary functions ina static constant structurereset_control_ops, allocate and fill outa structreset_controller_dev, and register it usingdevm_reset_controller_register().
- structreset_control_ops¶
reset controller driver callbacks
Definition:
struct reset_control_ops { int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); int (*status)(struct reset_controller_dev *rcdev, unsigned long id);};Members
resetfor self-deasserting resets, does all necessarythings to reset the device
assertmanually assert the reset line, if supported
deassertmanually deassert the reset line, if supported
statusreturn the status of the reset line, if supported
- structreset_controller_dev¶
reset controller entity that might provide multiple reset controls
Definition:
struct reset_controller_dev { const struct reset_control_ops *ops; struct module *owner; struct list_head list; struct list_head reset_control_head; struct device *dev; struct device_node *of_node; const struct of_phandle_args *of_args; int of_reset_n_cells; int (*of_xlate)(struct reset_controller_dev *rcdev, const struct of_phandle_args *reset_spec); unsigned int nr_resets;};Members
opsa pointer to device specific
structreset_control_opsownerkernel module of the reset controller driver
listinternal list of reset controller devices
reset_control_headhead of internal list of requested reset controls
devcorresponding driver model device struct
of_nodecorresponding device tree node as phandle target
of_argsfor reset-gpios controllers: corresponding phandle args withof_node and GPIO number complementing of_node; either this orof_node should be present
of_reset_n_cellsnumber of cells in reset line specifiers
of_xlatetranslation function to translate from specifier as found in thedevice tree to id as given to the reset control ops, defaultsto
of_reset_simple_xlate().nr_resetsnumber of reset controls in this reset controller device
- intof_reset_simple_xlate(structreset_controller_dev*rcdev,conststructof_phandle_args*reset_spec)¶
translate reset_spec to the reset line number
Parameters
structreset_controller_dev*rcdeva pointer to the reset controller device
conststructof_phandle_args*reset_specreset line specifier as found in the device tree
Description
This static translation function is used by default if of_xlate inreset_controller_dev is not set. It is useful for all resetcontrollers with 1:1 mapping, where reset lines can be indexed by numberwithout gaps.
- intreset_controller_register(structreset_controller_dev*rcdev)¶
register a reset controller device
Parameters
structreset_controller_dev*rcdeva pointer to the initialized reset controller device
- voidreset_controller_unregister(structreset_controller_dev*rcdev)¶
unregister a reset controller device
Parameters
structreset_controller_dev*rcdeva pointer to the reset controller device
- intdevm_reset_controller_register(structdevice*dev,structreset_controller_dev*rcdev)¶
resource managed
reset_controller_register()
Parameters
structdevice*devdevice that is registering this reset controller
structreset_controller_dev*rcdeva pointer to the initialized reset controller device
Description
Managedreset_controller_register(). For reset controllers registered bythis function,reset_controller_unregister() is automatically called ondriver detach. Seereset_controller_register() for more information.