linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrej Picej <andrej.picej@norik.com>
To: linux-watchdog@vger.kernel.org
Cc: wim@linux-watchdog.org, linux@roeck-us.net, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com
Subject: [RFC PATCH 1/1] watchdog: imx2_wdg: suspend watchdog in WAIT mode
Date: Wed, 21 Sep 2022 14:46:47 +0200	[thread overview]
Message-ID: <20220921124647.1521667-2-andrej.picej@norik.com> (raw)
In-Reply-To: <20220921124647.1521667-1-andrej.picej@norik.com>

Putting device into the "Suspend-To-Idle" mode causes watchdog to
trigger and reset the board after set watchdog timeout period elapses.
Setting WDW bit in WCR (Watchdog Control Register) suspends watchdog in
WAIT mode (corresponds to "Suspend-To-Idle" mode) and allows board to be
in idle for infinite amount of time. Watchdog operation is restored
after exiting WAIT mode as expected.

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 drivers/watchdog/imx2_wdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 51bfb796898b..f888f29f50dd 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -35,6 +35,7 @@
 
 #define IMX2_WDT_WCR		0x00		/* Control Register */
 #define IMX2_WDT_WCR_WT		(0xFF << 8)	/* -> Watchdog Timeout Field */
+#define IMX2_WDT_WCR_WDW	BIT(7)		/* -> Watchdog disable for WAIT */
 #define IMX2_WDT_WCR_WDA	BIT(5)		/* -> External Reset WDOG_B */
 #define IMX2_WDT_WCR_SRS	BIT(4)		/* -> Software Reset Signal */
 #define IMX2_WDT_WCR_WRE	BIT(3)		/* -> WDOG Reset Enable */
@@ -128,6 +129,8 @@ static inline void imx2_wdt_setup(struct watchdog_device *wdog)
 
 	/* Suspend timer in low power mode, write once-only */
 	val |= IMX2_WDT_WCR_WDZST;
+	/* Suspend timer in low power WAIT mode, write once-only */
+	val |= IMX2_WDT_WCR_WDW;
 	/* Strip the old watchdog Time-Out value */
 	val &= ~IMX2_WDT_WCR_WT;
 	/* Generate internal chip-level reset if WDOG times out */
-- 
2.25.1


  reply	other threads:[~2022-09-21 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 12:46 [RFC PATCH 0/1] Suspending i.MX watchdog in WAIT mode Andrej Picej
2022-09-21 12:46 ` Andrej Picej [this message]
2022-09-21 14:18 ` Guenter Roeck
2022-09-22  7:17   ` Andrej Picej
2022-09-22 14:56     ` Guenter Roeck
2022-09-23  7:27       ` Andrej Picej
2022-09-23 13:48         ` Guenter Roeck
2022-09-26  7:36           ` Andrej Picej
2022-10-03 11:36             ` Andrej Picej

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=20220921124647.1521667-2-andrej.picej@norik.com \
    --to=andrej.picej@norik.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=wim@linux-watchdog.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;
as well as URLs for NNTP newsgroup(s).