[PATCH 3/4] watchdog: dw_wdt: set maximum timeout

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


Communicate the maximum possible timeout to the watchdog core.

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

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index bc5af810ea..e23d9cc225 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -159,18 +159,19 @@ static int dw_wdt_drv_probe(struct device_d *dev)
 	if (IS_ERR(dw_wdt->rst))
 		return PTR_ERR(dw_wdt->rst);
 
+	dw_wdt->rate = clk_get_rate(clk);
+	if (dw_wdt->rate == 0)
+		return -EINVAL;
+
 	wdd = &dw_wdt->wdd;
 	wdd->name = "dw_wdt";
 	wdd->hwdev = dev;
 	wdd->set_timeout = dw_wdt_set_timeout;
+	wdd->timeout_max = dw_wdt_top_in_seconds(dw_wdt, DW_WDT_MAX_TOP);
 
 	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;
-
 	ret = watchdog_register(wdd);
 	if (ret)
 		goto out_disable_clk;
-- 
2.29.2




More information about the barebox mailing list