initialization of global variables in u-boot
Tomek The Messenger
tomekthemessenger at gmail.com
Wed Nov 4 18:02:34 EST 2020
Hi
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)
[code]
extern void hw_watchdog_reset(void);
#if defined(CONFIG_DM_HW_WATCHDOG)
extern void dm_hw_watchdog_reset(void);
#define WATCHDOG_RESET() {hw_watchdog_reset(); dm_hw_watchdog_reset();}
#else
#define WATCHDOG_RESET hw_watchdog_reset
#endif
[/code]
implementation of dm_hw_watchdog_reset function:
[code]
#ifndef CONFIG_SPL_BUILD
struct udevice* wdt = NULL;
void dm_hw_watchdog_reset(void)
{
int ret;
if (wdt) {
printf("dm_hw_watchdog_reset\n");
wdt_reset(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");
else
wdt_start(wdt, 60000, 0);*/
}
}
#else
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: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20201105/1ddaa9a4/attachment.html>
More information about the Kernelnewbies
mailing list