aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-11-21 13:52:05 -0500
committerOlof Johansson <olof@lixom.net>2012-11-21 13:52:44 -0500
commite9f6d13513ea9fd33b0184db8fc33cf51baa584b (patch)
tree281401f6a868b888e30465eac233e084ed6d8bb3
parent41739b60b3c00e0591d1a413276ddfa0d0b1ea89 (diff)
parent67bea88dd842deb3ed8327ad101970dbd615ddcb (diff)
Merge branch 'sunxi/soc2' into next/soc
From Maxime Ripard: Here is a pull request to add the support for Allwinner A10 SoCs. * sunxi/soc2: ARM: sunxi: Add sunxi restart function via onchip watchdog ARM: sunxi: Add sun4i and cubieboard support ARM: sunxi: Add earlyprintk support for UART0 (sun4i) ARM: sunxi: Restructure sunxi dts/dtsi files Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt13
-rw-r--r--arch/arm/Kconfig.debug9
-rw-r--r--arch/arm/boot/dts/Makefile3
-rw-r--r--arch/arm/boot/dts/sun4i-cubieboard.dts38
-rw-r--r--arch/arm/boot/dts/sun5i-olinuxino.dts6
-rw-r--r--arch/arm/boot/dts/sun5i.dtsi56
-rw-r--r--arch/arm/boot/dts/sunxi.dtsi80
-rw-r--r--arch/arm/include/debug/sunxi.S5
-rw-r--r--arch/arm/mach-sunxi/sunxi.c35
9 files changed, 186 insertions, 59 deletions
diff --git a/Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt b/Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt
new file mode 100644
index 000000000000..0b2717775600
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt
@@ -0,0 +1,13 @@
1Allwinner sunXi Watchdog timer
2
3Required properties:
4
5- compatible : should be "allwinner,sunxi-wdt"
6- reg : Specifies base physical address and size of the registers.
7
8Example:
9
10wdt: watchdog@01c20c90 {
11 compatible = "allwinner,sunxi-wdt";
12 reg = <0x01c20c90 0x10>;
13};
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 4c336c3c4d7e..6783273f9e0b 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -345,6 +345,13 @@ choice
345 Say Y here if you want kernel low-level debugging support 345 Say Y here if you want kernel low-level debugging support
346 on SOCFPGA based platforms. 346 on SOCFPGA based platforms.
347 347
348 config DEBUG_SUNXI_UART0
349 bool "Kernel low-level debugging messages via sunXi UART0"
350 depends on ARCH_SUNXI
351 help
352 Say Y here if you want kernel low-level debugging support
353 on Allwinner A1X based platforms on the UART0.
354
348 config DEBUG_SUNXI_UART1 355 config DEBUG_SUNXI_UART1
349 bool "Kernel low-level debugging messages via sunXi UART1" 356 bool "Kernel low-level debugging messages via sunXi UART1"
350 depends on ARCH_SUNXI 357 depends on ARCH_SUNXI
@@ -431,7 +438,7 @@ config DEBUG_LL_INCLUDE
431 default "debug/mvebu.S" if DEBUG_MVEBU_UART 438 default "debug/mvebu.S" if DEBUG_MVEBU_UART
432 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART 439 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
433 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART 440 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
434 default "debug/sunxi.S" if DEBUG_SUNXI_UART1 441 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
435 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ 442 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
436 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 443 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
437 default "mach/debug-macro.S" 444 default "mach/debug-macro.S"
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 22e4ac9a4e7d..8585bc0d5c0a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -86,7 +86,8 @@ dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
86 spear310-evb.dtb \ 86 spear310-evb.dtb \
87 spear320-evb.dtb 87 spear320-evb.dtb
88dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb 88dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb
89dtb-$(CONFIG_ARCH_SUNXI) += sun5i-olinuxino.dtb 89dtb-$(CONFIG_ARCH_SUNXI) += sun4i-cubieboard.dtb \
90 sun5i-olinuxino.dtb
90dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 91dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
91 tegra20-medcom-wide.dtb \ 92 tegra20-medcom-wide.dtb \
92 tegra20-paz00.dtb \ 93 tegra20-paz00.dtb \
diff --git a/arch/arm/boot/dts/sun4i-cubieboard.dts b/arch/arm/boot/dts/sun4i-cubieboard.dts
new file mode 100644
index 000000000000..f4ca126ad994
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-cubieboard.dts
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2012 Stefan Roese
3 * Stefan Roese <sr@denx.de>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/dts-v1/;
14/include/ "sun4i.dtsi"
15
16/ {
17 model = "Cubietech Cubieboard";
18 compatible = "cubietech,cubieboard", "allwinner,sun4i";
19
20 aliases {
21 serial0 = &uart0;
22 serial1 = &uart1;
23 };
24
25 chosen {
26 bootargs = "earlyprintk console=ttyS0,115200";
27 };
28
29 soc {
30 uart0: uart@01c28000 {
31 status = "okay";
32 };
33
34 uart1: uart@01c28400 {
35 status = "okay";
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/sun5i-olinuxino.dts b/arch/arm/boot/dts/sun5i-olinuxino.dts
index 3b1cce3af7cb..d6ff889a5d87 100644
--- a/arch/arm/boot/dts/sun5i-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-olinuxino.dts
@@ -18,8 +18,12 @@
18 model = "Olimex A13-Olinuxino"; 18 model = "Olimex A13-Olinuxino";
19 compatible = "olimex,a13-olinuxino", "allwinner,sun5i"; 19 compatible = "olimex,a13-olinuxino", "allwinner,sun5i";
20 20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
21 soc { 25 soc {
22 duart: uart@01c28400 { 26 uart1: uart@01c28400 {
23 status = "okay"; 27 status = "okay";
24 }; 28 };
25 }; 29 };
diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index 4bedf3e826e8..59a2d265a98e 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -11,64 +11,10 @@
11 * http://www.gnu.org/copyleft/gpl.html 11 * http://www.gnu.org/copyleft/gpl.html
12 */ 12 */
13 13
14/include/ "skeleton.dtsi" 14/include/ "sunxi.dtsi"
15 15
16/ { 16/ {
17 interrupt-parent = <&intc>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,cortex-a8";
22 };
23 };
24
25 chosen {
26 bootargs = "earlyprintk console=ttyS0,115200";
27 };
28
29 memory { 17 memory {
30 reg = <0x40000000 0x20000000>; 18 reg = <0x40000000 0x20000000>;
31 }; 19 };
32
33 clocks {
34 #address-cells = <1>;
35 #size-cells = <0>;
36
37 osc: oscillator {
38 #clock-cells = <0>;
39 compatible = "fixed-clock";
40 clock-frequency = <24000000>;
41 };
42 };
43
44 soc {
45 compatible = "simple-bus";
46 #address-cells = <1>;
47 #size-cells = <1>;
48 reg = <0x01c20000 0x300000>;
49 ranges;
50
51 timer@01c20c00 {
52 compatible = "allwinner,sunxi-timer";
53 reg = <0x01c20c00 0x400>;
54 interrupts = <22>;
55 clocks = <&osc>;
56 };
57
58 intc: interrupt-controller@01c20400 {
59 compatible = "allwinner,sunxi-ic";
60 reg = <0x01c20400 0x400>;
61 interrupt-controller;
62 #interrupt-cells = <1>;
63 };
64
65 uart1: uart@01c28400 {
66 compatible = "ns8250";
67 reg = <0x01c28400 0x400>;
68 interrupts = <2>;
69 reg-shift = <2>;
70 clock-frequency = <24000000>;
71 status = "disabled";
72 };
73 };
74}; 20};
diff --git a/arch/arm/boot/dts/sunxi.dtsi b/arch/arm/boot/dts/sunxi.dtsi
new file mode 100644
index 000000000000..8bbc2bfef221
--- /dev/null
+++ b/arch/arm/boot/dts/sunxi.dtsi
@@ -0,0 +1,80 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&intc>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,cortex-a8";
22 };
23 };
24
25 clocks {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 osc: oscillator {
30 #clock-cells = <0>;
31 compatible = "fixed-clock";
32 clock-frequency = <24000000>;
33 };
34 };
35
36 soc {
37 compatible = "simple-bus";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 reg = <0x01c20000 0x300000>;
41 ranges;
42
43 timer@01c20c00 {
44 compatible = "allwinner,sunxi-timer";
45 reg = <0x01c20c00 0x90>;
46 interrupts = <22>;
47 clocks = <&osc>;
48 };
49
50 wdt: watchdog@01c20c90 {
51 compatible = "allwinner,sunxi-wdt";
52 reg = <0x01c20c90 0x10>;
53 };
54
55 intc: interrupt-controller@01c20400 {
56 compatible = "allwinner,sunxi-ic";
57 reg = <0x01c20400 0x400>;
58 interrupt-controller;
59 #interrupt-cells = <1>;
60 };
61
62 uart0: uart@01c28000 {
63 compatible = "ns8250";
64 reg = <0x01c28000 0x400>;
65 interrupts = <1>;
66 reg-shift = <2>;
67 clock-frequency = <24000000>;
68 status = "disabled";
69 };
70
71 uart1: uart@01c28400 {
72 compatible = "ns8250";
73 reg = <0x01c28400 0x400>;
74 interrupts = <2>;
75 reg-shift = <2>;
76 clock-frequency = <24000000>;
77 status = "disabled";
78 };
79 };
80};
diff --git a/arch/arm/include/debug/sunxi.S b/arch/arm/include/debug/sunxi.S
index 3bf61ca0df75..04eb56d5db2c 100644
--- a/arch/arm/include/debug/sunxi.S
+++ b/arch/arm/include/debug/sunxi.S
@@ -10,7 +10,10 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13#ifdef CONFIG_DEBUG_SUNXI_UART1 13#if defined(CONFIG_DEBUG_SUNXI_UART0)
14#define SUNXI_UART_DEBUG_PHYS_BASE 0x01c28000
15#define SUNXI_UART_DEBUG_VIRT_BASE 0xf1c28000
16#elif defined(CONFIG_DEBUG_SUNXI_UART1)
14#define SUNXI_UART_DEBUG_PHYS_BASE 0x01c28400 17#define SUNXI_UART_DEBUG_PHYS_BASE 0x01c28400
15#define SUNXI_UART_DEBUG_VIRT_BASE 0xf1c28400 18#define SUNXI_UART_DEBUG_VIRT_BASE 0xf1c28400
16#endif 19#endif
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 8f42df8af1da..dc634ae2081f 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/of_address.h>
15#include <linux/of_irq.h> 16#include <linux/of_irq.h>
16#include <linux/of_platform.h> 17#include <linux/of_platform.h>
17#include <linux/io.h> 18#include <linux/io.h>
@@ -26,6 +27,36 @@
26 27
27#include "sunxi.h" 28#include "sunxi.h"
28 29
30#define WATCHDOG_CTRL_REG 0x00
31#define WATCHDOG_MODE_REG 0x04
32
33static void __iomem *wdt_base;
34
35static void sunxi_setup_restart(void)
36{
37 struct device_node *np = of_find_compatible_node(NULL, NULL,
38 "allwinner,sunxi-wdt");
39 if (WARN(!np, "unable to setup watchdog restart"))
40 return;
41
42 wdt_base = of_iomap(np, 0);
43 WARN(!wdt_base, "failed to map watchdog base address");
44}
45
46static void sunxi_restart(char mode, const char *cmd)
47{
48 if (!wdt_base)
49 return;
50
51 /* Enable timer and set reset bit in the watchdog */
52 writel(3, wdt_base + WATCHDOG_MODE_REG);
53 writel(0xa57 << 1 | 1, wdt_base + WATCHDOG_CTRL_REG);
54 while(1) {
55 mdelay(5);
56 writel(3, wdt_base + WATCHDOG_MODE_REG);
57 }
58}
59
29static struct map_desc sunxi_io_desc[] __initdata = { 60static struct map_desc sunxi_io_desc[] __initdata = {
30 { 61 {
31 .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE, 62 .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE,
@@ -42,10 +73,13 @@ void __init sunxi_map_io(void)
42 73
43static void __init sunxi_dt_init(void) 74static void __init sunxi_dt_init(void)
44{ 75{
76 sunxi_setup_restart();
77
45 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 78 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
46} 79}
47 80
48static const char * const sunxi_board_dt_compat[] = { 81static const char * const sunxi_board_dt_compat[] = {
82 "allwinner,sun4i",
49 "allwinner,sun5i", 83 "allwinner,sun5i",
50 NULL, 84 NULL,
51}; 85};
@@ -55,6 +89,7 @@ DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
55 .map_io = sunxi_map_io, 89 .map_io = sunxi_map_io,
56 .init_irq = sunxi_init_irq, 90 .init_irq = sunxi_init_irq,
57 .handle_irq = sunxi_handle_irq, 91 .handle_irq = sunxi_handle_irq,
92 .restart = sunxi_restart,
58 .timer = &sunxi_timer, 93 .timer = &sunxi_timer,
59 .dt_compat = sunxi_board_dt_compat, 94 .dt_compat = sunxi_board_dt_compat,
60MACHINE_END 95MACHINE_END