Hello Everyone,
I have a question related to the hardware watchdog timer on AM5728 enabled in the U-Boot stage. In order to support the HW WDT in U-Boot, I made changes in U-Boot configuration and added a call to hw_watchdog_init() in board specific code in board/ti/am57xx/board.c (more on this below). My current changes look like this:
/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig:
CONFIG_HW_WATCHDOG=y
CONFIG_SPL_WATCHDOG_SUPPORT=y
CONFIG_OMAP_WATCHDOG=y
board/ti/am57xx/board.c
int board_init(void)
{
#if defined(CONFIG_HW_WATCHDOG)
printf("******** board_init(), calling hw_watchdog_init() ********\n");
printf("**********************************************************\n");
hw_watchdog_init();
#endif
gpmc_init();
gd->bd->bi_boot_params = (CONFIG_SYS_SDRAM_BASE + 0x100);
//return 0;
return 1;
}
Code shown above does indeed result in a board reboot at the predefined interval WDT_HW_TIMEOUT which is 60 seconds (drivers/watchdog/omap_wdt.c). I also added temporary debugging code in drivers/watchdog/omap_watchdog.c. Once I reboot the board, the following console output sequence is displayed:
U-Boot SPL 2018.01-g131dc82830 (Nov 04 2019 - 00:56:49)
DRA752-GP ES2.0
******** hw_watchdog_init() called! ********
************************************************
******** hw_watchdog_disable() called! ********
************************************************
******** omap_wdt_set_timeout() called! ********
************************************************
Trying to boot from MMC2_2
no pinctrl state for default mode
palmas_i2c_write_u8: chip=58 reg=51 val=43
palmas_i2c_write_u8: chip=58 reg=50 val=5
no pinctrl state for default mode
...
reading u-boot.img
reading u-boot.img
reading u-boot.img
reading u-boot.img
U-Boot 2018.01-g131dc82830 (Nov 04 2019 - 00:56:49 +0000)
CPU : DRA752-GP ES2.0
Model: TI AM5728 IDK
Board: Humatics ALB REV
DRAM: 2 GiB
******** board_init(), calling hw_watchdog_init() ********
**********************************************************
******** hw_watchdog_init() called! ********
************************************************
******** hw_watchdog_disable() called! ********
************************************************
******** omap_wdt_set_timeout() called! ********
************************************************
initcall sequence fefb1734 failed at call 80803c1d (err=1)
### ERROR ### Please RESET the board ###
>>>>>>>>>>>>>>>>>>>>>>>>>>> THE BOARD REBOOTS HERE AFTER 60 SECONDS. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Comments on the above code.
The reason I return a "1" from board_init() above is to test the code I added.
When the extra call to hw_watchdog_init() (added by me) is not present in board_init(), regardless of whether a I return a 1 or a 0 from board_init(), the first set of calls to hw_watchdog_*() functions always appears. I am not sure where they are coming form. I also don't understand why, even though the HW WDT timer is not enabled, a board hangs and never restarts again.
The reason I add an explicit call to hw_watchdog_init() in board_init() is because without it, the board hangs after boot and never restarts. That is, hw_watchdog_reset() is never called even though a call to hw_watchdog_init() is called from somewhere else and from my code. This is despite the fact that HW WDT is now enabled in U-Boot configuration as mentioned above. It seems that adding this call is necessary.
Finally, with code shown above and board_init() augmented to return 0, after Linux boots all the way on the board, the following message is printed indefinitely on the console:
[ 211.402546] watchdog: watchdog0: watchdog did not stop!
[ 212.477426] watchdog: watchdog0: watchdog did not stop!
[ 213.551362] watchdog: watchdog0: watchdog did not stop!
[ 214.625176] watchdog: watchdog0: watchdog did not stop!
[ 215.699052] watchdog: watchdog0: watchdog did not stop!
If someone could shed some light on my observations, I would appreciate it.
Regards,
Paul