mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] watchdog: imxwd: Do not suspend in lpm on i.MX27
Date: Wed, 15 May 2024 13:01:56 +0200	[thread overview]
Message-ID: <20240515110156.1920361-1-s.hauer@pengutronix.de> (raw)

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




             reply	other threads:[~2024-05-15 11:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 11:01 Sascha Hauer [this message]
2024-05-16  6:09 ` Sascha Hauer

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=20240515110156.1920361-1-s.hauer@pengutronix.de \
    --to=s.hauer@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