]> Git Repo - J-linux.git/commitdiff
watchdog: msc313e: Check if the WDT was running at boot
authorDaniel Palmer <[email protected]>
Tue, 28 Dec 2021 07:34:27 +0000 (16:34 +0900)
committerWim Van Sebroeck <[email protected]>
Wed, 5 Jan 2022 09:38:51 +0000 (10:38 +0100)
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 <[email protected]>
Reviewed-by: Romain Perier <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
drivers/watchdog/msc313e_wdt.c

index 0d497aa0fb7d9acbed4c2c6085f4aaa64da517bd..90171431fc59433317fc8123e4b28c9b47578383 100644 (file)
@@ -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);
This page took 0.048373 seconds and 4 git commands to generate.