1 --- a/arch/powerpc/boot/Makefile
2 +++ b/arch/powerpc/boot/Makefile
3 @@ -76,7 +76,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82
4 cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \
5 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
6 fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \
7 - cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
8 + cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c rb600.c rb333.c \
9 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
10 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
11 cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \
12 @@ -242,6 +242,8 @@ image-$(CONFIG_MPC834x_ITX) += cuImage.
13 image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds
14 image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds
15 image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
16 +image-$(CONFIG_RB_PPC) += dtbImage.rb600 \
19 # Board ports in arch/powerpc/platform/85xx/Kconfig
20 image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
22 +++ b/arch/powerpc/boot/dts/rb600.dts
25 + * RouterBOARD 600 series Device Tree Source
27 + * Copyright 2009 Michael Guntsche <mike@it-loops.com>
29 + * This program is free software; you can redistribute it and/or modify it
30 + * under the terms of the GNU General Public License as published by the
31 + * Free Software Foundation; either version 2 of the License, or (at your
32 + * option) any later version.
39 + compatible = "MPC83xx";
40 + #address-cells = <1>;
50 + bootargs = "console=ttyS0,115200 board=mpc8323 rootfstype=squashfs,yaffs2,jffs2 root=/dev/mtdblock1 boot=1";
51 + linux,stdout-path = "/soc8343@e0000000/serial@4500";
55 + #address-cells = <1>;
59 + device_type = "cpu";
61 + d-cache-line-size = <0x20>;
62 + i-cache-line-size = <0x20>;
63 + d-cache-size = <0x8000>;
64 + i-cache-size = <0x8000>;
65 + timebase-frequency = <0x0000000>; // filled by the bootwrapper from the firmware blob
66 + clock-frequency = <0x00000000>; // filled by the bootwrapper from the firmware blob
71 + device_type = "memory";
72 + reg = <0x0 0x0000000>; // filled by the bootwrapper from the firmware blob
76 + lb-timings = <0x5dc 0x3e8 0x1194 0x5dc 0x2af8>;
77 + interrupt-at-level = <0x0>;
78 + interrupt-parent = <&ipic>;
79 + interrupts = <0x16 0x8>;
80 + lbc_extra_divider = <0x1>;
81 + reg = <0xf9200000 0x200000>;
82 + device_type = "rb,cf";
86 + lb-timings = <0x5dc 0x3e8 0x1194 0x5dc 0x2af8>;
87 + interrupt-at-level = <0x0>;
88 + interrupt-parent = <&ipic>;
89 + interrupts = <0x14 0x8>;
90 + lbc_extra_divider = <0x1>;
91 + reg = <0xf9000000 0x200000>;
92 + device_type = "rb,cf";
96 + reg = <0xff800000 0x20000>;
100 + reg = <0xf0000000 0x1000>;
108 + reg = <0xf8000000 0x1000>;
109 + device_type = "rb,nand";
113 + interrupt-parent = <&ipic>;
114 + interrupts = <0x17 0x8>;
115 + sense = <&gpio 0x7>;
116 + fan_on = <&gpio 0x9>;
119 + pci0: pci@e0008500 {
120 + device_type = "pci";
121 + compatible = "fsl,mpc8349-pci";
122 + reg = <0xe0008500 0x100 0xe0008300 0x8>;
123 + #address-cells = <3>;
125 + #interrupt-cells = <1>;
126 + ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 0x1000000 0x0 0x0 0xd0000000 0x0 0x4000000>;
127 + bus-range = <0x0 0x0>;
129 + 0x5800 0x0 0x0 0x1 &ipic 0x15 0x8
130 + 0x6000 0x0 0x0 0x1 &ipic 0x30 0x8
131 + 0x6000 0x0 0x0 0x2 &ipic 0x11 0x8
132 + 0x6800 0x0 0x0 0x1 &ipic 0x11 0x8
133 + 0x6800 0x0 0x0 0x2 &ipic 0x12 0x8
134 + 0x7000 0x0 0x0 0x1 &ipic 0x12 0x8
135 + 0x7000 0x0 0x0 0x2 &ipic 0x13 0x8
136 + 0x7800 0x0 0x0 0x1 &ipic 0x13 0x8
137 + 0x7800 0x0 0x0 0x2 &ipic 0x30 0x8
138 + 0x8000 0x0 0x0 0x1 &ipic 0x30 0x8
139 + 0x8000 0x0 0x0 0x2 &ipic 0x12 0x8
140 + 0x8000 0x0 0x0 0x3 &ipic 0x11 0x8
141 + 0x8000 0x0 0x0 0x4 &ipic 0x13 0x8
142 + 0xa000 0x0 0x0 0x1 &ipic 0x30 0x8
143 + 0xa000 0x0 0x0 0x2 &ipic 0x11 0x8
144 + 0xa000 0x0 0x0 0x3 &ipic 0x12 0x8
145 + 0xa000 0x0 0x0 0x4 &ipic 0x13 0x8
146 + 0xa800 0x0 0x0 0x1 &ipic 0x11 0x8
147 + 0xa800 0x0 0x0 0x2 &ipic 0x12 0x8
148 + 0xa800 0x0 0x0 0x3 &ipic 0x13 0x8
149 + 0xa800 0x0 0x0 0x4 &ipic 0x30 0x8>;
150 + interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
151 + interrupt-parent = <&ipic>;
155 + #address-cells = <1>;
157 + device_type = "soc";
158 + compatible = "simple-bus";
159 + ranges = <0x0 0xe0000000 0x100000>;
160 + reg = <0xe0000000 0x200>;
161 + bus-frequency = <0x1>;
164 + user_led = <0x400 0x8>;
168 + reg = <0x500 0x100>;
174 + compatible = "gpio";
175 + device_type = "gpio";
179 + #address-cells = <1>;
181 + compatible = "fsl,mpc8349-dma", "fsl,elo-dma";
183 + ranges = <0 0x8100 0x1a8>;
184 + interrupt-parent = <&ipic>;
185 + interrupts = <71 8>;
188 + compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
191 + interrupt-parent = <&ipic>;
192 + interrupts = <71 8>;
195 + compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
198 + interrupt-parent = <&ipic>;
199 + interrupts = <71 8>;
202 + compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
203 + reg = <0x100 0x80>;
205 + interrupt-parent = <&ipic>;
206 + interrupts = <71 8>;
209 + compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
210 + reg = <0x180 0x28>;
212 + interrupt-parent = <&ipic>;
213 + interrupts = <71 8>;
217 + enet0: ethernet@25000 {
218 + #address-cells = <1>;
221 + phy-handle = <&phy0>;
222 + tbi-handle = <&tbi0>;
223 + interrupt-parent = <&ipic>;
224 + interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>;
225 + local-mac-address = [00 00 00 00 00 00];
226 + reg = <0x25000 0x1000>;
227 + ranges = <0x0 0x25000 0x1000>;
228 + compatible = "gianfar";
230 + device_type = "network";
233 + #address-cells = <1>;
235 + compatible = "fsl,gianfar-tbi";
236 + reg = <0x520 0x20>;
240 + device_type = "tbi-phy";
245 + enet1: ethernet@24000 {
246 + #address-cells = <1>;
249 + phy-handle = <&phy1>;
250 + tbi-handle = <&tbi1>;
251 + interrupt-parent = <&ipic>;
252 + interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>;
253 + local-mac-address = [00 00 00 00 00 00];
254 + reg = <0x24000 0x1000>;
255 + ranges = <0x0 0x24000 0x1000>;
256 + compatible = "gianfar";
258 + device_type = "network";
261 + #size-cells = <0x0>;
262 + #address-cells = <0x1>;
263 + reg = <0x520 0x20>;
264 + compatible = "fsl,gianfar-mdio";
266 + phy0: ethernet-phy@0 {
267 + device_type = "ethernet-phy";
271 + phy1: ethernet-phy@1 {
272 + device_type = "ethernet-phy";
278 + device_type = "tbi-phy";
284 + interrupt-controller;
285 + #address-cells = <0>;
286 + #interrupt-cells = <2>;
287 + reg = <0x700 0x100>;
288 + device_type = "ipic";
292 + interrupt-parent = <&ipic>;
293 + interrupts = <0x9 0x8>;
294 + clock-frequency = <0xfe4f840>;
295 + reg = <0x4500 0x100>;
296 + compatible = "ns16550";
297 + device_type = "serial";
301 + reg = <0x200 0x100>;
302 + compatible = "mpc83xx_wdt";
303 + device_type = "watchdog";
308 +++ b/arch/powerpc/boot/rb600.c
311 + * The RouterBOARD platform -- for booting RB600(A) RouterBOARDs.
313 + * Author: Michael Guntsche <mike@it-loops.com>
315 + * Copyright (c) 2009 Michael Guntsche
317 + * This program is free software; you can redistribute it and/or modify it
318 + * under the terms of the GNU General Public License version 2 as published
319 + * by the Free Software Foundation.
333 +static void rb600_fixups(void)
335 + const u32 *reg, *timebase, *clock;
338 + const char* bootargs;
340 + dt_fixup_memory(0, memsize64);
342 + /* Set the MAC addresses. */
343 + node = fdt_path_offset(fw_dtb, "/soc8343@e0000000/ethernet@24000");
344 + reg = fdt_getprop(fw_dtb, node, "mac-address", &size);
345 + dt_fixup_mac_address_by_alias("ethernet1", (const u8 *)reg);
347 + node = fdt_path_offset(fw_dtb, "/soc8343@e0000000/ethernet@25000");
348 + reg = fdt_getprop(fw_dtb, node, "mac-address", &size);
349 + dt_fixup_mac_address_by_alias("ethernet0", (const u8 *)reg);
351 + /* Find the CPU timebase and clock frequencies. */
352 + node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "cpu", sizeof("cpu"));
353 + timebase = fdt_getprop(fw_dtb, node, "timebase-frequency", &size);
354 + clock = fdt_getprop(fw_dtb, node, "clock-frequency", &size);
355 + dt_fixup_cpu_clocks(*clock, *timebase, 0);
359 +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
360 + unsigned long r6, unsigned long r7)
365 + fw_dtb = (const void *)r3;
367 + /* Find the memory range. */
368 + node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "memory", sizeof("memory"));
369 + reg = fdt_getprop(fw_dtb, node, "reg", &size);
370 + memsize64 = reg[1];
372 + /* Now we have the memory size; initialize the heap. */
373 + simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64);
375 + /* Prepare the device tree and find the console. */
376 + fdt_init(_dtb_start);
377 + serial_console_init();
379 + /* Remaining fixups... */
380 + platform_ops.fixups = rb600_fixups;
382 --- a/arch/powerpc/boot/wrapper
383 +++ b/arch/powerpc/boot/wrapper
384 @@ -215,7 +215,7 @@ ps3)
388 -ep88xc|ep405|ep8248e)
389 +ep88xc|ep405|ep8248e|rb600|rb333)
390 platformo="$object/fixed-head.o $object/$platform.o"
393 --- a/arch/powerpc/platforms/83xx/Kconfig
394 +++ b/arch/powerpc/platforms/83xx/Kconfig
395 @@ -38,6 +38,15 @@ config MPC832x_RDB
397 This option enables support for the MPC8323 RDB board.
400 + bool "MikroTik RouterBOARD 333/600 series"
401 + select DEFAULT_UIMAGE
402 + select QUICC_ENGINE
406 + This option enables support for MikroTik RouterBOARD 333/600 series boards.
409 bool "Freescale MPC834x MDS"
410 select DEFAULT_UIMAGE
412 +++ b/arch/powerpc/boot/dts/rb333.dts
416 + * RouterBOARD 333 series Device Tree Source
418 + * Copyright 2010 Alexandros C. Couloumbis <alex@ozo.com>
419 + * Copyright 2009 Michael Guntsche <mike@it-loops.com>
421 + * This program is free software; you can redistribute it and/or modify it
422 + * under the terms of the GNU General Public License as published by the
423 + * Free Software Foundation; either version 2 of the License, or (at your
424 + * option) any later version.
426 + * Warning (reg_format): "reg" property in /qe@e0100000/muram@10000/data-only@0 has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
427 + * Warning (ranges_format): "ranges" property in /qe@e0100000/muram@10000 has invalid length (12 bytes) (parent #address-cells == 1, child #address-cells == 2, #size-cells == 1)
428 + * Warning (avoid_default_addr_size): Relying on default #address-cells value for /qe@e0100000/muram@10000/data-only@0
429 + * Warning (avoid_default_addr_size): Relying on default #size-cells value for /qe@e0100000/muram@10000/data-only@0
430 + * Warning (obsolete_chosen_interrupt_controller): /chosen has obsolete "interrupt-controller" property
439 + compatible = "MPC83xx";
441 + #address-cells = <1>;
445 + ethernet0 = &enet0;
446 + ethernet1 = &enet1;
447 + ethernet2 = &enet2;
453 + bootargs = "console=ttyS0,115200 board=mpc8323 rootfstype=squashfs,yaffs2,jffs2 root=/dev/mtdblock1 boot=1";
454 + // linux,platform = <0x8062>;
455 + // linux,initrd = <0x488000 0x0>;
456 + linux,stdout-path = "/soc8323@e0000000/serial@4500";
457 + // interrupt-controller = <&ipic>;
463 + #address-cells = <1>;
466 + device_type = "cpu";
468 + i-cache-size = <0x4000>;
469 + d-cache-size = <0x4000>;
470 + i-cache-line-size = <0x20>;
471 + d-cache-line-size = <0x20>;
472 + // clock-frequency = <0x13de3650>;
473 + // timebase-frequency = <0x1fc9f08>;
474 + timebase-frequency = <0x0000000>; // filled by the bootwrapper from the firmware blob
475 + clock-frequency = <0x00000000>; // filled by the bootwrapper from the firmware blob
481 + device_type = "memory";
482 + reg = <0x0 0x4000000>;
483 + // reg = <0x0 0x0000000>; // filled by the bootwrapper from the firmware blob
487 + reg = <0xfe000000 0x20000>;
491 + ale = <&gpio2 0x3>;
492 + cle = <&gpio2 0x2>;
493 + nce = <&gpio2 0x1>;
494 + rdy = <&gpio2 0x0>;
495 + reg = <0xf8000000 0x1000>;
496 + device_type = "rb,nand";
500 + reg = <0xf0000000 0x1000>;
504 + voltage_gpio = <&gpio3 0x11>;
508 + interrupt-parent = <&ipic>;
509 + interrupts = <0x14 0x8>;
510 + fan_on = <&gpio0 0x10>;
513 + pci0: pci@e0008500 {
514 + device_type = "pci";
515 + // compatible = "83xx";
516 + compatible = "fsl,mpc8349-pci";
517 + reg = <0xe0008500 0x100 0xe0008300 0x8>;
518 + #address-cells = <3>;
520 + #interrupt-cells = <1>;
521 + // clock-frequency = <0>;
522 + ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 0x1000000 0x0 0x0 0xd0000000 0x0 0x4000000>;
523 + bus-range = <0x0 0x0>;
525 + /* IDSEL 0x10 AD16 miniPCI slot 0 */
526 + 0x8000 0x0 0x0 0x1 &ipic 0x11 0x8
527 + 0x8000 0x0 0x0 0x2 &ipic 0x12 0x8
529 + /* IDSEL 0x11 AD17 miniPCI slot 1 */
530 + 0x8800 0x0 0x0 0x1 &ipic 0x12 0x8
531 + 0x8800 0x0 0x0 0x2 &ipic 0x13 0x8
533 + /* IDSEL 0x12 AD18 miniPCI slot 2 */
534 + 0x9000 0x0 0x0 0x1 &ipic 0x13 0x8
535 + 0x9000 0x0 0x0 0x2 &ipic 0x11 0x8>;
537 + interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
538 + interrupt-parent = <&ipic>;
539 + // interrupts = <66 0x8>;
544 + reg = <0xe0100000 0x480>;
545 + ranges = <0x0 0xe0100000 0x100000>;
547 + device_type = "qe";
548 + compatible = "fsl,qe";
550 + #address-cells = <1>;
551 + brg-frequency = <0>;
552 + bus-frequency = <0>;
553 + // bus-frequency = <198000000>;
554 + fsl,qe-num-riscs = <1>;
555 + fsl,qe-num-snums = <28>;
558 + interrupt-controller;
559 + compatible = "fsl,qe-ic";
563 + #interrupt-cells = <1>;
564 + #address-cells = <0>;
565 + device_type = "qeic";
566 + interrupts = <0x20 0x8 0x21 0x8>;
567 + interrupt-parent = <&ipic>;
571 + compatible = "ucc_geth_phy";
572 + device_type = "mdio";
573 + reg = <0x3120 0x18>;
575 + #address-cells = <1>;
577 + phy3: ethernet-phy@03 {
578 + // interface = <0x3>;
579 + device_type = "ethernet-phy";
583 + phy2: ethernet-phy@02 {
584 + // interface = <0x3>;
585 + device_type = "ethernet-phy";
589 + phy1: ethernet-phy@01 {
590 + // interface = <0x3>;
591 + device_type = "ethernet-phy";
599 + mac-address = [00 0c 42 1c 29 d2];
600 + interrupt-parent = <&qeic>;
601 + interrupts = <0x22>;
602 + reg = <0x2200 0x200>;
605 + compatible = "ucc_geth";
606 + device_type = "network";
607 + phy-handle = <&phy2>;
608 + pio-handle = <&pio3>;
614 + mac-address = [00 0c 42 1c 29 d1];
615 + interrupt-parent = <&qeic>;
616 + interrupts = <0x23>;
617 + reg = <0x3200 0x200>;
620 + compatible = "ucc_geth";
621 + device_type = "network";
622 + phy-handle = <&phy3>;
623 + pio-handle = <&pio4>;
629 + mac-address = [00 0c 42 1c 29 d0];
630 + interrupt-parent = <&qeic>;
631 + interrupts = <0x21>;
632 + reg = <0x3000 0x200>;
635 + compatible = "ucc_geth";
636 + device_type = "network";
637 + phy-handle = <&phy1>;
638 + pio-handle = <&pio2>;
643 + interrupt-parent = <&qeic>;
644 + interrupts = <0x1>;
645 + reg = <0x500 0x40>;
646 + compatible = "fsl,spi";
647 + device_type = "spi";
652 + interrupt-parent = <&qeic>;
653 + interrupts = <0x2>;
654 + reg = <0x4c0 0x40>;
655 + compatible = "fsl,spi";
656 + device_type = "spi";
660 + #address-cells = <1>;
662 + compatible = "fsl,qe-muram", "fsl,cpm-muram";
663 + ranges = <0x0 0x10000 0x4000>;
664 + device_type = "muram";
667 + compatible = "fsl,qe-muram-data",
668 + "fsl,cpm-muram-data";
669 + reg = <0x0 0x4000>;
676 + bus-frequency = <0x1>;
677 + reg = <0xe0000000 0x200>;
678 + ranges = <0x0 0xe0000000 0x100000>;
679 + device_type = "soc";
680 + compatible = "simple-bus";
681 + #interrupt-cells = <0x2>;
683 + #address-cells = <1>;
686 + gpio = <&gpio3 0x12>;
687 + reg = <0x500 0x100>;
688 + interrupt-parent = <&ipic>;
689 + interrupts = <0x48 0x8>;
693 + reg = <0x144c 0x4>;
695 + compatible = "qe_gpio";
696 + device_type = "gpio";
700 + reg = <0x1434 0x4>;
702 + compatible = "qe_gpio";
703 + device_type = "gpio";
707 + reg = <0x1404 0x4>;
709 + compatible = "qe_gpio";
710 + device_type = "gpio";
715 + device_type = "par_io";
716 + reg = <0x1400 0x100>;
720 + /* port pin dir open_drain assignment has_irq */
740 + /* port pin dir open_drain assignment has_irq */
760 + /* port pin dir open_drain assignment has_irq */
782 + device_type = "ipic";
784 + reg = <0x700 0x100>;
785 + #interrupt-cells = <0x2>;
786 + #address-cells = <0x0>;
787 + interrupt-controller;
792 + interrupt-parent = <&ipic>;
793 + interrupts = <0x9 0x8>;
794 + clock-frequency = <0x7f27c20>;
795 + reg = <0x4500 0x100>;
796 + compatible = "ns16550";
797 + device_type = "serial";
801 + #address-cells = <1>;
803 + compatible = "fsl,mpc8323-dma", "fsl,elo-dma";
805 + ranges = <0 0x8100 0x1a8>;
806 + interrupt-parent = <&ipic>;
807 + interrupts = <71 8>;
810 + compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
813 + interrupt-parent = <&ipic>;
814 + interrupts = <71 8>;
817 + compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
820 + interrupt-parent = <&ipic>;
821 + interrupts = <71 8>;
824 + compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
825 + reg = <0x100 0x80>;
827 + interrupt-parent = <&ipic>;
828 + interrupts = <71 8>;
831 + compatible = "fsl,mpc8323-dma-channel", "fsl,elo-dma-channel";
832 + reg = <0x180 0x28>;
834 + interrupt-parent = <&ipic>;
835 + interrupts = <71 8>;
840 + reg = <0x200 0x100>;
841 + compatible = "mpc83xx_wdt";
842 + device_type = "watchdog";
847 +++ b/arch/powerpc/boot/rb333.c
850 + * The RouterBOARD platform -- for booting RB333 RouterBOARDs.
852 + * Author: Alexandros C. Couloumbis <alex@ozo.com>
853 + * Author: Michael Guntsche <mike@it-loops.com>
855 + * Copyright (c) 2010 Alexandros C. Couloumbis
856 + * Copyright (c) 2009 Michael Guntsche
858 + * This program is free software; you can redistribute it and/or modify it
859 + * under the terms of the GNU General Public License version 2 as published
860 + * by the Free Software Foundation.
874 +static void rb333_fixups(void)
876 + const u32 *reg, *timebase, *clock;
879 + const char* bootargs;
881 + dt_fixup_memory(0, memsize64);
883 + /* Find the CPU timebase and clock frequencies. */
884 + node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "cpu", sizeof("cpu"));
885 + timebase = fdt_getprop(fw_dtb, node, "timebase-frequency", &size);
886 + clock = fdt_getprop(fw_dtb, node, "clock-frequency", &size);
887 + dt_fixup_cpu_clocks(*clock, *timebase, 0);
890 + * The bootloader reads the kernelparm segment and adds the content to
891 + * bootargs. This is needed to specify root and other boot flags.
893 + chosen = finddevice("/chosen");
894 + node = fdt_path_offset(fw_dtb, "/chosen");
895 + bootargs = fdt_getprop(fw_dtb, node, "bootargs", &size);
896 + setprop_str(chosen, "bootargs", bootargs);
899 +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
900 + unsigned long r6, unsigned long r7)
905 + fw_dtb = (const void *)r3;
907 + /* Find the memory range. */
908 + node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "memory", sizeof("memory"));
909 + reg = fdt_getprop(fw_dtb, node, "reg", &size);
910 + memsize64 = reg[1];
912 + /* Now we have the memory size; initialize the heap. */
913 + simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64);
915 + /* Prepare the device tree and find the console. */
916 + fdt_init(_dtb_start);
917 + serial_console_init();
919 + /* Remaining fixups... */
920 + platform_ops.fixups = rb333_fixups;
923 +++ b/arch/powerpc/platforms/83xx/rbppc.c
926 + * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com>
927 + * Copyright (C) 2008-2009 Noah Fontes <nfontes@transtruct.org>
928 + * Copyright (C) 2009 Michael Guntsche <mike@it-loops.com>
929 + * Copyright (C) Mikrotik 2007
931 + * This program is free software; you can redistribute it and/or modify it
932 + * under the terms of the GNU General Public License as published by the
933 + * Free Software Foundation; either version 2 of the License, or (at your
934 + * option) any later version.
937 +#include <linux/delay.h>
938 +#include <linux/root_dev.h>
939 +#include <linux/initrd.h>
940 +#include <linux/interrupt.h>
941 +#include <linux/of_platform.h>
942 +#include <linux/of_device.h>
943 +#include <linux/of_platform.h>
944 +#include <linux/pci.h>
945 +#include <asm/time.h>
946 +#include <asm/ipic.h>
947 +#include <asm/udbg.h>
949 +#include <asm/qe_ic.h>
950 +#include <sysdev/fsl_soc.h>
951 +#include <sysdev/fsl_pci.h>
952 +#include "mpc83xx.h"
954 +#define SYSCTL 0x100
964 +#define GTCFR_BCM 0x40
965 +#define GTCFR_STP4 0x20
966 +#define GTCFR_RST4 0x10
967 +#define GTCFR_STP3 0x02
968 +#define GTCFR_RST3 0x01
970 +#define GTMDR_ORI 0x10
971 +#define GTMDR_FRR 0x08
972 +#define GTMDR_ICLK16 0x04
974 +extern int par_io_data_set(u8 port, u8 pin, u8 val);
975 +extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
976 + int assignment, int has_irq);
978 +static unsigned timer_freq;
981 +static int beeper_irq;
982 +static unsigned beeper_gpio_pin[2];
986 +irqreturn_t rbppc_timer_irq(int irq, void *ptr)
988 + static int toggle = 0;
990 + par_io_data_set(beeper_gpio_pin[0], beeper_gpio_pin[1], toggle);
993 + /* ack interrupt */
994 + out_be16(gtm + GTVER4, 3);
996 + return IRQ_HANDLED;
999 +void rbppc_beep(unsigned freq)
1003 + if (freq > 5000) freq = 5000;
1008 + out_8(gtm + GTCFR2, GTCFR_STP4 | GTCFR_STP3);
1012 + out_8(gtm + GTCFR2, GTCFR_RST4 | GTCFR_STP3);
1013 + out_be16(gtm + GTPSR4, 255);
1014 + gtmdr = GTMDR_FRR | GTMDR_ICLK16;
1015 + if (beeper_irq != NO_IRQ) gtmdr |= GTMDR_ORI;
1016 + out_be16(gtm + GTMDR4, gtmdr);
1017 + out_be16(gtm + GTVER4, 3);
1019 + out_be16(gtm + GTRFR4, timer_freq / 16 / 256 / freq / 2);
1020 + out_be16(gtm + GTCNR4, 0);
1022 +EXPORT_SYMBOL(rbppc_beep);
1024 +static void __init rbppc_setup_arch(void)
1026 + struct device_node *np;
1028 + np = of_find_node_by_type(NULL, "cpu");
1030 + const unsigned *fp = of_get_property(np, "clock-frequency", NULL);
1031 + loops_per_jiffy = fp ? *fp / HZ : 0;
1036 + np = of_find_node_by_name(NULL, "serial");
1039 + *(unsigned *) of_get_property(np, "clock-frequency", NULL);
1044 + np = of_find_node_by_type(NULL, "pci");
1046 + mpc83xx_add_bridge(np);
1052 +#ifdef CONFIG_QUICC_ENGINE
1055 + if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
1059 + for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
1060 + par_io_of_config(np);
1068 +void __init rbppc_init_IRQ(void)
1070 + struct device_node *np;
1072 + np = of_find_node_by_type(NULL, "ipic");
1075 + ipic_set_default_priority();
1081 +#ifdef CONFIG_QUICC_ENGINE
1082 + np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
1084 + np = of_find_node_by_type(NULL, "qeic");
1088 + qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
1090 +#endif /* CONFIG_QUICC_ENGINE */
1096 +static int __init rbppc_probe(void)
1100 + model = of_get_flat_dt_prop(of_get_flat_dt_root(), "model", NULL);
1105 + if (strcmp(model, "RB333") == 0) {
1110 + if (strcmp(model, "RB600") == 0)
1116 +static void __init rbppc_beeper_init(struct device_node *beeper)
1118 + struct resource res;
1119 + struct device_node *gpio;
1120 + const unsigned *pin;
1121 + const unsigned *gpio_id;
1123 + if (of_address_to_resource(beeper, 0, &res)) {
1124 + printk(KERN_ERR "rbppc_beeper_init(%s): Beeper error: No region specified\n", beeper->full_name);
1128 + pin = of_get_property(beeper, "gpio", NULL);
1130 + gpio = of_find_node_by_phandle(pin[0]);
1133 + printk(KERN_ERR "rbppc_beeper_init(%s): Beeper error: GPIO handle %x not found\n", beeper->full_name, pin[0]);
1137 + gpio_id = of_get_property(gpio, "device-id", NULL);
1139 + printk(KERN_ERR "rbppc_beeper_init(%s): Beeper error: No device-id specified in GPIO\n", beeper->full_name);
1143 + beeper_gpio_pin[0] = *gpio_id;
1144 + beeper_gpio_pin[1] = pin[1];
1146 + par_io_config_pin(*gpio_id, pin[1], 1, 0, 0, 0);
1150 + sysctl = ioremap_nocache(get_immrbase() + SYSCTL, 0x100);
1151 + out_be32(sysctl + SICRL,
1152 + in_be32(sysctl + SICRL) | (1 << (31 - 19)));
1156 + gtm = ioremap_nocache(res.start, res.end - res.start + 1);
1158 + beeper_irq = irq_of_parse_and_map(beeper, 0);
1159 + if (beeper_irq != NO_IRQ) {
1160 + int e = request_irq(beeper_irq, rbppc_timer_irq, 0, "beeper", NULL);
1162 + printk(KERN_ERR "rbppc_beeper_init(%s): Request of beeper irq failed!\n", beeper->full_name);
1167 +#define SBIT(x) (0x80000000 >> (x))
1168 +#define DBIT(x, y) ((y) << (32 - (((x % 16) + 1) * 2)))
1170 +#define GPIO_DIR_RB333(x) ((x) + (0x1408 >> 2))
1171 +#define GPIO_DATA_RB333(x) ((x) + (0x1404 >> 2))
1173 +#define SICRL_RB600(x) ((x) + (0x114 >> 2))
1174 +#define GPIO_DIR_RB600(x) ((x) + (0xc00 >> 2))
1175 +#define GPIO_DATA_RB600(x) ((x) + (0xc08 >> 2))
1177 +static void rbppc_restart(char *cmd)
1179 + __be32 __iomem *reg;
1180 + unsigned rb_model;
1181 + struct device_node *root;
1182 + unsigned int size;
1184 + root = of_find_node_by_path("/");
1186 + const char *prop = (char *) of_get_property(root, "model", &size);
1187 + rb_model = prop[sizeof("RB") - 1] - '0';
1188 + of_node_put(root);
1189 + switch (rb_model) {
1191 + reg = ioremap(get_immrbase(), 0x2000);
1192 + local_irq_disable();
1193 + out_be32(GPIO_DIR_RB333(reg),
1194 + (in_be32(GPIO_DIR_RB333(reg)) & ~DBIT(4, 3)) | DBIT(4, 1));
1195 + out_be32(GPIO_DATA_RB333(reg), in_be32(GPIO_DATA_RB333(reg)) & ~SBIT(4));
1198 + reg = ioremap(get_immrbase(), 0x1000);
1199 + local_irq_disable();
1200 + out_be32(SICRL_RB600(reg), in_be32(SICRL_RB600(reg)) & ~0x00800000);
1201 + out_be32(GPIO_DIR_RB600(reg), in_be32(GPIO_DIR_RB600(reg)) | SBIT(2));
1202 + out_be32(GPIO_DATA_RB600(reg), in_be32(GPIO_DATA_RB600(reg)) & ~SBIT(2));
1205 + mpc83xx_restart(cmd);
1209 + else mpc83xx_restart(cmd);
1214 +static void rbppc_halt(void)
1219 +static struct of_device_id rbppc_ids[] = {
1220 + { .type = "soc", },
1221 + { .compatible = "soc", },
1222 + { .compatible = "simple-bus", },
1223 + { .type = "qe", },
1224 + { .compatible = "fsl,qe", },
1225 + { .compatible = "gianfar", },
1229 +static int __init rbppc_declare_of_platform_devices(void)
1231 + struct device_node *np;
1234 + of_platform_bus_probe(NULL, rbppc_ids, NULL);
1236 + np = of_find_node_by_type(NULL, "mdio");
1240 + const unsigned *eres;
1241 + struct device_node *ep;
1243 + ep = of_find_compatible_node(NULL, "network", "ucc_geth");
1245 + eres = of_get_property(ep, "reg", &len);
1246 + res = (unsigned *) of_get_property(np, "reg", &len);
1247 + if (res && eres) {
1248 + res[0] = eres[0] + 0x120;
1253 + np = of_find_node_by_name(NULL, "nand");
1255 + of_platform_device_create(np, "nand", NULL);
1259 + for_each_node_by_type(np, "rb,cf") {
1260 + char dev_name[12];
1261 + snprintf(dev_name, sizeof(dev_name), "cf.%u", idx);
1262 + of_platform_device_create(np, dev_name, NULL);
1266 + np = of_find_node_by_name(NULL, "beeper");
1268 + rbppc_beeper_init(np);
1273 +machine_device_initcall(rb600, rbppc_declare_of_platform_devices);
1275 +define_machine(rb600) {
1276 + .name = "MikroTik RouterBOARD 333/600 series",
1277 + .probe = rbppc_probe,
1278 + .setup_arch = rbppc_setup_arch,
1279 + .init_IRQ = rbppc_init_IRQ,
1280 + .get_irq = ipic_get_irq,
1281 + .restart = rbppc_restart,
1282 + .halt = rbppc_halt,
1283 + .time_init = mpc83xx_time_init,
1284 + .calibrate_decr = generic_calibrate_decr,
1287 +static void fixup_pcibridge(struct pci_dev *dev)
1289 + if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
1290 + /* let the kernel itself set right memory windows */
1291 + pci_write_config_word(dev, PCI_MEMORY_BASE, 0);
1292 + pci_write_config_word(dev, PCI_MEMORY_LIMIT, 0);
1293 + pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0);
1294 + pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0);
1295 + pci_write_config_byte(dev, PCI_IO_BASE, 0);
1296 + pci_write_config_byte(dev, PCI_IO_LIMIT, 4 << 4);
1298 + pci_write_config_byte(
1300 + PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
1301 + pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8);
1306 +static void fixup_rb604(struct pci_dev *dev)
1308 + pci_write_config_byte(dev, 0xC0, 0x01);
1311 +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_pcibridge)
1312 +DECLARE_PCI_FIXUP_HEADER(0x3388, 0x0021, fixup_rb604)