]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
watchdog: make DesignWare watchdog allow users to set bigger timeout value
authorWang, Peng 1. (NSB - CN/Hangzhou) <peng.1.wang@nokia-sbell.com>
Mon, 25 Nov 2019 02:04:13 +0000 (02:04 +0000)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Mon, 27 Jan 2020 14:55:44 +0000 (15:55 +0100)
watchdog_dev.c provides means to allow users to set bigger timeout value
than HW can support, make DesignWare watchdog align with this.

Signed-off-by: Peng Wang <peng.1.wang@nokia-sbell.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/8fa54e92c6cd4544a7a3eb60a373ac43@nokia-sbell.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/dw_wdt.c

index fef7c61f5555aea07b4485b9c76ffa2628dce29b..738eee5c8751b2e4c5a136431750368664243745 100644 (file)
@@ -114,7 +114,15 @@ static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s)
        writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
               dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
 
-       wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
+       /*
+        * In case users set bigger timeout value than HW can support,
+        * kernel(watchdog_dev.c) helps to feed watchdog before
+        * wdd->max_hw_heartbeat_ms
+        */
+       if (top_s * 1000 <= wdd->max_hw_heartbeat_ms)
+               wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
+       else
+               wdd->timeout = top_s;
 
        return 0;
 }