watchdog: pnx4008: readout watchdog state
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 11 Apr 2019 19:14:37 +0000 (21:14 +0200)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sun, 5 May 2019 19:04:56 +0000 (21:04 +0200)
Readout the enabled state so it is possible to get the pre-userspace
handler working. Also, avoid disabling the watchdog to ensure it continues
working and triggers if there is an issue later in the boot or if userspace
fails to start.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/pnx4008_wdt.c

index f94d844e596cdd423a9b98d7b5162d0ddc82534c..d9e03544aeae653f7de727477c0a2064eb7182aa 100644 (file)
@@ -217,7 +217,8 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
        watchdog_set_nowayout(&pnx4008_wdd, nowayout);
        watchdog_set_restart_priority(&pnx4008_wdd, 128);
 
-       pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */
+       if (readl(WDTIM_CTRL(wdt_base)) & COUNT_ENAB)
+               set_bit(WDOG_HW_RUNNING, &pnx4008_wdd.status);
 
        ret = devm_watchdog_register_device(dev, &pnx4008_wdd);
        if (ret < 0) {