Skip to content

Commit

Permalink
watchdog: make DesignWare watchdog allow users to set bigger timeout …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Wang, Peng 1. (NSB - CN/Hangzhou) authored and Wim Van Sebroeck committed Jan 27, 2020
1 parent 85fdc63 commit d4ba76d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/watchdog/dw_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d4ba76d

Please sign in to comment.