mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] watchdog: imxwd: Do not suspend in lpm on i.MX27
@ 2024-05-15 11:01 Sascha Hauer
  2024-05-16  6:09 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2024-05-15 11:01 UTC (permalink / raw)
  To: Barebox List

The i.MX watchdog has two different configurable behaviours for low
power modes.  The watchdog can either be suspended during low power
modes or kept running.
The useful behaviour is normally to disable it during low power modes to
be able to suspend the system without having the watchdog resetting the
system. This setting was introduced in the Kernel back in 2014 [1] and
in barebox back in 2021 [2].
On i.MX27 however this setting has the effect that the watchdog is
suspended during normal cpu_do_idle(), so on an idle system it takes
very long time until the watchdog triggers. This renders this setting
useless, so disable it on i.MX27. This seems to be fixed on SoCs newer
than i.MX35.

[1] 1a9c5efa576ec ("watchdog: imx2_wdt: disable watchdog timer during low power mode")
[2] c3787a81f26bb ("watchdog: imxwd: suspend watchdog timer in low power mode")

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/watchdog/imxwd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 8f4de5a994..616248af38 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -33,6 +33,7 @@ struct imx_wd {
 	struct restart_handler restart_warm;
 	bool ext_reset;
 	bool bigendian;
+	bool suspend_in_lpm;
 };
 
 #define to_imx_wd(h) container_of(h, struct imx_wd, wd)
@@ -127,7 +128,8 @@ static int imx21_watchdog_set_timeout(struct imx_wd *priv, unsigned timeout)
 		val |= IMX21_WDOG_WCR_WDT;
 
 	/* Suspend timer in low power mode */
-	val |= IMX21_WDOG_WCR_WDZST;
+	if (priv->suspend_in_lpm)
+		val |= IMX21_WDOG_WCR_WDZST;
 
 	/*
 	 * set time and some write once bits first prior enabling the
@@ -273,6 +275,7 @@ static int imx_wd_probe(struct device *dev)
 
 	priv->ext_reset = of_property_read_bool(dev->of_node,
 						"fsl,ext-reset-output");
+	priv->suspend_in_lpm = !of_machine_is_compatible("fsl,imx27");
 
 	if (IS_ENABLED(CONFIG_WATCHDOG_IMX)) {
 		if (priv->ops->is_running) {
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] watchdog: imxwd: Do not suspend in lpm on i.MX27
  2024-05-15 11:01 [PATCH] watchdog: imxwd: Do not suspend in lpm on i.MX27 Sascha Hauer
@ 2024-05-16  6:09 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-05-16  6:09 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Wed, 15 May 2024 13:01:56 +0200, Sascha Hauer wrote:
> The i.MX watchdog has two different configurable behaviours for low
> power modes.  The watchdog can either be suspended during low power
> modes or kept running.
> The useful behaviour is normally to disable it during low power modes to
> be able to suspend the system without having the watchdog resetting the
> system. This setting was introduced in the Kernel back in 2014 [1] and
> in barebox back in 2021 [2].
> On i.MX27 however this setting has the effect that the watchdog is
> suspended during normal cpu_do_idle(), so on an idle system it takes
> very long time until the watchdog triggers. This renders this setting
> useless, so disable it on i.MX27. This seems to be fixed on SoCs newer
> than i.MX35.
> 
> [...]

Applied, thanks!

[1/1] watchdog: imxwd: Do not suspend in lpm on i.MX27
      https://git.pengutronix.de/cgit/barebox/commit/?id=d5d01f156ee2 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-16  6:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-15 11:01 [PATCH] watchdog: imxwd: Do not suspend in lpm on i.MX27 Sascha Hauer
2024-05-16  6:09 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox