]> git.baikalelectronics.ru Git - uboot.git/commit
watchdog: use time_after_eq() in watchdog_reset()
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Tue, 13 Apr 2021 14:43:20 +0000 (16:43 +0200)
committerStefan Roese <sr@denx.de>
Wed, 28 Apr 2021 08:05:13 +0000 (10:05 +0200)
commit3d084f0201f30b4233c4c3a07cea28b4dedbd1e6
treeb209c696f0b590a8d7e447e0c15110b888f629cc
parent81a2666d635527f9e01e2bb2216811afb0200f98
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>
drivers/watchdog/wdt-uclass.c