Skip to content

Commit ffd264b

Browse files
fifteenhexWim Van Sebroeck
authored andcommitted
watchdog: msc313e: Check if the WDT was running at boot
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]>
1 parent 4ed224a commit ffd264b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/watchdog/msc313e_wdt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
120120
priv->wdev.max_timeout = U32_MAX / clk_get_rate(priv->clk);
121121
priv->wdev.timeout = MSC313E_WDT_DEFAULT_TIMEOUT;
122122

123+
/* If the period is non-zero the WDT is running */
124+
if (readw(priv->base + REG_WDT_MAX_PRD_L) | (readw(priv->base + REG_WDT_MAX_PRD_H) << 16))
125+
set_bit(WDOG_HW_RUNNING, &priv->wdev.status);
126+
123127
watchdog_set_drvdata(&priv->wdev, priv);
124128

125129
watchdog_init_timeout(&priv->wdev, timeout, dev);

0 commit comments

Comments
 (0)