aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2021-04-13 16:43:20 +0200
committerStefan Roese <sr@denx.de>2021-04-28 10:05:13 +0200
commitd0c94749dc5cb54e253e52e7581db5293b72049b (patch)
treeb209c696f0b590a8d7e447e0c15110b888f629cc /drivers
parent48179af9d281ddca474c7181d9a26a2f1f28e174 (diff)
downloadu-boot-d0c94749dc5cb54e253e52e7581db5293b72049b.zip
u-boot-d0c94749dc5cb54e253e52e7581db5293b72049b.tar.gz
u-boot-d0c94749dc5cb54e253e52e7581db5293b72049b.tar.bz2
watchdog: use time_after_eq() in watchdog_reset()
Some boards don't work with the rate-limiting done in the generic watchdog_reset() provided by wdt-uclass. For example, on powerpc, get_timer() ceases working during bootm since interrupts are disabled before the kernel image gets decompressed, and when the decompression takes longer than the watchdog device allows (or enough of the budget that the kernel doesn't get far enough to assume responsibility for petting the watchdog), the result is a non-booting board. As a somewhat hacky workaround (because DT is supposed to describe hardware), allow specifying hw_margin_ms=0 in device tree to effectively disable the ratelimiting and actually ping the watchdog every time watchdog_reset() is called. For that to work, the "has enough time passed" check just needs to be tweaked a little to allow the now==next_reset case as well. Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/watchdog/wdt-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 0603ffb..2687135 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -148,7 +148,7 @@ void watchdog_reset(void)
/* Do not reset the watchdog too often */
now = get_timer(0);
- if (time_after(now, next_reset)) {
+ if (time_after_eq(now, next_reset)) {
next_reset = now + reset_period;
wdt_reset(gd->watchdog_dev);
}