From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/3] reset_source: give reset_source_set_device a priority parameter
Date: Wed, 20 Nov 2024 14:06:40 +0100 [thread overview]
Message-ID: <20241120130640.3866362-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241120130640.3866362-1-a.fatoum@pengutronix.de>
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@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
prev parent reply other threads:[~2024-11-20 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-20 13:06 [PATCH 1/3] reset_source: have reset_source_set_device actually set device Ahmad Fatoum
2024-11-20 13:06 ` [PATCH 2/3] mfd: rn5t568: refactor to call reset_source_set_device only once Ahmad Fatoum
2024-11-20 13:06 ` Ahmad Fatoum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241120130640.3866362-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox