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