aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm63xx/boards
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/bcm63xx/boards')
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c257
1 files changed, 159 insertions, 98 deletions
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 05a35cf5963d..8dba8cfb752f 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -18,6 +18,7 @@
18#include <asm/addrspace.h> 18#include <asm/addrspace.h>
19#include <bcm63xx_board.h> 19#include <bcm63xx_board.h>
20#include <bcm63xx_cpu.h> 20#include <bcm63xx_cpu.h>
21#include <bcm63xx_dev_uart.h>
21#include <bcm63xx_regs.h> 22#include <bcm63xx_regs.h>
22#include <bcm63xx_io.h> 23#include <bcm63xx_io.h>
23#include <bcm63xx_dev_pci.h> 24#include <bcm63xx_dev_pci.h>
@@ -40,6 +41,7 @@ static struct board_info __initdata board_96338gw = {
40 .name = "96338GW", 41 .name = "96338GW",
41 .expected_cpu_id = 0x6338, 42 .expected_cpu_id = 0x6338,
42 43
44 .has_uart0 = 1,
43 .has_enet0 = 1, 45 .has_enet0 = 1,
44 .enet0 = { 46 .enet0 = {
45 .force_speed_100 = 1, 47 .force_speed_100 = 1,
@@ -82,6 +84,7 @@ static struct board_info __initdata board_96338w = {
82 .name = "96338W", 84 .name = "96338W",
83 .expected_cpu_id = 0x6338, 85 .expected_cpu_id = 0x6338,
84 86
87 .has_uart0 = 1,
85 .has_enet0 = 1, 88 .has_enet0 = 1,
86 .enet0 = { 89 .enet0 = {
87 .force_speed_100 = 1, 90 .force_speed_100 = 1,
@@ -126,6 +129,8 @@ static struct board_info __initdata board_96338w = {
126static struct board_info __initdata board_96345gw2 = { 129static struct board_info __initdata board_96345gw2 = {
127 .name = "96345GW2", 130 .name = "96345GW2",
128 .expected_cpu_id = 0x6345, 131 .expected_cpu_id = 0x6345,
132
133 .has_uart0 = 1,
129}; 134};
130#endif 135#endif
131 136
@@ -137,6 +142,7 @@ static struct board_info __initdata board_96348r = {
137 .name = "96348R", 142 .name = "96348R",
138 .expected_cpu_id = 0x6348, 143 .expected_cpu_id = 0x6348,
139 144
145 .has_uart0 = 1,
140 .has_enet0 = 1, 146 .has_enet0 = 1,
141 .has_pci = 1, 147 .has_pci = 1,
142 148
@@ -180,6 +186,7 @@ static struct board_info __initdata board_96348gw_10 = {
180 .name = "96348GW-10", 186 .name = "96348GW-10",
181 .expected_cpu_id = 0x6348, 187 .expected_cpu_id = 0x6348,
182 188
189 .has_uart0 = 1,
183 .has_enet0 = 1, 190 .has_enet0 = 1,
184 .has_enet1 = 1, 191 .has_enet1 = 1,
185 .has_pci = 1, 192 .has_pci = 1,
@@ -239,6 +246,7 @@ static struct board_info __initdata board_96348gw_11 = {
239 .name = "96348GW-11", 246 .name = "96348GW-11",
240 .expected_cpu_id = 0x6348, 247 .expected_cpu_id = 0x6348,
241 248
249 .has_uart0 = 1,
242 .has_enet0 = 1, 250 .has_enet0 = 1,
243 .has_enet1 = 1, 251 .has_enet1 = 1,
244 .has_pci = 1, 252 .has_pci = 1,
@@ -292,6 +300,7 @@ static struct board_info __initdata board_96348gw = {
292 .name = "96348GW", 300 .name = "96348GW",
293 .expected_cpu_id = 0x6348, 301 .expected_cpu_id = 0x6348,
294 302
303 .has_uart0 = 1,
295 .has_enet0 = 1, 304 .has_enet0 = 1,
296 .has_enet1 = 1, 305 .has_enet1 = 1,
297 .has_pci = 1, 306 .has_pci = 1,
@@ -346,33 +355,53 @@ static struct board_info __initdata board_96348gw = {
346}; 355};
347 356
348static struct board_info __initdata board_FAST2404 = { 357static struct board_info __initdata board_FAST2404 = {
349 .name = "F@ST2404", 358 .name = "F@ST2404",
350 .expected_cpu_id = 0x6348, 359 .expected_cpu_id = 0x6348,
351 360
352 .has_enet0 = 1, 361 .has_uart0 = 1,
353 .has_enet1 = 1, 362 .has_enet0 = 1,
354 .has_pci = 1, 363 .has_enet1 = 1,
364 .has_pci = 1,
355 365
356 .enet0 = { 366 .enet0 = {
357 .has_phy = 1, 367 .has_phy = 1,
358 .use_internal_phy = 1, 368 .use_internal_phy = 1,
359 }, 369 },
360 370
361 .enet1 = { 371 .enet1 = {
362 .force_speed_100 = 1, 372 .force_speed_100 = 1,
363 .force_duplex_full = 1, 373 .force_duplex_full = 1,
364 }, 374 },
365 375
376 .has_ohci0 = 1,
377 .has_pccard = 1,
378 .has_ehci0 = 1,
379};
366 380
367 .has_ohci0 = 1, 381static struct board_info __initdata board_rta1025w_16 = {
368 .has_pccard = 1, 382 .name = "RTA1025W_16",
369 .has_ehci0 = 1, 383 .expected_cpu_id = 0x6348,
384
385 .has_enet0 = 1,
386 .has_enet1 = 1,
387 .has_pci = 1,
388
389 .enet0 = {
390 .has_phy = 1,
391 .use_internal_phy = 1,
392 },
393 .enet1 = {
394 .force_speed_100 = 1,
395 .force_duplex_full = 1,
396 },
370}; 397};
371 398
399
372static struct board_info __initdata board_DV201AMR = { 400static struct board_info __initdata board_DV201AMR = {
373 .name = "DV201AMR", 401 .name = "DV201AMR",
374 .expected_cpu_id = 0x6348, 402 .expected_cpu_id = 0x6348,
375 403
404 .has_uart0 = 1,
376 .has_pci = 1, 405 .has_pci = 1,
377 .has_ohci0 = 1, 406 .has_ohci0 = 1,
378 407
@@ -392,6 +421,7 @@ static struct board_info __initdata board_96348gw_a = {
392 .name = "96348GW-A", 421 .name = "96348GW-A",
393 .expected_cpu_id = 0x6348, 422 .expected_cpu_id = 0x6348,
394 423
424 .has_uart0 = 1,
395 .has_enet0 = 1, 425 .has_enet0 = 1,
396 .has_enet1 = 1, 426 .has_enet1 = 1,
397 .has_pci = 1, 427 .has_pci = 1,
@@ -417,6 +447,7 @@ static struct board_info __initdata board_96358vw = {
417 .name = "96358VW", 447 .name = "96358VW",
418 .expected_cpu_id = 0x6358, 448 .expected_cpu_id = 0x6358,
419 449
450 .has_uart0 = 1,
420 .has_enet0 = 1, 451 .has_enet0 = 1,
421 .has_enet1 = 1, 452 .has_enet1 = 1,
422 .has_pci = 1, 453 .has_pci = 1,
@@ -468,6 +499,7 @@ static struct board_info __initdata board_96358vw2 = {
468 .name = "96358VW2", 499 .name = "96358VW2",
469 .expected_cpu_id = 0x6358, 500 .expected_cpu_id = 0x6358,
470 501
502 .has_uart0 = 1,
471 .has_enet0 = 1, 503 .has_enet0 = 1,
472 .has_enet1 = 1, 504 .has_enet1 = 1,
473 .has_pci = 1, 505 .has_pci = 1,
@@ -515,6 +547,7 @@ static struct board_info __initdata board_AGPFS0 = {
515 .name = "AGPF-S0", 547 .name = "AGPF-S0",
516 .expected_cpu_id = 0x6358, 548 .expected_cpu_id = 0x6358,
517 549
550 .has_uart0 = 1,
518 .has_enet0 = 1, 551 .has_enet0 = 1,
519 .has_enet1 = 1, 552 .has_enet1 = 1,
520 .has_pci = 1, 553 .has_pci = 1,
@@ -532,6 +565,27 @@ static struct board_info __initdata board_AGPFS0 = {
532 .has_ohci0 = 1, 565 .has_ohci0 = 1,
533 .has_ehci0 = 1, 566 .has_ehci0 = 1,
534}; 567};
568
569static struct board_info __initdata board_DWVS0 = {
570 .name = "DWV-S0",
571 .expected_cpu_id = 0x6358,
572
573 .has_enet0 = 1,
574 .has_enet1 = 1,
575 .has_pci = 1,
576
577 .enet0 = {
578 .has_phy = 1,
579 .use_internal_phy = 1,
580 },
581
582 .enet1 = {
583 .force_speed_100 = 1,
584 .force_duplex_full = 1,
585 },
586
587 .has_ohci0 = 1,
588};
535#endif 589#endif
536 590
537/* 591/*
@@ -553,16 +607,88 @@ static const struct board_info __initdata *bcm963xx_boards[] = {
553 &board_FAST2404, 607 &board_FAST2404,
554 &board_DV201AMR, 608 &board_DV201AMR,
555 &board_96348gw_a, 609 &board_96348gw_a,
610 &board_rta1025w_16,
556#endif 611#endif
557 612
558#ifdef CONFIG_BCM63XX_CPU_6358 613#ifdef CONFIG_BCM63XX_CPU_6358
559 &board_96358vw, 614 &board_96358vw,
560 &board_96358vw2, 615 &board_96358vw2,
561 &board_AGPFS0, 616 &board_AGPFS0,
617 &board_DWVS0,
562#endif 618#endif
563}; 619};
564 620
565/* 621/*
622 * Register a sane SPROMv2 to make the on-board
623 * bcm4318 WLAN work
624 */
625#ifdef CONFIG_SSB_PCIHOST
626static struct ssb_sprom bcm63xx_sprom = {
627 .revision = 0x02,
628 .board_rev = 0x17,
629 .country_code = 0x0,
630 .ant_available_bg = 0x3,
631 .pa0b0 = 0x15ae,
632 .pa0b1 = 0xfa85,
633 .pa0b2 = 0xfe8d,
634 .pa1b0 = 0xffff,
635 .pa1b1 = 0xffff,
636 .pa1b2 = 0xffff,
637 .gpio0 = 0xff,
638 .gpio1 = 0xff,
639 .gpio2 = 0xff,
640 .gpio3 = 0xff,
641 .maxpwr_bg = 0x004c,
642 .itssi_bg = 0x00,
643 .boardflags_lo = 0x2848,
644 .boardflags_hi = 0x0000,
645};
646#endif
647
648/*
649 * return board name for /proc/cpuinfo
650 */
651const char *board_get_name(void)
652{
653 return board.name;
654}
655
656/*
657 * register & return a new board mac address
658 */
659static int board_get_mac_address(u8 *mac)
660{
661 u8 *p;
662 int count;
663
664 if (mac_addr_used >= nvram.mac_addr_count) {
665 printk(KERN_ERR PFX "not enough mac address\n");
666 return -ENODEV;
667 }
668
669 memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
670 p = mac + ETH_ALEN - 1;
671 count = mac_addr_used;
672
673 while (count--) {
674 do {
675 (*p)++;
676 if (*p != 0)
677 break;
678 p--;
679 } while (p != mac);
680 }
681
682 if (p == mac) {
683 printk(KERN_ERR PFX "unable to fetch mac address\n");
684 return -ENODEV;
685 }
686
687 mac_addr_used++;
688 return 0;
689}
690
691/*
566 * early init callback, read nvram data from flash and checksum it 692 * early init callback, read nvram data from flash and checksum it
567 */ 693 */
568void __init board_prom_init(void) 694void __init board_prom_init(void)
@@ -660,6 +786,17 @@ void __init board_prom_init(void)
660 } 786 }
661 787
662 bcm_gpio_writel(val, GPIO_MODE_REG); 788 bcm_gpio_writel(val, GPIO_MODE_REG);
789
790 /* Generate MAC address for WLAN and
791 * register our SPROM */
792#ifdef CONFIG_SSB_PCIHOST
793 if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
794 memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
795 memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
796 if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
797 printk(KERN_ERR "failed to register fallback SPROM\n");
798 }
799#endif
663} 800}
664 801
665/* 802/*
@@ -677,49 +814,6 @@ void __init board_setup(void)
677 panic("unexpected CPU for bcm963xx board"); 814 panic("unexpected CPU for bcm963xx board");
678} 815}
679 816
680/*
681 * return board name for /proc/cpuinfo
682 */
683const char *board_get_name(void)
684{
685 return board.name;
686}
687
688/*
689 * register & return a new board mac address
690 */
691static int board_get_mac_address(u8 *mac)
692{
693 u8 *p;
694 int count;
695
696 if (mac_addr_used >= nvram.mac_addr_count) {
697 printk(KERN_ERR PFX "not enough mac address\n");
698 return -ENODEV;
699 }
700
701 memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
702 p = mac + ETH_ALEN - 1;
703 count = mac_addr_used;
704
705 while (count--) {
706 do {
707 (*p)++;
708 if (*p != 0)
709 break;
710 p--;
711 } while (p != mac);
712 }
713
714 if (p == mac) {
715 printk(KERN_ERR PFX "unable to fetch mac address\n");
716 return -ENODEV;
717 }
718
719 mac_addr_used++;
720 return 0;
721}
722
723static struct mtd_partition mtd_partitions[] = { 817static struct mtd_partition mtd_partitions[] = {
724 { 818 {
725 .name = "cfe", 819 .name = "cfe",
@@ -751,33 +845,6 @@ static struct platform_device mtd_dev = {
751 }, 845 },
752}; 846};
753 847
754/*
755 * Register a sane SPROMv2 to make the on-board
756 * bcm4318 WLAN work
757 */
758#ifdef CONFIG_SSB_PCIHOST
759static struct ssb_sprom bcm63xx_sprom = {
760 .revision = 0x02,
761 .board_rev = 0x17,
762 .country_code = 0x0,
763 .ant_available_bg = 0x3,
764 .pa0b0 = 0x15ae,
765 .pa0b1 = 0xfa85,
766 .pa0b2 = 0xfe8d,
767 .pa1b0 = 0xffff,
768 .pa1b1 = 0xffff,
769 .pa1b2 = 0xffff,
770 .gpio0 = 0xff,
771 .gpio1 = 0xff,
772 .gpio2 = 0xff,
773 .gpio3 = 0xff,
774 .maxpwr_bg = 0x004c,
775 .itssi_bg = 0x00,
776 .boardflags_lo = 0x2848,
777 .boardflags_hi = 0x0000,
778};
779#endif
780
781static struct gpio_led_platform_data bcm63xx_led_data; 848static struct gpio_led_platform_data bcm63xx_led_data;
782 849
783static struct platform_device bcm63xx_gpio_leds = { 850static struct platform_device bcm63xx_gpio_leds = {
@@ -793,6 +860,12 @@ int __init board_register_devices(void)
793{ 860{
794 u32 val; 861 u32 val;
795 862
863 if (board.has_uart0)
864 bcm63xx_uart_register(0);
865
866 if (board.has_uart1)
867 bcm63xx_uart_register(1);
868
796 if (board.has_pccard) 869 if (board.has_pccard)
797 bcm63xx_pcmcia_register(); 870 bcm63xx_pcmcia_register();
798 871
@@ -807,17 +880,6 @@ int __init board_register_devices(void)
807 if (board.has_dsp) 880 if (board.has_dsp)
808 bcm63xx_dsp_register(&board.dsp); 881 bcm63xx_dsp_register(&board.dsp);
809 882
810 /* Generate MAC address for WLAN and
811 * register our SPROM */
812#ifdef CONFIG_SSB_PCIHOST
813 if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
814 memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
815 memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
816 if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
817 printk(KERN_ERR "failed to register fallback SPROM\n");
818 }
819#endif
820
821 /* read base address of boot chip select (0) */ 883 /* read base address of boot chip select (0) */
822 if (BCMCPU_IS_6345()) 884 if (BCMCPU_IS_6345())
823 val = 0x1fc00000; 885 val = 0x1fc00000;
@@ -837,4 +899,3 @@ int __init board_register_devices(void)
837 899
838 return 0; 900 return 0;
839} 901}
840