3760b0c85b470be9e072490c3f5eb84180a68ff2
[openwrt/staging/wigyori.git] / target / linux / bcm53xx / patches-3.10 / 051-bcm53xx-initial-support-for-the-BCM5301-BCM470X-SoC-.patch
1 bcm53xx: initial support for the BCM5301/BCM470X SoC
2 with ARM CPU
3
4 This patch adds support for the BCM5301/BCM470X SoCs with an ARM CPU.
5 Currently just booting to a shell is working and nothing else, no
6 Ethernet, wifi, flash, ...
7
8 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
9 ---
10 arch/arm/Kconfig | 2 +
11 arch/arm/Kconfig.debug | 5 ++
12 arch/arm/Makefile | 1 +
13 arch/arm/boot/dts/Makefile | 1 +
14 arch/arm/boot/dts/bcm5301-netgear-r6250.dts | 20 +++++++
15 arch/arm/boot/dts/bcm5301.dtsi | 83 +++++++++++++++++++++++++++
16 arch/arm/include/debug/bcm53xx.S | 19 ++++++
17 arch/arm/mach-bcm53xx/Kconfig | 15 +++++
18 arch/arm/mach-bcm53xx/Makefile | 1 +
19 arch/arm/mach-bcm53xx/bcm53xx.c | 69 ++++++++++++++++++++++
20 10 files changed, 216 insertions(+)
21 create mode 100644 arch/arm/boot/dts/bcm5301-netgear-r6250.dts
22 create mode 100644 arch/arm/boot/dts/bcm5301.dtsi
23 create mode 100644 arch/arm/include/debug/bcm53xx.S
24 create mode 100644 arch/arm/mach-bcm53xx/Kconfig
25 create mode 100644 arch/arm/mach-bcm53xx/Makefile
26 create mode 100644 arch/arm/mach-bcm53xx/bcm53xx.c
27
28 --- a/arch/arm/Kconfig
29 +++ b/arch/arm/Kconfig
30 @@ -922,6 +922,8 @@ source "arch/arm/mach-bcm/Kconfig"
31
32 source "arch/arm/mach-bcm2835/Kconfig"
33
34 +source "arch/arm/mach-bcm53xx/Kconfig"
35 +
36 source "arch/arm/mach-clps711x/Kconfig"
37
38 source "arch/arm/mach-cns3xxx/Kconfig"
39 --- a/arch/arm/Kconfig.debug
40 +++ b/arch/arm/Kconfig.debug
41 @@ -93,6 +93,10 @@ choice
42 bool "Kernel low-level debugging on BCM2835 PL011 UART"
43 depends on ARCH_BCM2835
44
45 + config DEBUG_BCM53XX
46 + bool "Kernel low-level debugging on BCM53XX UART1"
47 + depends on ARCH_BCM53XX
48 +
49 config DEBUG_CLPS711X_UART1
50 bool "Kernel low-level debugging messages via UART1"
51 depends on ARCH_CLPS711X
52 @@ -620,6 +624,7 @@ endchoice
53 config DEBUG_LL_INCLUDE
54 string
55 default "debug/bcm2835.S" if DEBUG_BCM2835
56 + default "debug/bcm53xx.S" if DEBUG_BCM53XX
57 default "debug/cns3xxx.S" if DEBUG_CNS3XXX
58 default "debug/exynos.S" if DEBUG_EXYNOS_UART
59 default "debug/highbank.S" if DEBUG_HIGHBANK_UART
60 --- a/arch/arm/Makefile
61 +++ b/arch/arm/Makefile
62 @@ -145,6 +145,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x0020
63 machine-$(CONFIG_ARCH_AT91) += at91
64 machine-$(CONFIG_ARCH_BCM) += bcm
65 machine-$(CONFIG_ARCH_BCM2835) += bcm2835
66 +machine-$(CONFIG_ARCH_BCM53XX) += bcm53xx
67 machine-$(CONFIG_ARCH_CLPS711X) += clps711x
68 machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
69 machine-$(CONFIG_ARCH_DAVINCI) += davinci
70 --- a/arch/arm/boot/dts/Makefile
71 +++ b/arch/arm/boot/dts/Makefile
72 @@ -209,6 +209,7 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07
73 wm8650-mid.dtb \
74 wm8850-w70v2.dtb
75 dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
76 +dtb-$(CONFIG_ARCH_BCM53XX) += bcm5301-netgear-r6250.dtb
77
78 targets += dtbs
79 targets += $(dtb-y)
80 --- /dev/null
81 +++ b/arch/arm/boot/dts/bcm5301-netgear-r6250.dts
82 @@ -0,0 +1,20 @@
83 +/*
84 + * Broadcom BCM47XX / BCM53XX arm platform code.
85 + *
86 + * Copyright 2013 Hauke Mehrtens <hauke@hauke-m.de>
87 + *
88 + * Licensed under the GNU/GPL. See COPYING for details.
89 + */
90 +
91 +/dts-v1/;
92 +
93 +/include/ "bcm5301.dtsi"
94 +
95 +/ {
96 + model = "Netgear R6250 V1 (BCM4708)";
97 + compatible = "netgear,r6250v1", "brcm,bcm5301";
98 +
99 + memory {
100 + reg = <0x00000000 0x08000000>;
101 + };
102 +};
103 --- /dev/null
104 +++ b/arch/arm/boot/dts/bcm5301.dtsi
105 @@ -0,0 +1,83 @@
106 +/*
107 + * Broadcom BCM47XX / BCM53XX ARM platform code.
108 + *
109 + * Copyright 2013 Hauke Mehrtens <hauke@hauke-m.de>
110 + *
111 + * Licensed under the GNU/GPL. See COPYING for details.
112 + */
113 +
114 +/include/ "skeleton.dtsi"
115 +
116 +/ {
117 + compatible = "brcm,bcm5301";
118 + model = "BCM5301/BCM4707/BCM4708/BCM4709 SoC";
119 + interrupt-parent = <&gic>;
120 +
121 + chosen {
122 + bootargs = "console=ttyS0,115200 earlyprintk debug vmalloc=64M";
123 + };
124 +
125 + cpus {
126 + #address-cells = <1>;
127 + #size-cells = <0>;
128 +
129 + cpu@0 {
130 + device_type = "cpu";
131 + compatible = "arm,cortex-a9";
132 + reg = <0>;
133 + };
134 + cpu@1 {
135 + device_type = "cpu";
136 + compatible = "arm,cortex-a9";
137 + reg = <1>;
138 + };
139 + };
140 +
141 + clocks {
142 + #address-cells = <1>;
143 + #size-cells = <0>;
144 +
145 + clk_periph: periph {
146 + compatible = "fixed-clock";
147 + #clock-cells = <0>;
148 + clock-frequency = <400000000>;
149 + };
150 + };
151 +
152 + uart@18000300 {
153 + compatible = "ns16550";
154 + reg = <0x18000300 0x100>;
155 + interrupts = <0 85 4>;
156 + clock-frequency = <100000000>;
157 + };
158 +
159 + uart@18000400 {
160 + compatible = "ns16550";
161 + reg = <0x18000400 0x100>;
162 + interrupts = <0 85 4>;
163 + clock-frequency = <100000000>;
164 + };
165 +
166 + gic: interrupt-controller@19021000 {
167 + compatible = "arm,cortex-a9-gic";
168 + #interrupt-cells = <3>;
169 + #address-cells = <0>;
170 + interrupt-controller;
171 + reg = <0x19021000 0x1000>,
172 + <0x19020100 0x100>;
173 + };
174 +
175 + timer@19020200 {
176 + compatible = "arm,cortex-a9-global-timer";
177 + reg = <0x19020200 0x100>;
178 + interrupts = <1 11 0xf04>;
179 + clocks = <&clk_periph>;
180 + #clock-cells = <0>;
181 + };
182 +
183 + local-timer@19020200 {
184 + compatible = "arm,cortex-a9-twd-timer";
185 + reg = <0x19020600 0x100>;
186 + interrupts = <1 13 0xf04>;
187 + };
188 +};
189 --- /dev/null
190 +++ b/arch/arm/include/debug/bcm53xx.S
191 @@ -0,0 +1,19 @@
192 +/*
193 + * Macros used for EARLY_PRINTK, in low-level UART debug console
194 + *
195 + * Copyright 2013 Hauke Mehrtens <hauke@hauke-m.de>
196 + *
197 + * Licensed under the GNU/GPL. See COPYING for details.
198 + */
199 +
200 +#define BCM53XX_UART1_PHYS 0x18000300
201 +#define BCM53XX_UART1_VIRT 0xf1000300
202 +#define BCM53XX_UART1_SH 0
203 +
204 + .macro addruart, rp, rv, tmp
205 + ldr \rp, =BCM53XX_UART1_PHYS @ MMU off, Physical
206 + ldr \rv, =BCM53XX_UART1_VIRT @ MMU on, Virtual
207 + .endm
208 +
209 +#define UART_SHIFT BCM53XX_UART1_SH
210 +#include <asm/hardware/debug-8250.S>
211 --- /dev/null
212 +++ b/arch/arm/mach-bcm53xx/Kconfig
213 @@ -0,0 +1,16 @@
214 +config ARCH_BCM53XX
215 + bool "Broadcom BCM47XX / BCM53XX ARM SoC"
216 + select CPU_V7
217 + select ARM_GIC
218 + select HAVE_ARM_SCU if SMP
219 + select HAVE_ARM_TWD if LOCAL_TIMERS
220 + select HAVE_SMP
221 + select HAVE_CLK
222 + select LOCAL_TIMERS if SMP
223 + select GENERIC_TIME
224 + select GENERIC_CLOCKEVENTS_BUILD
225 + select GENERIC_CLOCKEVENTS
226 + select ARM_GLOBAL_TIMER
227 + select MIGHT_HAVE_PCI
228 + help
229 + Support for Broadcom BCM47XX and BCM53XX SoCs with ARM CPU cores.
230 --- /dev/null
231 +++ b/arch/arm/mach-bcm53xx/Makefile
232 @@ -0,0 +1 @@
233 +obj-y += bcm53xx.o
234 --- /dev/null
235 +++ b/arch/arm/mach-bcm53xx/bcm53xx.c
236 @@ -0,0 +1,69 @@
237 +/*
238 + * Broadcom BCM47XX / BCM53XX ARM platform code.
239 + *
240 + * Copyright 2013 Hauke Mehrtens <hauke@hauke-m.de>
241 + *
242 + * Licensed under the GNU/GPL. See COPYING for details.
243 + */
244 +#include <linux/of_address.h>
245 +#include <linux/of_platform.h>
246 +#include <linux/irqchip.h>
247 +#include <linux/clocksource.h>
248 +#include <linux/clk-provider.h>
249 +
250 +#include <asm/mach/arch.h>
251 +#include <asm/mach/map.h>
252 +#include <asm/smp_scu.h>
253 +#include <asm/signal.h>
254 +
255 +static int bcm53xx_abort_handler(unsigned long addr, unsigned int fsr,
256 + struct pt_regs *regs)
257 +{
258 + /*
259 + * These happen for no good reason
260 + * possibly left over from CFE
261 + */
262 + pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
263 + addr, fsr);
264 +
265 + /* Returning non-zero causes fault display and panic */
266 + return 0;
267 +}
268 +
269 +static void bcm53xx_aborts_enable(void)
270 +{
271 + /* Install our hook */
272 + hook_fault_code(16 + 6, bcm53xx_abort_handler, SIGBUS, 0,
273 + "imprecise external abort");
274 +}
275 +
276 +static void __init bcm53xx_timer_init(void)
277 +{
278 + of_clk_init(NULL);
279 + clocksource_of_init();
280 +}
281 +
282 +void __init bcm53xx_map_io(void)
283 +{
284 + debug_ll_io_init();
285 + bcm53xx_aborts_enable();
286 +}
287 +
288 +static void __init bcm53xx_dt_init(void)
289 +{
290 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
291 +}
292 +
293 +static const char const *bcm53xx_dt_compat[] = {
294 + "brcm,bcm5301",
295 + "netgear,r6250v1",
296 + NULL,
297 +};
298 +
299 +DT_MACHINE_START(BCM53XX, "BCM53XX")
300 + .init_machine = bcm53xx_dt_init,
301 + .map_io = bcm53xx_map_io,
302 + .init_irq = irqchip_init,
303 + .init_time = bcm53xx_timer_init,
304 + .dt_compat = bcm53xx_dt_compat,
305 +MACHINE_END