Skip to contentSkip to conversation

watchdog: pnx4008: readout watchdog state

PATCH In review Alexandre Belloni 3 participants 3 messages Apr 11, 2019 – Apr 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 watchdog: pnx4008: readout watchdog state

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.

---
 drivers/watchdog/pnx4008_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/pnx4008_wdt.c +2 -1
index 8e261799c84e..4ce0389d1442 100644
@@ -209,7 +209,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 = watchdog_register_device(&pnx4008_wdd);
 	if (ret < 0) {
Signature · 1 line
2.20.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Alexandre Belloni

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.

Quoted 21 lines
---
 drivers/watchdog/pnx4008_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/pnx4008_wdt.c +2 -1
index 8e261799c84e..4ce0389d1442 100644
@@ -209,7 +209,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 = watchdog_register_device(&pnx4008_wdd);
 	if (ret < 0) {
Signature · 1 line
2.20.1
Tested-by on v2 1/1
#2 lore raw
In reply to Alexandre Belloni
Quoted 6 lines · Alexandre Belloni

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.

Quoted 19 lines
---
 drivers/watchdog/pnx4008_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/pnx4008_wdt.c +2 -1
index 8e261799c84e..4ce0389d1442 100644
@@ -209,7 +209,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 = watchdog_register_device(&pnx4008_wdd);

if (ret < 0) {