* [PATCH] watchdog: msc313e: Check if the WDT was running at boot
@ 2021-12-28 7:34 Daniel Palmer
2021-12-28 16:06 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Palmer @ 2021-12-28 7:34 UTC (permalink / raw)
To: wim, linux, linux-watchdog
Cc: romain.perier, linux-arm-kernel, linux-kernel, Daniel Palmer
Check if the WDT was running at boot and set the running
flag if it was. This prevents the system from getting
rebooted if the userland daemon doesn't take over soon enough
or there isn't a userland daemon at all.
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
drivers/watchdog/msc313e_wdt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c
index 0d497aa0fb7d..90171431fc59 100644
--- a/drivers/watchdog/msc313e_wdt.c
+++ b/drivers/watchdog/msc313e_wdt.c
@@ -120,6 +120,10 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
priv->wdev.max_timeout = U32_MAX / clk_get_rate(priv->clk);
priv->wdev.timeout = MSC313E_WDT_DEFAULT_TIMEOUT;
+ /* If the period is non-zero the WDT is running */
+ if (readw(priv->base + REG_WDT_MAX_PRD_L) | (readw(priv->base + REG_WDT_MAX_PRD_H) << 16))
+ set_bit(WDOG_HW_RUNNING, &priv->wdev.status);
+
watchdog_set_drvdata(&priv->wdev, priv);
watchdog_init_timeout(&priv->wdev, timeout, dev);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog: msc313e: Check if the WDT was running at boot
2021-12-28 7:34 [PATCH] watchdog: msc313e: Check if the WDT was running at boot Daniel Palmer
@ 2021-12-28 16:06 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-12-28 16:06 UTC (permalink / raw)
To: Daniel Palmer, wim, linux-watchdog
Cc: romain.perier, linux-arm-kernel, linux-kernel
On 12/27/21 11:34 PM, Daniel Palmer wrote:
> Check if the WDT was running at boot and set the running
> flag if it was. This prevents the system from getting
> rebooted if the userland daemon doesn't take over soon enough
> or there isn't a userland daemon at all.
>
> Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/msc313e_wdt.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c
> index 0d497aa0fb7d..90171431fc59 100644
> --- a/drivers/watchdog/msc313e_wdt.c
> +++ b/drivers/watchdog/msc313e_wdt.c
> @@ -120,6 +120,10 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
> priv->wdev.max_timeout = U32_MAX / clk_get_rate(priv->clk);
> priv->wdev.timeout = MSC313E_WDT_DEFAULT_TIMEOUT;
>
> + /* If the period is non-zero the WDT is running */
> + if (readw(priv->base + REG_WDT_MAX_PRD_L) | (readw(priv->base + REG_WDT_MAX_PRD_H) << 16))
> + set_bit(WDOG_HW_RUNNING, &priv->wdev.status);
> +
> watchdog_set_drvdata(&priv->wdev, priv);
>
> watchdog_init_timeout(&priv->wdev, timeout, dev);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-28 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-28 7:34 [PATCH] watchdog: msc313e: Check if the WDT was running at boot Daniel Palmer
2021-12-28 16:06 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox