AnsweredAssumed Answered

u-boot watchdog extension & bugfix

Question asked by Rob. on Mar 12, 2012
Latest reply on Mar 12, 2012 by sonic

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:

 

0001

- 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.

 

0002

- 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.

 

0003

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)

+        bfin_write_WDOG_CTL(0);

     printk(KERN_INFO "register early platform devices\n");

     early_platform_add_devices(tcm_bf537_early_devices,

         ARRAY_SIZE(tcm_bf537_early_devices));

 

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)

Outcomes