[PATCH 2/4] watchdog: dw_wdt: Detect if running initially

Sascha Hauer s.hauer at pengutronix.de
Thu Jun 10 06:06:11 PDT 2021


Let the watchdog core know if the watchdog is currently running or not.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/watchdog/dw_wdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index bc5d4a889a..bc5af810ea 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -164,6 +164,9 @@ static int dw_wdt_drv_probe(struct device_d *dev)
 	wdd->hwdev = dev;
 	wdd->set_timeout = dw_wdt_set_timeout;
 
+	wdd->running = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET) &
+		WDOG_CONTROL_REG_WDT_EN_MASK ? WDOG_HW_RUNNING : WDOG_HW_NOT_RUNNING;
+
 	dw_wdt->rate = clk_get_rate(clk);
 	if (dw_wdt->rate == 0)
 		return -EINVAL;
-- 
2.29.2




More information about the barebox mailing list