mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-27 07:01:24 +00:00
sunxi: Implement reset_cpu
There is no way to reset the cpu, so use the watchdog for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
This commit is contained in:
parent
b6ae6765c5
commit
c7e79dec85
2 changed files with 12 additions and 0 deletions
|
@ -56,6 +56,13 @@ int gpio_init(void)
|
|||
|
||||
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_KEY | WDT_CTRL_RESTART, &wdog->ctl);
|
||||
while (1);
|
||||
}
|
||||
|
||||
/* do some early init */
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
#ifndef _SUNXI_TIMER_H_
|
||||
#define _SUNXI_TIMER_H_
|
||||
|
||||
#define WDT_CTRL_RESTART (0x1 << 0)
|
||||
#define WDT_CTRL_KEY (0x0a57 << 1)
|
||||
#define WDT_MODE_EN (0x1 << 0)
|
||||
#define WDT_MODE_RESET_EN (0x1 << 1)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
|
Loading…
Reference in a new issue