devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Andrej Picej <andrej.picej@norik.com>
Cc: linux-watchdog@vger.kernel.org, shawnguo@kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-imx@nxp.com, festevam@gmail.com, kernel@pengutronix.de,
	s.hauer@pengutronix.de, wim@linux-watchdog.org,
	robh+dt@kernel.org
Subject: Re: [PATCH 1/3] watchdog: imx2_wdg: suspend watchdog in WAIT mode
Date: Wed, 19 Oct 2022 08:33:06 -0700	[thread overview]
Message-ID: <20221019153306.GC4602@roeck-us.net> (raw)
In-Reply-To: <20221019111714.1953262-2-andrej.picej@norik.com>

On Wed, Oct 19, 2022 at 01:17:12PM +0200, Andrej Picej wrote:
> Putting device into the "Suspend-To-Idle" mode causes watchdog to
> trigger and reset the board after set watchdog timeout period elapses.
> 
> Introduce new device-tree property "fsl,suspend-in-wait" which suspends
> watchdog in WAIT mode. This is done by setting WDW bit in WCR
> (Watchdog Control Register) Watchdog operation is restored after exiting
> WAIT mode as expected. WAIT mode coresponds with Linux's
> "Suspend-To-Idle".
> 

Does that have any impact on suspend/resume handling in the driver,
specifically with the "no_ping" variable used for fsl,imx7d-wdt ?

Thanks,
Guenter

> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> ---
>  drivers/watchdog/imx2_wdt.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
> index d0c5d47ddede..150ba83ce176 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 */
> @@ -67,6 +68,7 @@ struct imx2_wdt_device {
>  	bool ext_reset;
>  	bool clk_is_on;
>  	bool no_ping;
> +	bool sleep_wait;
>  };
>  
>  static bool nowayout = WATCHDOG_NOWAYOUT;
> @@ -129,6 +131,9 @@ 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 */
> +	if (wdev->sleep_wait)
> +		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 */
> @@ -313,6 +318,8 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
>  
>  	wdev->ext_reset = of_property_read_bool(dev->of_node,
>  						"fsl,ext-reset-output");
> +	wdev->sleep_wait = of_property_read_bool(dev->of_node,
> +						"fsl,suspend-in-wait");
>  	/*
>  	 * The i.MX7D doesn't support low power mode, so we need to ping the watchdog
>  	 * during suspend.
> -- 
> 2.25.1
> 

  reply	other threads:[~2022-10-19 15:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 11:17 [PATCH 0/3] Suspending i.MX watchdog in WAIT mode Andrej Picej
2022-10-19 11:17 ` [PATCH 1/3] watchdog: imx2_wdg: suspend " Andrej Picej
2022-10-19 15:33   ` Guenter Roeck [this message]
2022-10-20  6:02     ` Andrej Picej
2022-10-19 11:17 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx: document suspend in wait mode Andrej Picej
2022-10-19 13:00   ` Alexander Stein
2022-10-19 15:51     ` Krzysztof Kozlowski
2022-10-20  6:23       ` Andrej Picej
2022-10-20 12:18         ` Krzysztof Kozlowski
2022-10-20 12:36           ` Andrej Picej
2022-10-20 12:41             ` Alexander Stein
2022-10-20 13:05               ` Andrej Picej
2022-10-20 18:23                 ` Krzysztof Kozlowski
2022-10-21  5:56                   ` Andrej Picej
2022-10-19 11:17 ` [PATCH 3/3] ARM: dts: imx6ul/ull: suspend i.MX6UL watchdog " Andrej Picej
2022-10-19 12:16 ` [PATCH 0/3] Suspending i.MX watchdog in WAIT mode Fabio Estevam
2022-10-19 15:30 ` Guenter Roeck
2022-10-20  5:21   ` Andrej Picej
2022-10-19 15:46 ` Krzysztof Kozlowski
2022-10-20  5:49   ` Andrej Picej
2022-10-20 12:04     ` Krzysztof Kozlowski
2022-10-20 12:16       ` 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=20221019153306.GC4602@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=andrej.picej@norik.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --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).