2 +++ b/arch/powerpc/boot/cuboot-magicboxv2.c
5 + * Old U-boot compatibility for Magicbox v2
7 + * Author: Imre Kaloz <kaloz@openwrt.org>
8 + * Gabor Juhos <juhosg@openwrt.org>
10 + * This program is free software; you can redistribute it and/or modify it
11 + * under the terms of the GNU General Public License version 2 as published
12 + * by the Free Software Foundation.
29 +static void fixup_cf_card(void)
31 +#define DCRN_CPC0_PCI_BASE 0xf9
32 +#define CF_CS0_BASE 0xff100000
33 +#define CF_CS1_BASE 0xff200000
35 + /* Turn on PerWE instead of PCIsomething */
36 + mtdcr(DCRN_CPC0_PCI_BASE,
37 + mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
39 + /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
40 + mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
41 + mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
42 + mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
43 + mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
45 + /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
46 + mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
47 + mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
48 + mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
49 + mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
51 +#undef DCRN_CPC0_PCI_BASE
56 +static void magicboxv2_fixups(void)
59 + ibm405ep_fixup_clocks(25000000);
60 + ibm4xx_sdram_fixup_memsize();
61 + dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
64 +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
65 + unsigned long r6, unsigned long r7)
68 + platform_ops.fixups = magicboxv2_fixups;
69 + platform_ops.exit = ibm40x_dbcr_reset;
70 + fdt_init(_dtb_start);
71 + serial_console_init();
74 +++ b/arch/powerpc/boot/dts/magicboxv2.dts
77 + * Device Tree Source for Magicbox v2
79 + * Copyright 2008 Imre Kaloz <kaloz@openwrt.org>
80 + * Copyright 2009 Gabor Juhos <juhosg@openwrt.org>
82 + * Based on walnut.dts
84 + * This file is licensed under the terms of the GNU General Public
85 + * License version 2. This program is licensed "as is" without
86 + * any warranty of any kind, whether express or implied.
92 + #address-cells = <1>;
94 + model = "magicboxv2";
95 + compatible = "magicboxv2";
96 + dcr-parent = <&{/cpus/cpu@0}>;
100 + ethernet1 = &EMAC1;
106 + #address-cells = <1>;
110 + device_type = "cpu";
111 + model = "PowerPC,405EP";
112 + reg = <0x00000000>;
113 + clock-frequency = <0xbebc200>; /* Filled in by zImage */
114 + timebase-frequency = <0>; /* Filled in by zImage */
115 + i-cache-line-size = <20>;
116 + d-cache-line-size = <20>;
117 + i-cache-size = <4000>;
118 + d-cache-size = <4000>;
120 + dcr-access-method = "native";
125 + device_type = "memory";
126 + reg = <0x00000000 0x00000000>; /* Filled in by zImage */
129 + UIC0: interrupt-controller {
130 + compatible = "ibm,uic";
131 + interrupt-controller;
133 + dcr-reg = <0x0c0 0x009>;
134 + #address-cells = <0>;
136 + #interrupt-cells = <2>;
140 + compatible = "ibm,plb3";
141 + #address-cells = <1>;
144 + clock-frequency = <0>; /* Filled in by zImage */
146 + SDRAM0: memory-controller {
147 + compatible = "ibm,sdram-405ep";
148 + dcr-reg = <0x010 0x002>;
152 + compatible = "ibm,mcmal-405ep", "ibm,mcmal";
153 + dcr-reg = <0x180 0x062>;
154 + num-tx-chans = <4>;
155 + num-rx-chans = <2>;
156 + interrupt-parent = <&UIC0>;
158 + 0xb 0x4 /* TXEOB */
159 + 0xc 0x4 /* RXEOB */
162 + 0xe 0x4 /* RXDE */>;
166 + compatible = "ibm,opb-405ep", "ibm,opb";
167 + #address-cells = <1>;
169 + ranges = <0xef600000 0xef600000 0x00a00000>;
170 + dcr-reg = <0x0a0 0x005>;
171 + clock-frequency = <0>; /* Filled in by zImage */
173 + UART0: serial@ef600300 {
174 + device_type = "serial";
175 + compatible = "ns16550";
176 + reg = <0xef600300 0x00000008>;
177 + virtual-reg = <0xef600300>;
178 + clock-frequency = <0>; /* Filled in by zImage */
179 + current-speed = <115200>;
180 + interrupt-parent = <&UIC0>;
181 + interrupts = <0x0 0x4>;
184 + UART1: serial@ef600400 {
185 + device_type = "serial";
186 + compatible = "ns16550";
187 + reg = <0xef600400 0x00000008>;
188 + virtual-reg = <0xef600400>;
189 + clock-frequency = <0>; /* Filled in by zImage */
190 + current-speed = <115200>;
191 + interrupt-parent = <&UIC0>;
192 + interrupts = <0x1 0x4>;
195 + IIC: i2c@ef600500 {
196 + compatible = "ibm,iic-405ep", "ibm,iic";
197 + reg = <0xef600500 0x00000011>;
198 + interrupt-parent = <&UIC0>;
199 + interrupts = <0x2 0x4>;
202 + GPIO: gpio@ef600700 {
203 + compatible = "ibm,gpio-405ep";
204 + reg = <0xef600700 0x00000020>;
207 + EMAC0: ethernet@ef600800 {
208 + linux,network-index = <0x0>;
209 + device_type = "network";
210 + compatible = "ibm,emac-405ep", "ibm,emac";
211 + interrupt-parent = <&UIC0>;
213 + 0xf 0x4 /* Ethernet */
214 + 0x9 0x4 /* Ethernet Wake Up */>;
215 + local-mac-address = [000000000000]; /* Filled in by zImage */
216 + reg = <0xef600800 0x00000070>;
217 + mal-device = <&MAL>;
218 + mal-tx-channel = <0>;
219 + mal-rx-channel = <0>;
221 + max-frame-size = <0x5dc>;
222 + rx-fifo-size = <0x1000>;
223 + tx-fifo-size = <0x800>;
225 + phy-map = <0x00000000>;
227 + EMAC1: ethernet@ef600900 {
228 + linux,network-index = <0x1>;
229 + device_type = "network";
230 + compatible = "ibm,emac-405ep", "ibm,emac";
231 + interrupt-parent = <&UIC0>;
233 + 0x11 0x4 /* Ethernet */
234 + 0x09 0x4 /* Ethernet Wake Up */>;
235 + local-mac-address = [000000000000]; /* Filled in by zImage */
236 + reg = <0xef600900 0x00000070>;
237 + mal-device = <&MAL>;
238 + mal-tx-channel = <2>;
239 + mal-rx-channel = <1>;
241 + max-frame-size = <0x5dc>;
242 + rx-fifo-size = <0x1000>;
243 + tx-fifo-size = <0x800>;
244 + mdio-device = <&EMAC0>;
246 + phy-map = <0x00000001>;
252 + compatible = "ibm,ebc-405ep", "ibm,ebc";
253 + dcr-reg = <0x012 0x002>;
254 + #address-cells = <2>;
256 + /* The ranges property is supplied by the bootwrapper
257 + * and is based on the firmware's configuration of the
260 + clock-frequency = <0>; /* Filled in by zImage */
263 + compatible = "magicbox-cf";
264 + reg = <0x00000000 0xff100000 0x00001000
265 + 0x00000000 0xff200000 0x00001000>;
266 + interrupt-parent = <&UIC0>;
267 + interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
270 + nor_flash@ffc00000 {
271 + compatible = "cfi-flash";
273 + reg = <0x00000000 0xffc00000 0x00400000>;
274 + #address-cells = <1>;
278 + reg = <0x0 0x120000>;
282 + reg = <0x120000 0x2a0000>;
286 + reg = <0x3c0000 0x30000>;
292 + PCI0: pci@ec000000 {
293 + device_type = "pci";
294 + #interrupt-cells = <1>;
296 + #address-cells = <3>;
297 + compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
299 + reg = <0xeec00000 0x00000008 /* Config space access */
300 + 0xeed80000 0x00000004 /* IACK */
301 + 0xeed80000 0x00000004 /* Special cycle */
302 + 0xef480000 0x00000040>; /* Internal registers */
304 + /* Outbound ranges, one memory and one IO,
305 + * later cannot be changed. Chip supports a second
306 + * IO range but we don't use it for now
308 + ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
309 + 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
311 + /* Inbound 2GB range starting at 0 */
312 + dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
314 + interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
317 + 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
320 + 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
323 + 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
326 + 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
332 + linux,stdout-path = "/plb/opb/serial@ef600300";
335 --- a/arch/powerpc/boot/Makefile
336 +++ b/arch/powerpc/boot/Makefile
337 @@ -70,7 +70,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82
338 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
339 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
340 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
341 - cuboot-acadia.c cuboot-magicboxv1.c
342 + cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c
343 src-boot := $(src-wlib) $(src-plat) empty.c
345 src-boot := $(addprefix $(obj)/, $(src-boot))
346 @@ -215,6 +215,7 @@ image-$(CONFIG_EP405) += dtbImage.ep40
347 image-$(CONFIG_WALNUT) += treeImage.walnut
348 image-$(CONFIG_ACADIA) += cuImage.acadia
349 image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1
350 +image-$(CONFIG_MAGICBOXV2) += cuImage.magicboxv2
352 # Board ports in arch/powerpc/platform/44x/Kconfig
353 image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
354 --- a/arch/powerpc/platforms/40x/Kconfig
355 +++ b/arch/powerpc/platforms/40x/Kconfig
356 @@ -59,6 +59,16 @@ config MAGICBOXV1
358 This option enables support for the Magicbox v1 board.
364 + select PPC40x_SIMPLE
368 + This option enables support for the Magicbox v2 board.
373 --- a/arch/powerpc/platforms/40x/ppc40x_simple.c
374 +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
375 @@ -52,7 +52,8 @@ machine_device_initcall(ppc40x_simple, p
377 static char *board[] __initdata = {
384 static int __init ppc40x_probe(void)