aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-07-26 05:19:06 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-07-28 03:32:04 -0400
commit3ba7222ac992d24d09ccd0b55940b54849eef752 (patch)
tree278ee248319b6a71cb72fafa36fa90ff1c641cfe
parent7e71330169d8056536b299290544980bccc6b300 (diff)
arm/versatile: Add device tree support
For testing the dt work, define a dt-enabled versatile platform. This patch adds a new versatile platform for when using the device tree. Add platform and amba devices are discovered and registered by parsing the device tree. Clocks and initial io mappings are still configured statically. This patch still depends on some static platform_data for a few devices which is passed via the auxdata structure to of_platform_populate(), but it is a viable starting point until the drivers can get all configuration data out of the device tree. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--Documentation/devicetree/bindings/arm/arm-boards20
-rw-r--r--Documentation/devicetree/bindings/i2c/arm-versatile.txt10
-rw-r--r--Documentation/devicetree/bindings/mtd/arm-versatile.txt8
-rw-r--r--Documentation/devicetree/bindings/net/smsc-lan91c111.txt10
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts192
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts48
-rw-r--r--arch/arm/mach-versatile/Kconfig8
-rw-r--r--arch/arm/mach-versatile/Makefile1
-rw-r--r--arch/arm/mach-versatile/core.c62
-rw-r--r--arch/arm/mach-versatile/core.h4
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c51
11 files changed, 414 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm-boards b/Documentation/devicetree/bindings/arm/arm-boards
new file mode 100644
index 000000000000..91f26148af79
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/arm-boards
@@ -0,0 +1,20 @@
1ARM Versatile Application and Platform Baseboards
2-------------------------------------------------
3ARM's development hardware platform with connectors for customizable
4core tiles. The hardware configuration of the Versatile boards is
5highly customizable.
6
7Required properties (in root node):
8 compatible = "arm,versatile-ab"; /* Application baseboard */
9 compatible = "arm,versatile-pb"; /* Platform baseboard */
10
11Interrupt controllers:
12- VIC required properties:
13 compatible = "arm,versatile-vic";
14 interrupt-controller;
15 #interrupt-cells = <1>;
16
17- SIC required properties:
18 compatible = "arm,versatile-sic";
19 interrupt-controller;
20 #interrupt-cells = <1>;
diff --git a/Documentation/devicetree/bindings/i2c/arm-versatile.txt b/Documentation/devicetree/bindings/i2c/arm-versatile.txt
new file mode 100644
index 000000000000..361d31c51b6f
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/arm-versatile.txt
@@ -0,0 +1,10 @@
1i2c Controller on ARM Versatile platform:
2
3Required properties:
4- compatible : Must be "arm,versatile-i2c";
5- reg
6- #address-cells = <1>;
7- #size-cells = <0>;
8
9Optional properties:
10- Child nodes conforming to i2c bus binding
diff --git a/Documentation/devicetree/bindings/mtd/arm-versatile.txt b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
new file mode 100644
index 000000000000..476845db94d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
@@ -0,0 +1,8 @@
1Flash device on ARM Versatile board
2
3Required properties:
4- compatible : must be "arm,versatile-flash";
5- bank-width : width in bytes of flash interface.
6
7Optional properties:
8- Subnode partition map from mtd flash binding
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
new file mode 100644
index 000000000000..953049b4248a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
@@ -0,0 +1,10 @@
1SMSC LAN91c111 Ethernet mac
2
3Required properties:
4- compatible = "smsc,lan91c111";
5- reg : physical address and size of registers
6- interrupts : interrupt connection
7
8Optional properties:
9- phy-device : phandle to Ethernet phy
10- local-mac-address : Ethernet mac address to use
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
new file mode 100644
index 000000000000..0b32925f2147
--- /dev/null
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -0,0 +1,192 @@
1/dts-v1/;
2/include/ "skeleton.dtsi"
3
4/ {
5 model = "ARM Versatile AB";
6 compatible = "arm,versatile-ab";
7 #address-cells = <1>;
8 #size-cells = <1>;
9 interrupt-parent = <&vic>;
10
11 aliases {
12 serial0 = &uart0;
13 serial1 = &uart1;
14 serial2 = &uart2;
15 i2c0 = &i2c0;
16 };
17
18 memory {
19 reg = <0x0 0x08000000>;
20 };
21
22 flash@34000000 {
23 compatible = "arm,versatile-flash";
24 reg = <0x34000000 0x4000000>;
25 bank-width = <4>;
26 };
27
28 i2c0: i2c@10002000 {
29 #address-cells = <1>;
30 #size-cells = <0>;
31 compatible = "arm,versatile-i2c";
32 reg = <0x10002000 0x1000>;
33
34 rtc@68 {
35 compatible = "dallas,ds1338";
36 reg = <0x68>;
37 };
38 };
39
40 net@10010000 {
41 compatible = "smsc,lan91c111";
42 reg = <0x10010000 0x10000>;
43 interrupts = <25>;
44 };
45
46 lcd@10008000 {
47 compatible = "arm,versatile-lcd";
48 reg = <0x10008000 0x1000>;
49 };
50
51 amba {
52 compatible = "arm,amba-bus";
53 #address-cells = <1>;
54 #size-cells = <1>;
55 ranges;
56
57 vic: intc@10140000 {
58 compatible = "arm,versatile-vic";
59 interrupt-controller;
60 #interrupt-cells = <1>;
61 reg = <0x10140000 0x1000>;
62 };
63
64 sic: intc@10003000 {
65 compatible = "arm,versatile-sic";
66 interrupt-controller;
67 #interrupt-cells = <1>;
68 reg = <0x10003000 0x1000>;
69 interrupt-parent = <&vic>;
70 interrupts = <31>; /* Cascaded to vic */
71 };
72
73 dma@10130000 {
74 compatible = "arm,pl081", "arm,primecell";
75 reg = <0x10130000 0x1000>;
76 interrupts = <17>;
77 };
78
79 uart0: uart@101f1000 {
80 compatible = "arm,pl011", "arm,primecell";
81 reg = <0x101f1000 0x1000>;
82 interrupts = <12>;
83 };
84
85 uart1: uart@101f2000 {
86 compatible = "arm,pl011", "arm,primecell";
87 reg = <0x101f2000 0x1000>;
88 interrupts = <13>;
89 };
90
91 uart2: uart@101f3000 {
92 compatible = "arm,pl011", "arm,primecell";
93 reg = <0x101f3000 0x1000>;
94 interrupts = <14>;
95 };
96
97 smc@10100000 {
98 compatible = "arm,primecell";
99 reg = <0x10100000 0x1000>;
100 };
101
102 mpmc@10110000 {
103 compatible = "arm,primecell";
104 reg = <0x10110000 0x1000>;
105 };
106
107 display@10120000 {
108 compatible = "arm,pl110", "arm,primecell";
109 reg = <0x10120000 0x1000>;
110 interrupts = <16>;
111 };
112
113 sctl@101e0000 {
114 compatible = "arm,primecell";
115 reg = <0x101e0000 0x1000>;
116 };
117
118 watchdog@101e1000 {
119 compatible = "arm,primecell";
120 reg = <0x101e1000 0x1000>;
121 interrupts = <0>;
122 };
123
124 gpio0: gpio@101e4000 {
125 compatible = "arm,pl061", "arm,primecell";
126 reg = <0x101e4000 0x1000>;
127 gpio-controller;
128 interrupts = <6>;
129 #gpio-cells = <2>;
130 interrupt-controller;
131 #interrupt-cells = <2>;
132 };
133
134 gpio1: gpio@101e5000 {
135 compatible = "arm,pl061", "arm,primecell";
136 reg = <0x101e5000 0x1000>;
137 interrupts = <7>;
138 gpio-controller;
139 #gpio-cells = <2>;
140 interrupt-controller;
141 #interrupt-cells = <2>;
142 };
143
144 rtc@101e8000 {
145 compatible = "arm,pl030", "arm,primecell";
146 reg = <0x101e8000 0x1000>;
147 interrupts = <10>;
148 };
149
150 sci@101f0000 {
151 compatible = "arm,primecell";
152 reg = <0x101f0000 0x1000>;
153 interrupts = <15>;
154 };
155
156 ssp@101f4000 {
157 compatible = "arm,pl022", "arm,primecell";
158 reg = <0x101f4000 0x1000>;
159 interrupts = <11>;
160 };
161
162 fpga {
163 compatible = "arm,versatile-fpga", "simple-bus";
164 #address-cells = <1>;
165 #size-cells = <1>;
166 ranges = <0 0x10000000 0x10000>;
167
168 aaci@4000 {
169 compatible = "arm,primecell";
170 reg = <0x4000 0x1000>;
171 interrupts = <24>;
172 };
173 mmc@5000 {
174 compatible = "arm,primecell";
175 reg = < 0x5000 0x1000>;
176 interrupts = <22>;
177 };
178 kmi@6000 {
179 compatible = "arm,pl050", "arm,primecell";
180 reg = <0x6000 0x1000>;
181 interrupt-parent = <&sic>;
182 interrupts = <3>;
183 };
184 kmi@7000 {
185 compatible = "arm,pl050", "arm,primecell";
186 reg = <0x7000 0x1000>;
187 interrupt-parent = <&sic>;
188 interrupts = <4>;
189 };
190 };
191 };
192};
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts
new file mode 100644
index 000000000000..8a614e398004
--- /dev/null
+++ b/arch/arm/boot/dts/versatile-pb.dts
@@ -0,0 +1,48 @@
1/include/ "versatile-ab.dts"
2
3/ {
4 model = "ARM Versatile PB";
5 compatible = "arm,versatile-pb";
6
7 amba {
8 gpio2: gpio@101e6000 {
9 compatible = "arm,pl061", "arm,primecell";
10 reg = <0x101e6000 0x1000>;
11 interrupts = <8>;
12 gpio-controller;
13 #gpio-cells = <2>;
14 interrupt-controller;
15 #interrupt-cells = <2>;
16 };
17
18 gpio3: gpio@101e7000 {
19 compatible = "arm,pl061", "arm,primecell";
20 reg = <0x101e7000 0x1000>;
21 interrupts = <9>;
22 gpio-controller;
23 #gpio-cells = <2>;
24 interrupt-controller;
25 #interrupt-cells = <2>;
26 };
27
28 fpga {
29 uart@9000 {
30 compatible = "arm,pl011", "arm,primecell";
31 reg = <0x9000 0x1000>;
32 interrupt-parent = <&sic>;
33 interrupts = <6>;
34 };
35 sci@a000 {
36 compatible = "arm,primecell";
37 reg = <0xa000 0x1000>;
38 interrupt-parent = <&sic>;
39 interrupts = <5>;
40 };
41 mmc@b000 {
42 compatible = "arm,primecell";
43 reg = <0xb000 0x1000>;
44 interrupts = <23>;
45 };
46 };
47 };
48};
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 9cdec5aa04a0..c1f38f6625b2 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -17,4 +17,12 @@ config MACH_VERSATILE_AB
17 Include support for the ARM(R) Versatile Application Baseboard 17 Include support for the ARM(R) Versatile Application Baseboard
18 for the ARM926EJ-S. 18 for the ARM926EJ-S.
19 19
20config MACH_VERSATILE_DT
21 bool "Support Versatile platform from device tree"
22 select USE_OF
23 select CPU_ARM926T
24 help
25 Include support for the ARM(R) Versatile/PB platform,
26 using the device tree for discovery
27
20endmenu 28endmenu
diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile
index 97cf4d831b0c..81fa3fe25e1a 100644
--- a/arch/arm/mach-versatile/Makefile
+++ b/arch/arm/mach-versatile/Makefile
@@ -5,4 +5,5 @@
5obj-y := core.o 5obj-y := core.o
6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o
7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o
8obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o
8obj-$(CONFIG_PCI) += pci.o 9obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 0c99cf076c63..e340a54251df 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -24,6 +24,9 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irqdomain.h>
28#include <linux/of_address.h>
29#include <linux/of_platform.h>
27#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
28#include <linux/amba/clcd.h> 31#include <linux/amba/clcd.h>
29#include <linux/amba/pl061.h> 32#include <linux/amba/pl061.h>
@@ -83,13 +86,26 @@ static struct fpga_irq_data sic_irq = {
83#define PIC_MASK 0 86#define PIC_MASK 0
84#endif 87#endif
85 88
89/* Lookup table for finding a DT node that represents the vic instance */
90static const struct of_device_id vic_of_match[] __initconst = {
91 { .compatible = "arm,versatile-vic", },
92 {}
93};
94
95static const struct of_device_id sic_of_match[] __initconst = {
96 { .compatible = "arm,versatile-sic", },
97 {}
98};
99
86void __init versatile_init_irq(void) 100void __init versatile_init_irq(void)
87{ 101{
88 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); 102 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
103 irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START);
89 104
90 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 105 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
91 106
92 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); 107 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
108 irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START);
93 109
94 /* 110 /*
95 * Interrupts on secondary controller from 0 to 8 are routed to 111 * Interrupts on secondary controller from 0 to 8 are routed to
@@ -646,6 +662,52 @@ static struct amba_device *amba_devs[] __initdata = {
646 &kmi1_device, 662 &kmi1_device,
647}; 663};
648 664
665#ifdef CONFIG_OF
666/*
667 * Lookup table for attaching a specific name and platform_data pointer to
668 * devices as they get created by of_platform_populate(). Ideally this table
669 * would not exist, but the current clock implementation depends on some devices
670 * having a specific name.
671 */
672struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = {
673 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL),
674 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL),
675 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL),
676 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL),
677 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL),
678
679 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data),
680 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL),
681 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL),
682 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL),
683 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL),
684
685#if 0
686 /*
687 * These entries are unnecessary because no clocks referencing
688 * them. I've left them in for now as place holders in case
689 * any of them need to be added back, but they should be
690 * removed before actually committing this patch. --gcl
691 */
692 OF_DEV_AUXDATA("arm,primecell", VERSATILE_AACI_BASE, "fpga:04", NULL),
693 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI1_BASE, "fpga:0a", NULL),
694 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SMC_BASE, "dev:00", NULL),
695 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MPMC_BASE, "dev:10", NULL),
696 OF_DEV_AUXDATA("arm,primecell", VERSATILE_DMAC_BASE, "dev:30", NULL),
697
698 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCTL_BASE, "dev:e0", NULL),
699 OF_DEV_AUXDATA("arm,primecell", VERSATILE_WATCHDOG_BASE, "dev:e1", NULL),
700 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO0_BASE, "dev:e4", NULL),
701 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO1_BASE, "dev:e5", NULL),
702 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO2_BASE, "dev:e6", NULL),
703 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO3_BASE, "dev:e7", NULL),
704 OF_DEV_AUXDATA("arm,primecell", VERSATILE_RTC_BASE, "dev:e8", NULL),
705 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI_BASE, "dev:f0", NULL),
706#endif
707 {}
708};
709#endif
710
649#ifdef CONFIG_LEDS 711#ifdef CONFIG_LEDS
650#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) 712#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
651 713
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index fd6404e5d788..e01422700ebb 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -23,6 +23,7 @@
23#define __ASM_ARCH_VERSATILE_H 23#define __ASM_ARCH_VERSATILE_H
24 24
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/of_platform.h>
26 27
27extern void __init versatile_init(void); 28extern void __init versatile_init(void);
28extern void __init versatile_init_early(void); 29extern void __init versatile_init_early(void);
@@ -30,6 +31,9 @@ extern void __init versatile_init_irq(void);
30extern void __init versatile_map_io(void); 31extern void __init versatile_map_io(void);
31extern struct sys_timer versatile_timer; 32extern struct sys_timer versatile_timer;
32extern unsigned int mmc_status(struct device *dev); 33extern unsigned int mmc_status(struct device *dev);
34#ifdef CONFIG_OF
35extern struct of_dev_auxdata versatile_auxdata_lookup[];
36#endif
33 37
34#define AMBA_DEVICE(name,busid,base,plat) \ 38#define AMBA_DEVICE(name,busid,base,plat) \
35static struct amba_device name##_device = { \ 39static struct amba_device name##_device = { \
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
new file mode 100644
index 000000000000..54e037c090f5
--- /dev/null
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -0,0 +1,51 @@
1/*
2 * Versatile board support using the device tree
3 *
4 * Copyright (C) 2010 Secret Lab Technologies Ltd.
5 * Copyright (C) 2009 Jeremy Kerr <jeremy.kerr@canonical.com>
6 * Copyright (C) 2004 ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/init.h>
25#include <linux/of_irq.h>
26#include <linux/of_platform.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30#include "core.h"
31
32static void __init versatile_dt_init(void)
33{
34 of_platform_populate(NULL, of_default_bus_match_table,
35 versatile_auxdata_lookup, NULL);
36}
37
38static const char *versatile_dt_match[] __initconst = {
39 "arm,versatile-ab",
40 "arm,versatile-pb",
41 NULL,
42};
43
44DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
45 .map_io = versatile_map_io,
46 .init_early = versatile_init_early,
47 .init_irq = versatile_init_irq,
48 .timer = &versatile_timer,
49 .init_machine = versatile_dt_init,
50 .dt_compat = versatile_dt_match,
51MACHINE_END