aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2013-02-04 17:32:39 -0500
committerOlof Johansson <olof@lixom.net>2013-02-05 14:02:39 -0500
commitb60decad7791694a36ad218cede77a407c1475ce (patch)
tree7631316bb6a52551f556dfeb5fd4880ddd099340
parentb28eaacfbbccef527834d48f118919b39ec8d213 (diff)
sunxi: Cleanup the reset code and add meaningful registers defines
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--arch/arm/mach-sunxi/sunxi.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index fb8fbcecb17f..23afb732cb40 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -27,7 +27,10 @@
27#include "sunxi.h" 27#include "sunxi.h"
28 28
29#define WATCHDOG_CTRL_REG 0x00 29#define WATCHDOG_CTRL_REG 0x00
30#define WATCHDOG_CTRL_RESTART (1 << 0)
30#define WATCHDOG_MODE_REG 0x04 31#define WATCHDOG_MODE_REG 0x04
32#define WATCHDOG_MODE_ENABLE (1 << 0)
33#define WATCHDOG_MODE_RESET_ENABLE (1 << 1)
31 34
32static void __iomem *wdt_base; 35static void __iomem *wdt_base;
33 36
@@ -48,11 +51,19 @@ static void sunxi_restart(char mode, const char *cmd)
48 return; 51 return;
49 52
50 /* Enable timer and set reset bit in the watchdog */ 53 /* Enable timer and set reset bit in the watchdog */
51 writel(3, wdt_base + WATCHDOG_MODE_REG); 54 writel(WATCHDOG_MODE_ENABLE | WATCHDOG_MODE_RESET_ENABLE,
52 writel(0xa57 << 1 | 1, wdt_base + WATCHDOG_CTRL_REG); 55 wdt_base + WATCHDOG_MODE_REG);
53 while(1) { 56
57 /*
58 * Restart the watchdog. The default (and lowest) interval
59 * value for the watchdog is 0.5s.
60 */
61 writel(WATCHDOG_CTRL_RESTART, wdt_base + WATCHDOG_CTRL_REG);
62
63 while (1) {
54 mdelay(5); 64 mdelay(5);
55 writel(3, wdt_base + WATCHDOG_MODE_REG); 65 writel(WATCHDOG_MODE_ENABLE | WATCHDOG_MODE_RESET_ENABLE,
66 wdt_base + WATCHDOG_MODE_REG);
56 } 67 }
57} 68}
58 69