aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2013-08-21 19:24:22 -0400
committerKevin Hilman <khilman@linaro.org>2013-08-21 19:24:22 -0400
commitfe870ae70bda4bb19ae6920a62e7d05f1dde9b2b (patch)
tree5d4aef6d341f84aef6c09a8025004c954fd3f792
parentf7b29518c33a0fe48cf13b7e2eb04a5fdb11293d (diff)
parentd18fd9445b18c4adf56cfc58c378c702c8edd0da (diff)
Merge tag 'sunxi-core-for-3.12-2' of https://github.com/mripard/linux into next/soc
Allwinner sunXi core additions for 3.12, take 2 These patches add machine support for the Allwinner A20 and A31 SoCs * tag 'sunxi-core-for-3.12-2' of https://github.com/mripard/linux: ARM: sunxi: Introduce Allwinner A20 support ARM: sun6i: Add restart code for the A31 ARM: sunxi: Add the Allwinner A31 compatible to the machine definition
-rw-r--r--Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt (renamed from Documentation/devicetree/bindings/watchdog/sun4i-wdt.txt)5
-rw-r--r--arch/arm/mach-sunxi/Kconfig2
-rw-r--r--arch/arm/mach-sunxi/sunxi.c45
3 files changed, 47 insertions, 5 deletions
diff --git a/Documentation/devicetree/bindings/watchdog/sun4i-wdt.txt b/Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt
index ecd650adff31..e39cb266c8f4 100644
--- a/Documentation/devicetree/bindings/watchdog/sun4i-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt
@@ -1,8 +1,9 @@
1Allwinner sun4i Watchdog timer 1Allwinner SoCs Watchdog timer
2 2
3Required properties: 3Required properties:
4 4
5- compatible : should be "allwinner,sun4i-wdt" 5- compatible : should be "allwinner,<soc-family>-wdt", the currently supported
6 SoC families being sun4i and sun6i
6- reg : Specifies base physical address and size of the registers. 7- reg : Specifies base physical address and size of the registers.
7 8
8Example: 9Example:
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 5b045e302b43..3ab2f65f8a50 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -10,3 +10,5 @@ config ARCH_SUNXI
10 select SPARSE_IRQ 10 select SPARSE_IRQ
11 select SUN4I_TIMER 11 select SUN4I_TIMER
12 select PINCTRL_SUNXI 12 select PINCTRL_SUNXI
13 select ARM_GIC
14 select HAVE_SMP
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 38a3c55527c8..e79fb3469341 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -27,10 +27,19 @@
27#include <asm/system_misc.h> 27#include <asm/system_misc.h>
28 28
29#define SUN4I_WATCHDOG_CTRL_REG 0x00 29#define SUN4I_WATCHDOG_CTRL_REG 0x00
30#define SUN4I_WATCHDOG_CTRL_RESTART (1 << 0) 30#define SUN4I_WATCHDOG_CTRL_RESTART BIT(0)
31#define SUN4I_WATCHDOG_MODE_REG 0x04 31#define SUN4I_WATCHDOG_MODE_REG 0x04
32#define SUN4I_WATCHDOG_MODE_ENABLE (1 << 0) 32#define SUN4I_WATCHDOG_MODE_ENABLE BIT(0)
33#define SUN4I_WATCHDOG_MODE_RESET_ENABLE (1 << 1) 33#define SUN4I_WATCHDOG_MODE_RESET_ENABLE BIT(1)
34
35#define SUN6I_WATCHDOG1_IRQ_REG 0x00
36#define SUN6I_WATCHDOG1_CTRL_REG 0x10
37#define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0)
38#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
39#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
40#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
41#define SUN6I_WATCHDOG1_MODE_REG 0x18
42#define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0)
34 43
35static void __iomem *wdt_base; 44static void __iomem *wdt_base;
36 45
@@ -56,8 +65,36 @@ static void sun4i_restart(enum reboot_mode mode, const char *cmd)
56 } 65 }
57} 66}
58 67
68static void sun6i_restart(enum reboot_mode mode, const char *cmd)
69{
70 if (!wdt_base)
71 return;
72
73 /* Disable interrupts */
74 writel(0, wdt_base + SUN6I_WATCHDOG1_IRQ_REG);
75
76 /* We want to disable the IRQ and just reset the whole system */
77 writel(SUN6I_WATCHDOG1_CONFIG_RESTART,
78 wdt_base + SUN6I_WATCHDOG1_CONFIG_REG);
79
80 /* Enable timer. The default and lowest interval value is 0.5s */
81 writel(SUN6I_WATCHDOG1_MODE_ENABLE,
82 wdt_base + SUN6I_WATCHDOG1_MODE_REG);
83
84 /* Restart the watchdog. */
85 writel(SUN6I_WATCHDOG1_CTRL_RESTART,
86 wdt_base + SUN6I_WATCHDOG1_CTRL_REG);
87
88 while (1) {
89 mdelay(5);
90 writel(SUN6I_WATCHDOG1_MODE_ENABLE,
91 wdt_base + SUN6I_WATCHDOG1_MODE_REG);
92 }
93}
94
59static struct of_device_id sunxi_restart_ids[] = { 95static struct of_device_id sunxi_restart_ids[] = {
60 { .compatible = "allwinner,sun4i-wdt", .data = sun4i_restart }, 96 { .compatible = "allwinner,sun4i-wdt", .data = sun4i_restart },
97 { .compatible = "allwinner,sun6i-wdt", .data = sun6i_restart },
61 { /*sentinel*/ } 98 { /*sentinel*/ }
62}; 99};
63 100
@@ -96,6 +133,8 @@ static const char * const sunxi_board_dt_compat[] = {
96 "allwinner,sun4i-a10", 133 "allwinner,sun4i-a10",
97 "allwinner,sun5i-a10s", 134 "allwinner,sun5i-a10s",
98 "allwinner,sun5i-a13", 135 "allwinner,sun5i-a13",
136 "allwinner,sun6i-a31",
137 "allwinner,sun7i-a20",
99 NULL, 138 NULL,
100}; 139};
101 140