Skip to content

Commit

Permalink
watchdog: msc313e: Check if the WDT was running at boot
Browse files Browse the repository at this point in the history
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: Romain Perier <romain.perier@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211228073427.2443174-1-daniel@0x0f.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
  • Loading branch information
Daniel Palmer authored and Wim Van Sebroeck committed Jan 5, 2022
1 parent 4ed224a commit ffd264b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/watchdog/msc313e_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ffd264b

Please sign in to comment.