]> git.sur5r.net Git - u-boot/commitdiff
sunxi: Implement reset_cpu
authorHans de Goede <hdegoede@redhat.com>
Mon, 9 Jun 2014 09:36:56 +0000 (11:36 +0200)
committerIan Campbell <ijc@hellion.org.uk>
Sun, 6 Jul 2014 19:12:44 +0000 (20:12 +0100)
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>
arch/arm/cpu/armv7/sunxi/board.c
arch/arm/include/asm/arch-sunxi/timer.h

index 49c94489ee5d2f7d145055b0614f9eacd63f184d..c80b42121c29c2b5e3c905b1509405c86e67a4f9 100644 (file)
@@ -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 */
index 6aacfd7b39696db1f498570974f9aec017f4eace..58e14fd0f713033aeaa2e2b0976b40444a8e1399 100644 (file)
 #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>