[PATCH 3/3] reset_source: give reset_source_set_device a priority parameter
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Nov 20 05:06:40 PST 2024
All users of reset_source_set_device() are PMICs, which should set a
higher reset priority that the default anyway, therefore let's give the
function a priority parameter and set a default priority of 200 as
opposed to RESET_SOURCE_DEFAULT_PRIORITY, which expands to 100.
Setting a higher priority is important as PMICs tend to power cycle the
SoC, so asking the SoC about the reset source would then always return
POR.
In my particular case, the i.MX watchdog driver sees that the reset
source is WDG and then it sets POR with a priority of 101, overriding
what the PMIC determined.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/reset_source.c | 5 ++---
drivers/mfd/da9053.c | 2 +-
drivers/mfd/da9063.c | 2 +-
drivers/mfd/pca9450.c | 2 +-
include/reset_source.h | 6 ++++--
5 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/common/reset_source.c b/common/reset_source.c
index 495f3d527a84..bd1efe073664 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -74,10 +74,9 @@ void reset_source_set_prinst(enum reset_src_type st,
}
EXPORT_SYMBOL(reset_source_set_prinst);
-void reset_source_set_device(struct device *dev, enum reset_src_type st)
+void reset_source_set_device(struct device *dev, enum reset_src_type st,
+ unsigned int priority)
{
- unsigned int priority = RESET_SOURCE_DEFAULT_PRIORITY;
-
of_property_read_u32(dev->of_node, "reset-source-priority", &priority);
__reset_source_set(dev, st, priority, -1);
diff --git a/drivers/mfd/da9053.c b/drivers/mfd/da9053.c
index cbfb62cef9cd..c8ad8aa0eeed 100644
--- a/drivers/mfd/da9053.c
+++ b/drivers/mfd/da9053.c
@@ -224,7 +224,7 @@ static void da9053_detect_reset_source(struct da9053_priv *da9053)
else
return;
- reset_source_set_device(da9053->dev, type);
+ reset_source_set_device(da9053->dev, type, 200);
ret = da9053_reg_write(da9053, DA9053_FAULTLOG_REG, val);
if (ret < 0)
diff --git a/drivers/mfd/da9063.c b/drivers/mfd/da9063.c
index 04bcad88040c..4842ead6f8b9 100644
--- a/drivers/mfd/da9063.c
+++ b/drivers/mfd/da9063.c
@@ -309,7 +309,7 @@ static void da9063_detect_reset_source(struct da9063 *priv)
else
return;
- reset_source_set_device(priv->dev, type);
+ reset_source_set_device(priv->dev, type, 200);
}
static void da9063_restart(struct restart_handler *rst)
diff --git a/drivers/mfd/pca9450.c b/drivers/mfd/pca9450.c
index 89eca9f890e3..73b5cecbeda5 100644
--- a/drivers/mfd/pca9450.c
+++ b/drivers/mfd/pca9450.c
@@ -58,7 +58,7 @@ static int pca9450_get_reset_source(struct device *dev, struct regmap *map)
type = RESET_UKWN;
}
- reset_source_set_device(dev, type);
+ reset_source_set_device(dev, type, 200);
return 0;
};
diff --git a/include/reset_source.h b/include/reset_source.h
index 3766208b6d11..cc1fe60d4615 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -28,7 +28,8 @@ const char *reset_source_to_string(enum reset_src_type st);
int reset_source_get_instance(void);
struct device *reset_source_get_device(void);
-void reset_source_set_device(struct device *dev, enum reset_src_type st);
+void reset_source_set_device(struct device *dev, enum reset_src_type st,
+ unsigned int priority);
void reset_source_set_prinst(enum reset_src_type,
unsigned int priority, int instance);
@@ -55,7 +56,8 @@ static inline struct device *reset_source_get_device(void)
}
static inline void reset_source_set_device(struct device *dev,
- enum reset_src_type st)
+ enum reset_src_type st,
+ unsigned int priority)
{
}
--
2.39.5
More information about the barebox
mailing list