mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00

When the watchdog is running the HiFive Unmatched board does not reboot properly and shuts down itself a few seconds after reboot, in the early stages of the u-boot loading. On a Linux kernel this happens when the da9063_wdt module is loaded. This does not happen if the module is unloaded before reboot or if the watchdog module is loaded with "stop_on_reboot=1". Fix that by stopping the watchdog before attempting to reset the board. This is done by zeroing the TWDSCALE field of CONTROL_D register, unless it was already set to 0. Reported-by: Tianon Gravi <tianon@debian.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Nikita Shubin <n.shubin@yadro.com> Tested-by: Nikita Shubin <n.shubin@yadro.com> Reviewed-by: Anup Patel <anup@brainfault.org>