diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-01-04 18:29:31 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-01-28 17:23:44 -0500 |
commit | f8635abd38776a413d1e84c79353693b8ecf45c9 (patch) | |
tree | 335410b72facf10dac9bbd53aeafd570eb4dd538 | |
parent | a352d85adbe8ed0c5c8c69e3ea0ee1833b3ee27e (diff) |
ARM: nomadik: initial devicetree support
Support basic device tree boot on the Nomadik. Implement the
support in the cpu file with the intent of deleting the board
files later. At this stage IRQ controllers, system timer,
l2x0 cache, UARTs and thus console boot is fully functional.
Patch out the code adding devices by initcalls for now so
as not to disturb the boot.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/arm/ste-nomadik.txt | 19 | ||||
-rw-r--r-- | arch/arm/boot/dts/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/boot/dts/ste-nomadik-s8815.dts | 20 | ||||
-rw-r--r-- | arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 80 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/board-nhk8815.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/cpu-8815.c | 78 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/cpu-8815.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/i2c-8815nhk.c | 5 |
8 files changed, 207 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/arm/ste-nomadik.txt b/Documentation/devicetree/bindings/arm/ste-nomadik.txt new file mode 100644 index 000000000000..23f32bddebf9 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/ste-nomadik.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | ST-Ericsson Nomadik Device Tree Bindings | ||
2 | |||
3 | For various board the "board" node may contain specific properties | ||
4 | that pertain to this particular board, such as board-specific GPIOs. | ||
5 | |||
6 | Boards with the Nomadik SoC include: | ||
7 | |||
8 | S8815 "MiniKit" manufactured by Calao Systems: | ||
9 | |||
10 | Required root node property: | ||
11 | |||
12 | compatible="calaosystems,usb-s8815"; | ||
13 | |||
14 | Required node: usb-s8815 | ||
15 | |||
16 | Example: | ||
17 | |||
18 | usb-s8815 { | ||
19 | }; | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index e44da40d984f..7bc5ba738041 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -100,6 +100,7 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \ | |||
100 | imx28-m28evk.dtb \ | 100 | imx28-m28evk.dtb \ |
101 | imx28-sps1.dtb \ | 101 | imx28-sps1.dtb \ |
102 | imx28-tx28.dtb | 102 | imx28-tx28.dtb |
103 | dtb-$(CONFIG_ARCH_NOMADIK) += ste-nomadik-s8815.dtb | ||
103 | dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ | 104 | dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ |
104 | omap3-beagle.dtb \ | 105 | omap3-beagle.dtb \ |
105 | omap3-beagle-xm.dtb \ | 106 | omap3-beagle-xm.dtb \ |
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts new file mode 100644 index 000000000000..97b7d1df5aaa --- /dev/null +++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Device Tree for the ST-Ericsson Nomadik S8815 board | ||
3 | * Produced by Calao Systems | ||
4 | */ | ||
5 | |||
6 | /dts-v1/; | ||
7 | /include/ "ste-nomadik-stn8815.dtsi" | ||
8 | |||
9 | / { | ||
10 | model = "Calao Systems USB-S8815"; | ||
11 | compatible = "calaosystems,usb-s8815"; | ||
12 | |||
13 | chosen { | ||
14 | bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk"; | ||
15 | }; | ||
16 | |||
17 | /* Custom board node with GPIO pins to active etc */ | ||
18 | usb-s8815 { | ||
19 | }; | ||
20 | }; | ||
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi new file mode 100644 index 000000000000..0a5b670430de --- /dev/null +++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Device Tree for the ST-Ericsson Nomadik 8815 STn8815 SoC | ||
3 | */ | ||
4 | /include/ "skeleton.dtsi" | ||
5 | |||
6 | / { | ||
7 | #address-cells = <1>; | ||
8 | #size-cells = <1>; | ||
9 | |||
10 | memory { | ||
11 | reg = <0x00000000 0x04000000>, | ||
12 | <0x08000000 0x04000000>; | ||
13 | }; | ||
14 | |||
15 | L2: l2-cache { | ||
16 | compatible = "arm,l210-cache"; | ||
17 | reg = <0x10210000 0x1000>; | ||
18 | interrupt-parent = <&vica>; | ||
19 | interrupts = <30>; | ||
20 | cache-unified; | ||
21 | cache-level = <2>; | ||
22 | }; | ||
23 | |||
24 | mtu0 { | ||
25 | /* Nomadik system timer */ | ||
26 | reg = <0x101e2000 0x1000>; | ||
27 | interrupt-parent = <&vica>; | ||
28 | interrupts = <4>; | ||
29 | }; | ||
30 | |||
31 | mtu1 { | ||
32 | /* Secondary timer */ | ||
33 | reg = <0x101e3000 0x1000>; | ||
34 | interrupt-parent = <&vica>; | ||
35 | interrupts = <5>; | ||
36 | }; | ||
37 | |||
38 | amba { | ||
39 | compatible = "arm,amba-bus"; | ||
40 | #address-cells = <1>; | ||
41 | #size-cells = <1>; | ||
42 | ranges; | ||
43 | |||
44 | vica: intc@0x10140000 { | ||
45 | compatible = "arm,versatile-vic"; | ||
46 | interrupt-controller; | ||
47 | #interrupt-cells = <1>; | ||
48 | reg = <0x10140000 0x20>; | ||
49 | }; | ||
50 | |||
51 | vicb: intc@0x10140020 { | ||
52 | compatible = "arm,versatile-vic"; | ||
53 | interrupt-controller; | ||
54 | #interrupt-cells = <1>; | ||
55 | reg = <0x10140020 0x20>; | ||
56 | }; | ||
57 | |||
58 | uart0: uart@101fd000 { | ||
59 | compatible = "arm,pl011", "arm,primecell"; | ||
60 | reg = <0x101fd000 0x1000>; | ||
61 | interrupt-parent = <&vica>; | ||
62 | interrupts = <12>; | ||
63 | }; | ||
64 | |||
65 | uart1: uart@101fb000 { | ||
66 | compatible = "arm,pl011", "arm,primecell"; | ||
67 | reg = <0x101fb000 0x1000>; | ||
68 | interrupt-parent = <&vica>; | ||
69 | interrupts = <17>; | ||
70 | }; | ||
71 | |||
72 | uart2: uart@101f2000 { | ||
73 | compatible = "arm,pl011", "arm,primecell"; | ||
74 | reg = <0x101f2000 0x1000>; | ||
75 | interrupt-parent = <&vica>; | ||
76 | interrupts = <28>; | ||
77 | status = "disabled"; | ||
78 | }; | ||
79 | }; | ||
80 | }; | ||
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index 72ec3fad2ba6..d152d7bdf411 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c | |||
@@ -204,6 +204,10 @@ static int __init nhk8815_mmcsd_init(void) | |||
204 | { | 204 | { |
205 | int ret; | 205 | int ret; |
206 | 206 | ||
207 | /* For e.g. devicetree boot */ | ||
208 | if (!machine_is_nomadik()) | ||
209 | return 0; | ||
210 | |||
207 | ret = gpio_request(112, "card detect bias"); | 211 | ret = gpio_request(112, "card detect bias"); |
208 | if (ret) | 212 | if (ret) |
209 | return ret; | 213 | return ret; |
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 351404673f6c..7c8e3487f4eb 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c | |||
@@ -25,13 +25,19 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/irqchip/arm-vic.h> | 28 | #include <linux/irqchip.h> |
29 | #include <linux/platform_data/clk-nomadik.h> | 29 | #include <linux/platform_data/clk-nomadik.h> |
30 | #include <linux/platform_data/pinctrl-nomadik.h> | 30 | #include <linux/platform_data/pinctrl-nomadik.h> |
31 | #include <linux/platform_data/clocksource-nomadik-mtu.h> | ||
32 | #include <linux/of_irq.h> | ||
33 | #include <linux/of_address.h> | ||
34 | #include <linux/of_platform.h> | ||
31 | 35 | ||
32 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
33 | #include <mach/irqs.h> | 37 | #include <mach/irqs.h> |
38 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | 39 | #include <asm/mach/map.h> |
40 | #include <asm/mach/time.h> | ||
35 | 41 | ||
36 | #include <asm/cacheflush.h> | 42 | #include <asm/cacheflush.h> |
37 | #include <asm/hardware/cache-l2x0.h> | 43 | #include <asm/hardware/cache-l2x0.h> |
@@ -160,3 +166,73 @@ void cpu8815_restart(char mode, const char *cmd) | |||
160 | /* Write anything to Reset status register */ | 166 | /* Write anything to Reset status register */ |
161 | writel(1, src_rstsr); | 167 | writel(1, src_rstsr); |
162 | } | 168 | } |
169 | |||
170 | #ifdef CONFIG_OF | ||
171 | |||
172 | /* Initial value for SRC control register: all timers use MXTAL/8 source */ | ||
173 | #define SRC_CR_INIT_MASK 0x00007fff | ||
174 | #define SRC_CR_INIT_VAL 0x2aaa8000 | ||
175 | |||
176 | static void __init cpu8815_timer_init_of(void) | ||
177 | { | ||
178 | struct device_node *mtu; | ||
179 | void __iomem *base; | ||
180 | int irq; | ||
181 | u32 src_cr; | ||
182 | |||
183 | /* We need this to be up now */ | ||
184 | nomadik_clk_init(); | ||
185 | |||
186 | mtu = of_find_node_by_path("/mtu0"); | ||
187 | if (!mtu) | ||
188 | return; | ||
189 | base = of_iomap(mtu, 0); | ||
190 | if (WARN_ON(!base)) | ||
191 | return; | ||
192 | irq = irq_of_parse_and_map(mtu, 0); | ||
193 | |||
194 | pr_info("Remapped MTU @ %p, irq: %d\n", base, irq); | ||
195 | |||
196 | /* Configure timer sources in "system reset controller" ctrl reg */ | ||
197 | src_cr = readl(base); | ||
198 | src_cr &= SRC_CR_INIT_MASK; | ||
199 | src_cr |= SRC_CR_INIT_VAL; | ||
200 | writel(src_cr, base); | ||
201 | |||
202 | nmdk_timer_init(base, irq); | ||
203 | } | ||
204 | |||
205 | /* These are mostly to get the right device names for the clock lookups */ | ||
206 | static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { | ||
207 | OF_DEV_AUXDATA("arm,primecell", NOMADIK_UART0_BASE, | ||
208 | "uart0", NULL), | ||
209 | OF_DEV_AUXDATA("arm,primecell", NOMADIK_UART1_BASE, | ||
210 | "uart1", NULL), | ||
211 | { /* sentinel */ }, | ||
212 | }; | ||
213 | |||
214 | static void __init cpu8815_init_of(void) | ||
215 | { | ||
216 | #ifdef CONFIG_CACHE_L2X0 | ||
217 | /* At full speed latency must be >=2, so 0x249 in low bits */ | ||
218 | l2x0_of_init(0x00730249, 0xfe000fff); | ||
219 | #endif | ||
220 | of_platform_populate(NULL, of_default_bus_match_table, | ||
221 | cpu8815_auxdata_lookup, NULL); | ||
222 | } | ||
223 | |||
224 | static const char * cpu8815_board_compat[] = { | ||
225 | "calaosystems,usb-s8815", | ||
226 | NULL, | ||
227 | }; | ||
228 | |||
229 | DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") | ||
230 | .map_io = cpu8815_map_io, | ||
231 | .init_irq = irqchip_init, | ||
232 | .init_time = cpu8815_timer_init_of, | ||
233 | .init_machine = cpu8815_init_of, | ||
234 | .restart = cpu8815_restart, | ||
235 | .dt_compat = cpu8815_board_compat, | ||
236 | MACHINE_END | ||
237 | |||
238 | #endif | ||
diff --git a/arch/arm/mach-nomadik/cpu-8815.h b/arch/arm/mach-nomadik/cpu-8815.h index 71c21e8a11dc..d6c7830e4799 100644 --- a/arch/arm/mach-nomadik/cpu-8815.h +++ b/arch/arm/mach-nomadik/cpu-8815.h | |||
@@ -2,3 +2,4 @@ extern void cpu8815_map_io(void); | |||
2 | extern void cpu8815_platform_init(void); | 2 | extern void cpu8815_platform_init(void); |
3 | extern void cpu8815_init_irq(void); | 3 | extern void cpu8815_init_irq(void); |
4 | extern void cpu8815_restart(char, const char *); | 4 | extern void cpu8815_restart(char, const char *); |
5 | extern struct sys_timer cpu8815_timer; | ||
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c index f0e9e64f731a..299ff5a687bc 100644 --- a/arch/arm/mach-nomadik/i2c-8815nhk.c +++ b/arch/arm/mach-nomadik/i2c-8815nhk.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/i2c-algo-bit.h> | 4 | #include <linux/i2c-algo-bit.h> |
5 | #include <linux/i2c-gpio.h> | 5 | #include <linux/i2c-gpio.h> |
6 | #include <linux/platform_device.h> | 6 | #include <linux/platform_device.h> |
7 | #include <asm/mach-types.h> | ||
7 | 8 | ||
8 | /* | 9 | /* |
9 | * There are two busses in the 8815NHK. | 10 | * There are two busses in the 8815NHK. |
@@ -58,6 +59,10 @@ static struct platform_device nhk8815_i2c_dev2 = { | |||
58 | 59 | ||
59 | static int __init nhk8815_i2c_init(void) | 60 | static int __init nhk8815_i2c_init(void) |
60 | { | 61 | { |
62 | /* For e.g. devicetree boot */ | ||
63 | if (!machine_is_nomadik()) | ||
64 | return 0; | ||
65 | |||
61 | platform_device_register(&nhk8815_i2c_dev0); | 66 | platform_device_register(&nhk8815_i2c_dev0); |
62 | platform_device_register(&nhk8815_i2c_dev1); | 67 | platform_device_register(&nhk8815_i2c_dev1); |
63 | platform_device_register(&nhk8815_i2c_dev2); | 68 | platform_device_register(&nhk8815_i2c_dev2); |