aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sunxi/sunxi.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-sunxi/sunxi.c')
-rw-r--r--arch/arm/mach-sunxi/sunxi.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 1dc8a92e5a5f..23afb732cb40 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -21,15 +21,16 @@
21 21
22#include <linux/irqchip/sunxi.h> 22#include <linux/irqchip/sunxi.h>
23 23
24#include <asm/hardware/vic.h>
25
26#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 25#include <asm/mach/map.h>
28 26
29#include "sunxi.h" 27#include "sunxi.h"
30 28
31#define WATCHDOG_CTRL_REG 0x00 29#define WATCHDOG_CTRL_REG 0x00
30#define WATCHDOG_CTRL_RESTART (1 << 0)
32#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)
33 34
34static void __iomem *wdt_base; 35static void __iomem *wdt_base;
35 36
@@ -50,11 +51,19 @@ static void sunxi_restart(char mode, const char *cmd)
50 return; 51 return;
51 52
52 /* Enable timer and set reset bit in the watchdog */ 53 /* Enable timer and set reset bit in the watchdog */
53 writel(3, wdt_base + WATCHDOG_MODE_REG); 54 writel(WATCHDOG_MODE_ENABLE | WATCHDOG_MODE_RESET_ENABLE,
54 writel(0xa57 << 1 | 1, wdt_base + WATCHDOG_CTRL_REG); 55 wdt_base + WATCHDOG_MODE_REG);
55 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) {
56 mdelay(5); 64 mdelay(5);
57 writel(3, wdt_base + WATCHDOG_MODE_REG); 65 writel(WATCHDOG_MODE_ENABLE | WATCHDOG_MODE_RESET_ENABLE,
66 wdt_base + WATCHDOG_MODE_REG);
58 } 67 }
59} 68}
60 69
@@ -91,6 +100,6 @@ DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
91 .init_irq = sunxi_init_irq, 100 .init_irq = sunxi_init_irq,
92 .handle_irq = sunxi_handle_irq, 101 .handle_irq = sunxi_handle_irq,
93 .restart = sunxi_restart, 102 .restart = sunxi_restart,
94 .timer = &sunxi_timer, 103 .init_time = &sunxi_timer_init,
95 .dt_compat = sunxi_board_dt_compat, 104 .dt_compat = sunxi_board_dt_compat,
96MACHINE_END 105MACHINE_END