[brcm63xx] move files to files-2.6.30, to ease newer kernel integration
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / files-2.6.30 / arch / mips / bcm63xx / boards / board_bcm963xx.c
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
7 * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
8 */
9
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/string.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/ssb/ssb.h>
18 #include <linux/gpio_buttons.h>
19 #include <asm/addrspace.h>
20 #include <bcm63xx_board.h>
21 #include <bcm63xx_cpu.h>
22 #include <bcm63xx_regs.h>
23 #include <bcm63xx_io.h>
24 #include <bcm63xx_board.h>
25 #include <bcm63xx_dev_pci.h>
26 #include <bcm63xx_dev_uart.h>
27 #include <bcm63xx_dev_wdt.h>
28 #include <bcm63xx_dev_enet.h>
29 #include <bcm63xx_dev_dsp.h>
30 #include <bcm63xx_dev_pcmcia.h>
31 #include <bcm63xx_dev_usb_ohci.h>
32 #include <bcm63xx_dev_usb_ehci.h>
33 #include <bcm63xx_dev_usb_udc.h>
34 #include <bcm63xx_dev_spi.h>
35 #include <board_bcm963xx.h>
36 #include <linux/input.h>
37
38 #define PFX "board_bcm963xx: "
39
40 static struct bcm963xx_nvram nvram;
41 static unsigned int mac_addr_used = 0;
42 static struct board_info board;
43
44 /*
45 * known 6338 boards
46 */
47
48 #ifdef CONFIG_BCM63XX_CPU_6338
49 static struct board_info __initdata board_96338gw = {
50 .name = "96338GW",
51 .expected_cpu_id = 0x6338,
52
53 .has_enet0 = 1,
54 .enet0 = {
55 .force_speed_100 = 1,
56 .force_duplex_full = 1,
57 },
58
59 .has_ohci0 = 1,
60
61 .leds = {
62 {
63 .name = "adsl",
64 .gpio = 3,
65 .active_low = 1,
66 },
67 {
68 .name = "ses",
69 .gpio = 5,
70 .active_low = 1,
71 },
72 {
73 .name = "ppp-fail",
74 .gpio = 4,
75 .active_low = 1,
76 },
77 {
78 .name = "power",
79 .gpio = 0,
80 .active_low = 1,
81 .default_trigger = "default-on",
82 },
83 {
84 .name = "stop",
85 .gpio = 1,
86 .active_low = 1,
87 }
88 },
89 };
90
91 static struct board_info __initdata board_96338w = {
92 .name = "96338W",
93 .expected_cpu_id = 0x6338,
94
95 .has_enet0 = 1,
96 .enet0 = {
97 .force_speed_100 = 1,
98 .force_duplex_full = 1,
99 },
100
101 .leds = {
102 {
103 .name = "adsl",
104 .gpio = 3,
105 .active_low = 1,
106 },
107 {
108 .name = "ses",
109 .gpio = 5,
110 .active_low = 1,
111 },
112 {
113 .name = "ppp-fail",
114 .gpio = 4,
115 .active_low = 1,
116 },
117 {
118 .name = "power",
119 .gpio = 0,
120 .active_low = 1,
121 .default_trigger = "default-on",
122 },
123 {
124 .name = "stop",
125 .gpio = 1,
126 .active_low = 1,
127 },
128 },
129 };
130 #endif
131
132 /*
133 * known 6345 boards
134 */
135 #ifdef CONFIG_BCM63XX_CPU_6345
136 static struct board_info __initdata board_96345gw2 = {
137 .name = "96345GW2",
138 .expected_cpu_id = 0x6345,
139 };
140 #endif
141
142 /*
143 * known 6348 boards
144 */
145 #ifdef CONFIG_BCM63XX_CPU_6348
146 static struct board_info __initdata board_96348r = {
147 .name = "96348R",
148 .expected_cpu_id = 0x6348,
149
150 .has_enet0 = 1,
151 .has_pci = 1,
152
153 .enet0 = {
154 .has_phy = 1,
155 .use_internal_phy = 1,
156 },
157
158 .leds = {
159 {
160 .name = "adsl-fail",
161 .gpio = 2,
162 .active_low = 1,
163 },
164 {
165 .name = "ppp",
166 .gpio = 3,
167 .active_low = 1,
168 },
169 {
170 .name = "ppp-fail",
171 .gpio = 4,
172 .active_low = 1,
173 },
174 {
175 .name = "power",
176 .gpio = 0,
177 .active_low = 1,
178 .default_trigger = "default-on",
179
180 },
181 {
182 .name = "stop",
183 .gpio = 1,
184 .active_low = 1,
185 },
186 },
187 };
188
189 static struct board_info __initdata board_96348gw_10 = {
190 .name = "96348GW-10",
191 .expected_cpu_id = 0x6348,
192
193 .has_enet0 = 1,
194 .has_enet1 = 1,
195 .has_pci = 1,
196
197 .enet0 = {
198 .has_phy = 1,
199 .use_internal_phy = 1,
200 },
201 .enet1 = {
202 .force_speed_100 = 1,
203 .force_duplex_full = 1,
204 },
205
206 .has_ohci0 = 1,
207 .has_pccard = 1,
208 .has_ehci0 = 1,
209
210 .has_dsp = 1,
211 .dsp = {
212 .gpio_rst = 6,
213 .gpio_int = 34,
214 .cs = 2,
215 .ext_irq = 2,
216 },
217
218 .leds = {
219 {
220 .name = "adsl-fail",
221 .gpio = 2,
222 .active_low = 1,
223 },
224 {
225 .name = "ppp",
226 .gpio = 3,
227 .active_low = 1,
228 },
229 {
230 .name = "ppp-fail",
231 .gpio = 4,
232 .active_low = 1,
233 },
234 {
235 .name = "power",
236 .gpio = 0,
237 .active_low = 1,
238 .default_trigger = "default-on",
239 },
240 {
241 .name = "stop",
242 .gpio = 1,
243 .active_low = 1,
244 },
245 },
246 };
247
248 static struct board_info __initdata board_96348gw_11 = {
249 .name = "96348GW-11",
250 .expected_cpu_id = 0x6348,
251
252 .has_enet0 = 1,
253 .has_enet1 = 1,
254 .has_pci = 1,
255
256 .enet0 = {
257 .has_phy = 1,
258 .use_internal_phy = 1,
259 },
260
261 .enet1 = {
262 .force_speed_100 = 1,
263 .force_duplex_full = 1,
264 },
265
266
267 .has_ohci0 = 1,
268 .has_pccard = 1,
269 .has_ehci0 = 1,
270
271 .leds = {
272 {
273 .name = "adsl-fail",
274 .gpio = 2,
275 .active_low = 1,
276 },
277 {
278 .name = "ppp",
279 .gpio = 3,
280 .active_low = 1,
281 },
282 {
283 .name = "ppp-fail",
284 .gpio = 4,
285 .active_low = 1,
286 },
287 {
288 .name = "power",
289 .gpio = 0,
290 .active_low = 1,
291 .default_trigger = "default-on",
292 },
293 {
294 .name = "stop",
295 .gpio = 1,
296 .active_low = 1,
297 },
298 },
299 .reset_buttons = {
300 {
301 .desc = "reset",
302 .gpio = 32,
303 .active_low = 1,
304 .type = EV_KEY,
305 .code = BTN_0,
306 .threshold = 3,
307 },
308 },
309 };
310
311 static struct board_info __initdata board_96348gw = {
312 .name = "96348GW",
313 .expected_cpu_id = 0x6348,
314
315 .has_enet0 = 1,
316 .has_enet1 = 1,
317 .has_pci = 1,
318
319 .enet0 = {
320 .has_phy = 1,
321 .use_internal_phy = 1,
322 },
323 .enet1 = {
324 .force_speed_100 = 1,
325 .force_duplex_full = 1,
326 },
327
328 .has_ohci0 = 1,
329 .has_dsp = 1,
330
331 .dsp = {
332 .gpio_rst = 6,
333 .gpio_int = 34,
334 .ext_irq = 2,
335 .cs = 2,
336 },
337
338 .leds = {
339 {
340 .name = "adsl-fail",
341 .gpio = 2,
342 .active_low = 1,
343 },
344 {
345 .name = "power",
346 .gpio = 0,
347 .active_low = 1,
348 .default_trigger = "default-on",
349 },
350 {
351 .name = "stop",
352 .gpio = 1,
353 .active_low = 1,
354 },
355 {
356 .name = "line1",
357 .gpio = 4,
358 .active_low = 1,
359 },
360 {
361 .name = "line2",
362 .gpio = 5,
363 .active_low = 1,
364 },
365 { .name = "line3",
366 .gpio = 6,
367 .active_low = 1,
368 },
369 {
370 .name = "tel",
371 .gpio = 7,
372 .active_low = 1,
373 },
374 {
375 .name = "eth",
376 .gpio = 35,
377 .active_low = 1,
378 },
379 },
380 .reset_buttons = {
381 {
382 .desc = "reset",
383 .gpio = 36,
384 .active_low = 1,
385 .type = EV_KEY,
386 .code = BTN_0,
387 .threshold = 3,
388 },
389 },
390 };
391
392 static struct board_info __initdata board_FAST2404 = {
393 .name = "F@ST2404",
394 .expected_cpu_id = 0x6348,
395
396 .has_enet0 = 1,
397 .has_enet1 = 1,
398 .has_pci = 1,
399
400 .enet0 = {
401 .has_phy = 1,
402 .use_internal_phy = 1,
403 },
404
405 .enet1 = {
406 .force_speed_100 = 1,
407 .force_duplex_full = 1,
408 },
409
410
411 .has_ohci0 = 1,
412 .has_pccard = 1,
413 .has_ehci0 = 1,
414 };
415
416 static struct board_info __initdata board_DV201AMR = {
417 .name = "DV201AMR",
418 .expected_cpu_id = 0x6348,
419
420 .has_pci = 1,
421 .has_ohci0 = 1,
422 .has_udc0 = 1,
423
424 .has_enet0 = 1,
425 .has_enet1 = 1,
426 .enet0 = {
427 .has_phy = 1,
428 .use_internal_phy = 1,
429 },
430 .enet1 = {
431 .force_speed_100 = 1,
432 .force_duplex_full = 1,
433 },
434 };
435
436 static struct board_info __initdata board_96348gw_a = {
437 .name = "96348GW-A",
438 .expected_cpu_id = 0x6348,
439
440 .has_enet0 = 1,
441 .has_enet1 = 1,
442 .has_pci = 1,
443
444 .enet0 = {
445 .has_phy = 1,
446 .use_internal_phy = 1,
447 },
448 .enet1 = {
449 .force_speed_100 = 1,
450 .force_duplex_full = 1,
451 },
452
453 .has_ohci0 = 1,
454 };
455
456 static struct board_info __initdata board_rta1025w_16 = {
457 .name = "RTA1025W_16",
458 .expected_cpu_id = 0x6348,
459
460 .has_enet0 = 1,
461 .has_enet1 = 1,
462 .has_pci = 1,
463
464 .enet0 = {
465 .has_phy = 1,
466 .use_internal_phy = 1,
467 },
468 .enet1 = {
469 .force_speed_100 = 1,
470 .force_duplex_full = 1,
471 },
472 };
473 #endif
474
475 /*
476 * known 6358 boards
477 */
478 #ifdef CONFIG_BCM63XX_CPU_6358
479 static struct board_info __initdata board_96358vw = {
480 .name = "96358VW",
481 .expected_cpu_id = 0x6358,
482
483 .has_enet0 = 1,
484 .has_enet1 = 1,
485 .has_pci = 1,
486
487 .enet0 = {
488 .has_phy = 1,
489 .use_internal_phy = 1,
490 },
491
492 .enet1 = {
493 .force_speed_100 = 1,
494 .force_duplex_full = 1,
495 },
496
497
498 .has_ohci0 = 1,
499 .has_pccard = 1,
500 .has_ehci0 = 1,
501
502 .leds = {
503 {
504 .name = "adsl-fail",
505 .gpio = 15,
506 .active_low = 1,
507 },
508 {
509 .name = "ppp",
510 .gpio = 22,
511 .active_low = 1,
512 },
513 {
514 .name = "ppp-fail",
515 .gpio = 23,
516 .active_low = 1,
517 },
518 {
519 .name = "power",
520 .gpio = 4,
521 .default_trigger = "default-on",
522 },
523 {
524 .name = "stop",
525 .gpio = 5,
526 },
527 },
528 };
529
530 static struct board_info __initdata board_96358vw2 = {
531 .name = "96358VW2",
532 .expected_cpu_id = 0x6358,
533
534 .has_enet0 = 1,
535 .has_enet1 = 1,
536 .has_pci = 1,
537
538 .enet0 = {
539 .has_phy = 1,
540 .use_internal_phy = 1,
541 },
542
543 .enet1 = {
544 .force_speed_100 = 1,
545 .force_duplex_full = 1,
546 },
547
548
549 .has_ohci0 = 1,
550 .has_pccard = 1,
551 .has_ehci0 = 1,
552
553 .leds = {
554 {
555 .name = "adsl",
556 .gpio = 22,
557 .active_low = 1,
558 },
559 {
560 .name = "ppp-fail",
561 .gpio = 23,
562 },
563 {
564 .name = "power",
565 .gpio = 5,
566 .active_low = 1,
567 .default_trigger = "default-on",
568 },
569 {
570 .name = "stop",
571 .gpio = 4,
572 .active_low = 1,
573 },
574 },
575 };
576
577 static struct board_info __initdata board_AGPFS0 = {
578 .name = "AGPF-S0",
579 .expected_cpu_id = 0x6358,
580
581 .has_enet0 = 1,
582 .has_enet1 = 1,
583 .has_pci = 1,
584
585 .enet0 = {
586 .has_phy = 1,
587 .use_internal_phy = 1,
588 },
589
590 .enet1 = {
591 .force_speed_100 = 1,
592 .force_duplex_full = 1,
593 },
594
595 .has_ohci0 = 1,
596 .has_ehci0 = 1,
597
598 .leds = {
599 /*Each led on alice gate is bi-color so final char */
600 /* is r for red and g for green leds */
601 {
602 .name = "pwrr",
603 .gpio = 5,
604 .active_low = 1,
605 },
606 {
607 .name = "pwrg",
608 .gpio = 4,
609 .active_low = 1,
610 .default_trigger = "default-on",
611 },
612 {
613 .name = "wifir",
614 .gpio = 23,
615 .active_low = 1,
616 },
617 {
618 .name = "wifig",
619 .gpio = 22,
620 .active_low = 1,
621 },
622 {
623 .name = "usr1r",
624 .gpio = 27,
625 .active_low = 1,
626 },
627 {
628 .name = "usr1g",
629 .gpio = 26,
630 .active_low = 1,
631 },
632 {
633 .name = "usr2r",
634 .gpio = 30,
635 .active_low = 1,
636 },
637 {
638 .name = "usr2g",
639 .gpio = 29,
640 .active_low = 1,
641 },
642 },
643
644 .reset_buttons = {
645 {
646 .desc = "sw2",
647 .gpio = 37,
648 .active_low = 1,
649 .type = EV_KEY,
650 .code = BTN_0,
651 .threshold = 3,
652 },
653 },
654 /* sw1 is connected to gpio34*/
655 };
656
657 static struct board_info __initdata board_DWVS0 = {
658 .name = "DWV-S0",
659 .expected_cpu_id = 0x6358,
660
661 .has_enet0 = 1,
662 .has_enet1 = 1,
663 .has_pci = 1,
664
665 .enet0 = {
666 .has_phy = 1,
667 .use_internal_phy = 1,
668 },
669
670 .enet1 = {
671 .force_speed_100 = 1,
672 .force_duplex_full = 1,
673 },
674
675 .has_ohci0 = 1,
676 };
677 #endif
678
679 /*
680 * all boards
681 */
682 static const struct board_info __initdata *bcm963xx_boards[] = {
683 #ifdef CONFIG_BCM63XX_CPU_6338
684 &board_96338gw,
685 &board_96338w,
686 #endif
687 #ifdef CONFIG_BCM63XX_CPU_6345
688 &board_96345gw2,
689 #endif
690 #ifdef CONFIG_BCM63XX_CPU_6348
691 &board_96348r,
692 &board_96348gw,
693 &board_96348gw_10,
694 &board_96348gw_11,
695 &board_FAST2404,
696 &board_DV201AMR,
697 &board_96348gw_a,
698 &board_rta1025w_16,
699 #endif
700
701 #ifdef CONFIG_BCM63XX_CPU_6358
702 &board_96358vw,
703 &board_96358vw2,
704 &board_AGPFS0,
705 &board_DWVS0,
706 #endif
707 };
708
709 /*
710 * early init callback, read nvram data from flash and checksum it
711 */
712 void __init board_prom_init(void)
713 {
714 unsigned int check_len, i;
715 u8 *boot_addr, *cfe, *p;
716 char cfe_version[32];
717 u32 val;
718
719 /* read base address of boot chip select (0)
720 * 6345 does not have MPI but boots from standard
721 * MIPS Flash address */
722 if (BCMCPU_IS_6345())
723 val = 0x1fc00000;
724 else {
725 val = bcm_mpi_readl(MPI_CSBASE_REG(0));
726 val &= MPI_CSBASE_BASE_MASK;
727 }
728 boot_addr = (u8 *)KSEG1ADDR(val);
729
730 /* dump cfe version */
731 cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
732 if (!memcmp(cfe, "cfe-v", 5))
733 snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
734 cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
735 else
736 strcpy(cfe_version, "unknown");
737 printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
738
739 /* extract nvram data */
740 memcpy(&nvram, boot_addr + BCM963XX_NVRAM_OFFSET, sizeof(nvram));
741
742 /* check checksum before using data */
743 if (nvram.version <= 4)
744 check_len = offsetof(struct bcm963xx_nvram, checksum_old);
745 else
746 check_len = sizeof(nvram);
747 val = 0;
748 p = (u8 *)&nvram;
749 while (check_len--)
750 val += *p;
751 if (val) {
752 printk(KERN_ERR PFX "invalid nvram checksum\n");
753 return;
754 }
755
756 /* find board by name */
757 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
758 if (strncmp(nvram.name, bcm963xx_boards[i]->name,
759 sizeof(nvram.name)))
760 continue;
761 /* copy, board desc array is marked initdata */
762 memcpy(&board, bcm963xx_boards[i], sizeof(board));
763 break;
764 }
765
766 /* bail out if board is not found, will complain later */
767 if (!board.name[0]) {
768 char name[17];
769 memcpy(name, nvram.name, 16);
770 name[16] = 0;
771 printk(KERN_ERR PFX "unknown bcm963xx board: %s\n",
772 name);
773 return;
774 }
775
776 /* setup pin multiplexing depending on board enabled device,
777 * this has to be done this early since PCI init is done
778 * inside arch_initcall */
779 val = 0;
780 #ifdef CONFIG_PCI
781 if (board.has_pci) {
782 bcm63xx_pci_enabled = 1;
783 if (BCMCPU_IS_6348())
784 val |= GPIO_MODE_6348_G2_PCI;
785 }
786 #endif
787 if (board.has_pccard) {
788 if (BCMCPU_IS_6348())
789 val |= GPIO_MODE_6348_G1_MII_PCCARD;
790 }
791
792 if (board.has_enet0 && !board.enet0.use_internal_phy) {
793 if (BCMCPU_IS_6348())
794 val |= GPIO_MODE_6348_G3_EXT_MII |
795 GPIO_MODE_6348_G0_EXT_MII;
796 }
797
798 if (board.has_enet1 && !board.enet1.use_internal_phy) {
799 if (BCMCPU_IS_6348())
800 val |= GPIO_MODE_6348_G3_EXT_MII |
801 GPIO_MODE_6348_G0_EXT_MII;
802 }
803
804 bcm_gpio_writel(val, GPIO_MODE_REG);
805 }
806
807 /*
808 * second stage init callback, good time to panic if we couldn't
809 * identify on which board we're running since early printk is working
810 */
811 void __init board_setup(void)
812 {
813 if (!board.name[0])
814 panic("unable to detect bcm963xx board");
815 printk(KERN_INFO PFX "board name: %s\n", board.name);
816
817 /* make sure we're running on expected cpu */
818 if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
819 panic("unexpected CPU for bcm963xx board");
820 }
821
822 /*
823 * return board name for /proc/cpuinfo
824 */
825 const char *board_get_name(void)
826 {
827 return board.name;
828 }
829
830 /*
831 * register & return a new board mac address
832 */
833 static int board_get_mac_address(u8 *mac)
834 {
835 u8 *p;
836 int count;
837
838 if (mac_addr_used >= nvram.mac_addr_count) {
839 printk(KERN_ERR PFX "not enough mac address\n");
840 return -ENODEV;
841 }
842
843 memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
844 p = mac + ETH_ALEN - 1;
845 count = mac_addr_used;
846
847 while (count--) {
848 do {
849 (*p)++;
850 if (*p != 0)
851 break;
852 p--;
853 } while (p != mac);
854 }
855
856 if (p == mac) {
857 printk(KERN_ERR PFX "unable to fetch mac address\n");
858 return -ENODEV;
859 }
860
861 mac_addr_used++;
862 return 0;
863 }
864
865 static struct resource mtd_resources[] = {
866 {
867 .start = 0, /* filled at runtime */
868 .end = 0, /* filled at runtime */
869 .flags = IORESOURCE_MEM,
870 }
871 };
872
873 static struct platform_device mtd_dev = {
874 .name = "bcm963xx-flash",
875 .resource = mtd_resources,
876 .num_resources = ARRAY_SIZE(mtd_resources),
877 };
878
879 /*
880 * Register a sane SPROMv2 to make the on-board
881 * bcm4318 WLAN work
882 */
883 static struct ssb_sprom bcm63xx_sprom = {
884 .revision = 0x02,
885 .board_rev = 0x17,
886 .country_code = 0x0,
887 .ant_available_bg = 0x3,
888 .pa0b0 = 0x15ae,
889 .pa0b1 = 0xfa85,
890 .pa0b2 = 0xfe8d,
891 .pa1b0 = 0xffff,
892 .pa1b1 = 0xffff,
893 .pa1b2 = 0xffff,
894 .gpio0 = 0xff,
895 .gpio1 = 0xff,
896 .gpio2 = 0xff,
897 .gpio3 = 0xff,
898 .maxpwr_bg = 0x004c,
899 .itssi_bg = 0x00,
900 .boardflags_lo = 0x2848,
901 .boardflags_hi = 0x0000,
902 };
903
904 static struct resource gpiodev_resource = {
905 .start = 0xFFFFFFFF,
906 };
907
908 static struct gpio_led_platform_data bcm63xx_led_data;
909
910 static struct platform_device bcm63xx_gpio_leds = {
911 .name = "leds-gpio",
912 .id = 0,
913 .dev.platform_data = &bcm63xx_led_data,
914 };
915
916 static struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = {
917 .poll_interval = 20,
918 };
919
920 static struct platform_device bcm63xx_gpio_buttons_device = {
921 .name = "gpio-buttons",
922 .id = 0,
923 .dev.platform_data = &bcm63xx_gpio_buttons_data,
924 };
925
926
927 /*
928 * third stage init callback, register all board devices.
929 */
930 int __init board_register_devices(void)
931 {
932 u32 val;
933
934 bcm63xx_uart_register();
935 bcm63xx_wdt_register();
936
937 if (!BCMCPU_IS_6345())
938 bcm63xx_spi_register();
939
940 if (board.has_pccard)
941 bcm63xx_pcmcia_register();
942
943 if (board.has_enet0 &&
944 !board_get_mac_address(board.enet0.mac_addr))
945 bcm63xx_enet_register(0, &board.enet0);
946
947 if (board.has_enet1 &&
948 !board_get_mac_address(board.enet1.mac_addr))
949 bcm63xx_enet_register(1, &board.enet1);
950
951 if (board.has_ohci0)
952 bcm63xx_ohci_register();
953
954 if (board.has_ehci0)
955 bcm63xx_ehci_register();
956
957 if (board.has_udc0)
958 bcm63xx_udc_register();
959
960 if (board.has_dsp)
961 bcm63xx_dsp_register(&board.dsp);
962
963 /* Generate MAC address for WLAN and
964 * register our SPROM */
965 #ifdef CONFIG_PCI
966 if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
967 memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
968 memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
969 if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
970 printk(KERN_ERR "failed to register fallback SPROM\n");
971 }
972 #endif
973
974 /* read base address of boot chip select (0) */
975 if (BCMCPU_IS_6345())
976 val = 0x1fc00000;
977 else {
978 val = bcm_mpi_readl(MPI_CSBASE_REG(0));
979 val &= MPI_CSBASE_BASE_MASK;
980 }
981 mtd_resources[0].start = val;
982 mtd_resources[0].end = 0x1FFFFFFF;
983
984 platform_device_register(&mtd_dev);
985
986 /* Register GPIODEV */
987 platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);
988
989 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
990 bcm63xx_led_data.leds = board.leds;
991
992 platform_device_register(&bcm63xx_gpio_leds);
993
994 if (board.reset_buttons) {
995 bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons);
996 bcm63xx_gpio_buttons_data.buttons = board.reset_buttons;
997
998 platform_device_register(&bcm63xx_gpio_buttons_device);
999 }
1000
1001 return 0;
1002 }
1003