[U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu
Henrik Nordström
henrik at henriknordstrom.net
Mon Mar 24 00:53:01 CET 2014
sön 2014-03-16 klockan 14:53 +0100 skrev Hans de Goede:
> void reset_cpu(ulong addr)
> {
> + static const struct sunxi_wdog *wdog =
> + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog;
> +
> + /* Set the watchdog for its shortest interval (.5s) and wait */
> + writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
> + writel(WDT_CTRL_RESTART, &wdog->ctl);
> + while (1);
This code is incomplete and do not reload the watchdog if already
running. wdog->ctl is locked by a magic key. Should use
writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
where
#define WDT_CTRL_KEY (0x0a57 << 1)
Unfortunatley Allwinner kindly omitted this little detail from the User
Manual.
Found out while trying to use the watchdog as a watchdog and not only
reset. Asked Tom while he still was at Allwinner and got clarification
on how to use the watchdog control register.
Regards
Henrik
More information about the U-Boot
mailing list