[U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu

Hans de Goede hdegoede at redhat.com
Sat May 10 13:37:37 CEST 2014


Hi,

On 03/24/2014 12:53 AM, Henrik Nordström wrote:
> 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.

Thanks, I'm currently working on v2 of this series and I've included this
fix.

Regards,

Hans


More information about the U-Boot mailing list