diff options
author | Wang, Peng 1. (NSB - CN/Hangzhou) <peng.1.wang@nokia-sbell.com> | 2019-11-25 02:04:13 +0000 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2020-01-27 15:55:44 +0100 |
commit | d4ba76d79854178ffff55d66e1a72580484a741d (patch) | |
tree | fb4265b77912f8efe9f0b852d51670fca3cf642d /drivers/watchdog | |
parent | 85fdc63fe256b595f923a69848cd99972ff446d8 (diff) |
watchdog: make DesignWare watchdog allow users to set bigger timeout value
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>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/dw_wdt.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index fef7c61f5555..738eee5c8751 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -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; } |