nuke the magicbox target and incorporate a rewritten port into ppc40x - note: no...
[openwrt/svn-archive/archive.git] / target / linux / ppc40x / patches / 006-magicboxv2.patch
1 diff -Nur a/arch/powerpc/boot/cuboot-magicboxv2.c b/arch/powerpc/boot/cuboot-magicboxv2.c
2 --- a/arch/powerpc/boot/cuboot-magicboxv2.c 1970-01-01 01:00:00.000000000 +0100
3 +++ b/arch/powerpc/boot/cuboot-magicboxv2.c 2008-11-26 09:29:02.000000000 +0100
4 @@ -0,0 +1,40 @@
5 +/*
6 + * Old U-boot compatibility for Magicbox v2
7 + *
8 + * Author: Imre Kaloz <kaloz@openwrt.org>
9 + *
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.
13 + */
14 +
15 +#include "ops.h"
16 +#include "io.h"
17 +#include "dcr.h"
18 +#include "stdio.h"
19 +#include "4xx.h"
20 +#include "44x.h"
21 +#include "cuboot.h"
22 +
23 +#define TARGET_4xx
24 +#define TARGET_405EP
25 +#include "ppcboot.h"
26 +
27 +static bd_t bd;
28 +
29 +static void magicboxv2_fixups(void)
30 +{
31 + ibm405ep_fixup_clocks(25000000);
32 + ibm4xx_sdram_fixup_memsize();
33 + dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
34 +}
35 +
36 +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
37 + unsigned long r6, unsigned long r7)
38 +{
39 + CUBOOT_INIT();
40 + platform_ops.fixups = magicboxv2_fixups;
41 + platform_ops.exit = ibm40x_dbcr_reset;
42 + fdt_init(_dtb_start);
43 + serial_console_init();
44 +}
45 diff -Nur a/arch/powerpc/boot/dts/magicboxv2.dts b/arch/powerpc/boot/dts/magicboxv2.dts
46 --- a/arch/powerpc/boot/dts/magicboxv2.dts 1970-01-01 01:00:00.000000000 +0100
47 +++ b/arch/powerpc/boot/dts/magicboxv2.dts 2008-11-26 09:28:10.000000000 +0100
48 @@ -0,0 +1,250 @@
49 +/*
50 + * Device Tree Source for Magicbox v2
51 + *
52 + * Copyright 2008 Imre Kaloz <kaloz@openwrt.org>
53 + *
54 + * Based on walnut.dts
55 + *
56 + * This file is licensed under the terms of the GNU General Public
57 + * License version 2. This program is licensed "as is" without
58 + * any warranty of any kind, whether express or implied.
59 + */
60 +
61 +/dts-v1/;
62 +
63 +/ {
64 + #address-cells = <1>;
65 + #size-cells = <1>;
66 + model = "magicboxv2";
67 + compatible = "magicboxv2";
68 + dcr-parent = <&{/cpus/cpu@0}>;
69 +
70 + aliases {
71 + ethernet0 = &EMAC0;
72 + ethernet1 = &EMAC1;
73 + serial0 = &UART0;
74 + serial1 = &UART1;
75 + };
76 +
77 + cpus {
78 + #address-cells = <1>;
79 + #size-cells = <0>;
80 +
81 + cpu@0 {
82 + device_type = "cpu";
83 + model = "PowerPC,405EP";
84 + reg = <0x00000000>;
85 + clock-frequency = <0xbebc200>; /* Filled in by zImage */
86 + timebase-frequency = <0>; /* Filled in by zImage */
87 + i-cache-line-size = <20>;
88 + d-cache-line-size = <20>;
89 + i-cache-size = <4000>;
90 + d-cache-size = <4000>;
91 + dcr-controller;
92 + dcr-access-method = "native";
93 + };
94 + };
95 +
96 + memory {
97 + device_type = "memory";
98 + reg = <0x00000000 0x00000000>; /* Filled in by zImage */
99 + };
100 +
101 + UIC0: interrupt-controller {
102 + compatible = "ibm,uic";
103 + interrupt-controller;
104 + cell-index = <0>;
105 + dcr-reg = <0x0c0 0x009>;
106 + #address-cells = <0>;
107 + #size-cells = <0>;
108 + #interrupt-cells = <2>;
109 + };
110 +
111 + plb {
112 + compatible = "ibm,plb3";
113 + #address-cells = <1>;
114 + #size-cells = <1>;
115 + ranges;
116 + clock-frequency = <0>; /* Filled in by zImage */
117 +
118 + SDRAM0: memory-controller {
119 + compatible = "ibm,sdram-405ep";
120 + dcr-reg = <0x010 0x002>;
121 + };
122 +
123 + MAL: mcmal {
124 + compatible = "ibm,mcmal-405ep", "ibm,mcmal";
125 + dcr-reg = <0x180 0x062>;
126 + num-tx-chans = <4>;
127 + num-rx-chans = <2>;
128 + interrupt-parent = <&UIC0>;
129 + interrupts = <
130 + 0xb 0x4 /* TXEOB */
131 + 0xc 0x4 /* RXEOB */
132 + 0xa 0x4 /* SERR */
133 + 0xd 0x4 /* TXDE */
134 + 0xe 0x4 /* RXDE */>;
135 + };
136 +
137 + POB0: opb {
138 + compatible = "ibm,opb-405ep", "ibm,opb";
139 + #address-cells = <1>;
140 + #size-cells = <1>;
141 + ranges = <0xef600000 0xef600000 0x00a00000>;
142 + dcr-reg = <0x0a0 0x005>;
143 + clock-frequency = <0>; /* Filled in by zImage */
144 +
145 + UART0: serial@ef600300 {
146 + device_type = "serial";
147 + compatible = "ns16550";
148 + reg = <0xef600300 0x00000008>;
149 + virtual-reg = <0xef600300>;
150 + clock-frequency = <0>; /* Filled in by zImage */
151 + current-speed = <115200>;
152 + interrupt-parent = <&UIC0>;
153 + interrupts = <0x0 0x4>;
154 + };
155 +
156 + UART1: serial@ef600400 {
157 + device_type = "serial";
158 + compatible = "ns16550";
159 + reg = <0xef600400 0x00000008>;
160 + virtual-reg = <0xef600400>;
161 + clock-frequency = <0>; /* Filled in by zImage */
162 + current-speed = <115200>;
163 + interrupt-parent = <&UIC0>;
164 + interrupts = <0x1 0x4>;
165 + };
166 +
167 + IIC: i2c@ef600500 {
168 + compatible = "ibm,iic-405ep", "ibm,iic";
169 + reg = <0xef600500 0x00000011>;
170 + interrupt-parent = <&UIC0>;
171 + interrupts = <0x2 0x4>;
172 + };
173 +
174 + GPIO: gpio@ef600700 {
175 + compatible = "ibm,gpio-405ep";
176 + reg = <0xef600700 0x00000020>;
177 + };
178 +
179 + EMAC0: ethernet@ef600800 {
180 + linux,network-index = <0x0>;
181 + device_type = "network";
182 + compatible = "ibm,emac-405ep", "ibm,emac";
183 + interrupt-parent = <&UIC0>;
184 + interrupts = <
185 + 0xf 0x4 /* Ethernet */
186 + 0x9 0x4 /* Ethernet Wake Up */>;
187 + local-mac-address = [000000000000]; /* Filled in by zImage */
188 + reg = <0xef600800 0x00000070>;
189 + mal-device = <&MAL>;
190 + mal-tx-channel = <0>;
191 + mal-rx-channel = <0>;
192 + cell-index = <0>;
193 + max-frame-size = <0x5dc>;
194 + rx-fifo-size = <0x1000>;
195 + tx-fifo-size = <0x800>;
196 + phy-mode = "mii";
197 + phy-map = <0x00000000>;
198 + };
199 + EMAC1: ethernet@ef600900 {
200 + linux,network-index = <0x1>;
201 + device_type = "network";
202 + compatible = "ibm,emac-405ep", "ibm,emac";
203 + interrupt-parent = <&UIC0>;
204 + interrupts = <
205 + 0x11 0x4 /* Ethernet */
206 + 0x09 0x4 /* Ethernet Wake Up */>;
207 + local-mac-address = [000000000000]; /* Filled in by zImage */
208 + reg = <0xef600900 0x00000070>;
209 + mal-device = <&MAL>;
210 + mal-tx-channel = <2>;
211 + mal-rx-channel = <1>;
212 + cell-index = <1>;
213 + max-frame-size = <0x5dc>;
214 + rx-fifo-size = <0x1000>;
215 + tx-fifo-size = <0x800>;
216 + mdio-device = <&EMAC0>;
217 + phy-mode = "mii";
218 + phy-map = <0x00000001>;
219 + };
220 +
221 + };
222 +
223 + EBC0: ebc {
224 + compatible = "ibm,ebc-405ep", "ibm,ebc";
225 + dcr-reg = <0x012 0x002>;
226 + #address-cells = <2>;
227 + #size-cells = <1>;
228 + /* The ranges property is supplied by the bootwrapper
229 + * and is based on the firmware's configuration of the
230 + * EBC bridge
231 + */
232 + clock-frequency = <0>; /* Filled in by zImage */
233 +
234 + nor_flash@ffc00000 {
235 + compatible = "cfi-flash";
236 + bank-width = <2>;
237 + reg = <0x00000000 0xffc00000 0x00400000>;
238 + #address-cells = <1>;
239 + #size-cells = <1>;
240 + partition@0 {
241 + label = "linux";
242 + reg = <0x0 0x3c0000>;
243 + };
244 + partition@100000 {
245 + label = "rootfs";
246 + reg = <0x100000 0x2c0000>;
247 + };
248 + partition@3c0000 {
249 + label = "u-boot";
250 + reg = <0x3c0000 0x30000>;
251 + read-only;
252 + };
253 + };
254 + };
255 +
256 + PCI0: pci@ec000000 {
257 + device_type = "pci";
258 + #interrupt-cells = <1>;
259 + #size-cells = <2>;
260 + #address-cells = <3>;
261 + compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
262 + primary;
263 + reg = <0xeec00000 0x00000008 /* Config space access */
264 + 0xeed80000 0x00000004 /* IACK */
265 + 0xeed80000 0x00000004 /* Special cycle */
266 + 0xef480000 0x00000040>; /* Internal registers */
267 +
268 + /* Outbound ranges, one memory and one IO,
269 + * later cannot be changed. Chip supports a second
270 + * IO range but we don't use it for now
271 + */
272 + ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
273 + 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
274 +
275 + /* Inbound 2GB range starting at 0 */
276 + dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
277 +
278 + interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
279 + interrupt-map = <
280 + /* IDSEL 1 */
281 + 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
282 +
283 + /* IDSEL 2 */
284 + 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
285 +
286 + /* IDSEL 3 */
287 + 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
288 +
289 + /* IDSEL 4 */
290 + 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
291 + >;
292 + };
293 + };
294 +
295 + chosen {
296 + linux,stdout-path = "/plb/opb/serial@ef600300";
297 + };
298 +};
299 diff -Nur a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
300 --- a/arch/powerpc/boot/Makefile 2008-11-26 09:15:15.000000000 +0100
301 +++ b/arch/powerpc/boot/Makefile 2008-11-26 09:17:01.000000000 +0100
302 @@ -69,7 +69,7 @@
303 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
304 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
305 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
306 - cuboot-acadia.c cuboot-magicboxv1.c
307 + cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c
308 src-boot := $(src-wlib) $(src-plat) empty.c
309
310 src-boot := $(addprefix $(obj)/, $(src-boot))
311 @@ -214,6 +214,7 @@
312 image-$(CONFIG_WALNUT) += treeImage.walnut
313 image-$(CONFIG_ACADIA) += cuImage.acadia
314 image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1
315 +image-$(CONFIG_MAGICBOXV2) += cuImage.magicboxv2
316
317 # Board ports in arch/powerpc/platform/44x/Kconfig
318 image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
319 diff -Nur a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
320 --- a/arch/powerpc/platforms/40x/Kconfig 2008-11-26 09:15:15.000000000 +0100
321 +++ b/arch/powerpc/platforms/40x/Kconfig 2008-11-26 09:16:08.000000000 +0100
322 @@ -51,6 +51,16 @@
323 help
324 This option enables support for the Magicbox v1 board.
325
326 +config MAGICBOXV2
327 + bool "Magicbox v2"
328 + depends on 40x
329 + default n
330 + select PPC40x_SIMPLE
331 + select 405EP
332 + select PCI
333 + help
334 + This option enables support for the Magicbox v2 board.
335 +
336 config MAKALU
337 bool "Makalu"
338 depends on 40x
339 diff -Nur a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
340 --- a/arch/powerpc/platforms/40x/ppc40x_simple.c 2008-11-26 09:15:15.000000000 +0100
341 +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c 2008-11-26 09:15:46.000000000 +0100
342 @@ -52,7 +52,8 @@
343 */
344 static char *board[] __initdata = {
345 "amcc,acadia",
346 - "magicboxv1"
347 + "magicboxv1",
348 + "magicboxv2",
349 };
350
351 static int __init ppc40x_probe(void)