@@ -191,6 +191,20 @@ void reset_controller_add_lookup(struct reset_control_lookup *lookup,
}
EXPORT_SYMBOL_GPL(reset_controller_add_lookup);
+/**
+ * reset_controller_get_dev - get reset controller device
+ * @rstc: reset controller
+ */
+struct reset_controller_dev *
+reset_controller_get_dev(struct reset_control *rstc)
+{
+ if (!rstc)
+ return NULL;
+
+ return rstc->rcdev;
+}
+EXPORT_SYMBOL_GPL(reset_controller_get_dev);
+
static inline struct reset_control_array *
rstc_to_array(struct reset_control *rstc) {
return container_of(rstc, struct reset_control_array, base);
@@ -5,6 +5,7 @@
#include <linux/list.h>
struct reset_controller_dev;
+struct reset_control;
/**
* struct reset_control_ops - reset controller driver callbacks
@@ -89,6 +90,8 @@ int devm_reset_controller_register(struct device *dev,
void reset_controller_add_lookup(struct reset_control_lookup *lookup,
unsigned int num_entries);
+
+struct reset_controller_dev *reset_controller_get_dev(struct reset_control *rstc);
#else
static inline int reset_controller_register(struct reset_controller_dev *rcdev)
{
@@ -109,6 +112,12 @@ static inline void reset_controller_add_lookup(struct reset_control_lookup *look
unsigned int num_entries)
{
}
+
+static inline struct reset_controller_dev *
+reset_controller_get_dev(struct reset_control *rstc)
+{
+ return 0;
+}
#endif
#endif
Add support for finding the device associated with the reset controller. A reset consumer can use this API to find the reset controller device and then call the corresponding provider device to configure some register. (eg: As per latest RZ/G2L HW manual Rev 1.30 RZ/G2L USB phy controller IP exposes a register for vbus control selection) Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/reset/core.c | 14 ++++++++++++++ include/linux/reset-controller.h | 9 +++++++++ 2 files changed, 23 insertions(+)