I have attached three patches that ultimately provide in a gapless watchdog functionality right from u-boot start. This is tested onto a BF527 platform:
- Option to specify a GPIO as a toggle output for each watchdog reset issued by u-boot.
- New "halt" command to stop watchdog resets - ability to test the watchdog.
- Bug fix: a watchdog init in start.S will always follow after an initcode watchdog. But in start.S, a temporary watchdog disable was failing.
- Unused hw_watchdog_init is removed now.
The patch uses 2000 ms for initcode and 500 ms for u-boot start-up as test values. Invoking the "halt" command resets after 0.5 seconds.
This patch makes sense when the linux image provides an early watchdog enable sequence. For test purposes I added following three lines in the boardfile that is used for the test:
void __init native_machine_early_platform_add_devices(void)
+ printk(KERN_INFO "wdog cnt: %d, ctl %04x", bfin_read_WDOG_CNT(), bfin_read_WDOG_CTL());
+ if (bfin_read_WDOG_CNT()) // supposed watchdog timer was active during pre-boot (u-boot)
printk(KERN_INFO "register early platform devices\n");
These lines do nothing when u-boot is not updated, since WDOG_CTL = 0 in this case. When u-boot ist updated with this patch, a fixed 10 seconds timeout time is configured just before linux kernel is started.
A new environment variable wdtimeout_boot can be used to configure this timeout time. When 0 is assigned, no watchdog is operational upon start of linux kernel. (the printk-statement can be outcommented)