reset: add of_reset_control_get_optional_shared() helper
PATCH 1/1 reset: add of_reset_control_get_optional_shared() helper
Add a new reset control helper function to support shared optional reset lines in device tree. Some hardware platforms have reset controllers that are shared among multiple devices and may not be present in all configurations.
Implement of_reset_control_get_optional_shared() by extending the existing reset control framework with RESET_CONTROL_OPTIONAL_SHARED flag handling. The function combines the behaviors of optional and shared reset controls, returning NULL when reset line is not specified and allowing shared access when it exists.
---
Hello,
In the syscon MFD driver, we use of_reset_control_get_optional_exclusive() to obtain reset control, but due to the characteristics of my board (NDA), I need to use shared instead of exclusive reset control. After testing, everything works correctly with this implementation.
Thank you for your consideration.
--
Regards,
Artem
include/linux/reset.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
include/linux/reset.h +20 -0
@@ -547,6 +547,26 @@ static inline struct reset_control *of_reset_control_get_shared(return __of_reset_control_get (node, id,0 ,RESET_CONTROL_SHARED ); } +/** +* of_reset_control_get_optional_shared - Lookup and obtain an optional shared +* reference to a reset controller. +* @node: device to be reset by the controller +* @id: reset line name +* +* Optional variant of of_reset_control_get_shared(). If the requested reset +* is not specified in the device tree, this function returns NULL instead of +* an error. +* +* Returns a struct reset_control or IS_ERR() condition containing errno. +* +* Use of id names is optional. +*/ +static inline struct reset_control *of_reset_control_get_optional_shared ( +struct device_node *node,const char *id) +{ +return __of_reset_control_get (node, id,0 ,RESET_CONTROL_OPTIONAL_SHARED ); +} +/** * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive * reference to a reset controller
Signature · 1 line
2.43.0