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