initialization of global variables in u-boot

Tomek The Messenger tomekthemessenger at
Wed Nov 4 18:02:34 EST 2020

As there is none u-boot mailing list anymore I will ask question here.
Maybe someone will know answer.
I have two watchdogs in hardware. One is synopsys designware one (so
standard u-boot global functions hw_watchdog_init and hw_watchdog_reset are
implemented by open source synopsys designware driver. And I have second
watchdog for which I implement my own driver and it bases on device tree
model. Let's see at below code:
include/watchdog.h  (I added second config and modify macro WATCHDOG_RESET)
 extern void hw_watchdog_reset(void);
     extern void dm_hw_watchdog_reset(void);
#define WATCHDOG_RESET() {hw_watchdog_reset();      dm_hw_watchdog_reset();}
#define WATCHDOG_RESET hw_watchdog_reset

implementation of dm_hw_watchdog_reset function:
struct udevice* wdt = NULL;
void dm_hw_watchdog_reset(void)
int ret;
if (wdt) {
else {
    ret = 2+8;
    /*ret = uclass_get_device_by_driver(UCLASS_WDT,
 DM_GET_DRIVER(wdt_bmu), &wdt);
    if (ret)
        printf("Lack of watchdog device\n");
        wdt_start(wdt, 60000, 0);*/
void dm_hw_watchdog_reset(void)
#endif  [/code]

What is weird when Uboot is started it prints tens of times:
" dm_hw_watchdog_reset"
and then hangs on. I have to power on/off the board and recovery it with
the aid of jtag. I don't understand why 'wdt' variable isn't NULL and code
under if (wdt) is executed. Seems like something uboot specific.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Kernelnewbies mailing list