diff options
Diffstat (limited to 'arch/mips/bcm63xx/boards/board_bcm963xx.c')
-rw-r--r-- | arch/mips/bcm63xx/boards/board_bcm963xx.c | 231 |
1 files changed, 147 insertions, 84 deletions
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index ea17941168ca..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 = { | |||
126 | static struct board_info __initdata board_96345gw2 = { | 129 | static 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, |
@@ -349,9 +358,10 @@ static 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, |
@@ -368,10 +378,30 @@ static struct board_info __initdata board_FAST2404 = { | |||
368 | .has_ehci0 = 1, | 378 | .has_ehci0 = 1, |
369 | }; | 379 | }; |
370 | 380 | ||
381 | static struct board_info __initdata board_rta1025w_16 = { | ||
382 | .name = "RTA1025W_16", | ||
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 | }, | ||
397 | }; | ||
398 | |||
399 | |||
371 | static struct board_info __initdata board_DV201AMR = { | 400 | static struct board_info __initdata board_DV201AMR = { |
372 | .name = "DV201AMR", | 401 | .name = "DV201AMR", |
373 | .expected_cpu_id = 0x6348, | 402 | .expected_cpu_id = 0x6348, |
374 | 403 | ||
404 | .has_uart0 = 1, | ||
375 | .has_pci = 1, | 405 | .has_pci = 1, |
376 | .has_ohci0 = 1, | 406 | .has_ohci0 = 1, |
377 | 407 | ||
@@ -391,6 +421,7 @@ static struct board_info __initdata board_96348gw_a = { | |||
391 | .name = "96348GW-A", | 421 | .name = "96348GW-A", |
392 | .expected_cpu_id = 0x6348, | 422 | .expected_cpu_id = 0x6348, |
393 | 423 | ||
424 | .has_uart0 = 1, | ||
394 | .has_enet0 = 1, | 425 | .has_enet0 = 1, |
395 | .has_enet1 = 1, | 426 | .has_enet1 = 1, |
396 | .has_pci = 1, | 427 | .has_pci = 1, |
@@ -416,6 +447,7 @@ static struct board_info __initdata board_96358vw = { | |||
416 | .name = "96358VW", | 447 | .name = "96358VW", |
417 | .expected_cpu_id = 0x6358, | 448 | .expected_cpu_id = 0x6358, |
418 | 449 | ||
450 | .has_uart0 = 1, | ||
419 | .has_enet0 = 1, | 451 | .has_enet0 = 1, |
420 | .has_enet1 = 1, | 452 | .has_enet1 = 1, |
421 | .has_pci = 1, | 453 | .has_pci = 1, |
@@ -467,6 +499,7 @@ static struct board_info __initdata board_96358vw2 = { | |||
467 | .name = "96358VW2", | 499 | .name = "96358VW2", |
468 | .expected_cpu_id = 0x6358, | 500 | .expected_cpu_id = 0x6358, |
469 | 501 | ||
502 | .has_uart0 = 1, | ||
470 | .has_enet0 = 1, | 503 | .has_enet0 = 1, |
471 | .has_enet1 = 1, | 504 | .has_enet1 = 1, |
472 | .has_pci = 1, | 505 | .has_pci = 1, |
@@ -514,6 +547,7 @@ static struct board_info __initdata board_AGPFS0 = { | |||
514 | .name = "AGPF-S0", | 547 | .name = "AGPF-S0", |
515 | .expected_cpu_id = 0x6358, | 548 | .expected_cpu_id = 0x6358, |
516 | 549 | ||
550 | .has_uart0 = 1, | ||
517 | .has_enet0 = 1, | 551 | .has_enet0 = 1, |
518 | .has_enet1 = 1, | 552 | .has_enet1 = 1, |
519 | .has_pci = 1, | 553 | .has_pci = 1, |
@@ -531,6 +565,27 @@ static struct board_info __initdata board_AGPFS0 = { | |||
531 | .has_ohci0 = 1, | 565 | .has_ohci0 = 1, |
532 | .has_ehci0 = 1, | 566 | .has_ehci0 = 1, |
533 | }; | 567 | }; |
568 | |||
569 | static 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 | }; | ||
534 | #endif | 589 | #endif |
535 | 590 | ||
536 | /* | 591 | /* |
@@ -552,16 +607,88 @@ static const struct board_info __initdata *bcm963xx_boards[] = { | |||
552 | &board_FAST2404, | 607 | &board_FAST2404, |
553 | &board_DV201AMR, | 608 | &board_DV201AMR, |
554 | &board_96348gw_a, | 609 | &board_96348gw_a, |
610 | &board_rta1025w_16, | ||
555 | #endif | 611 | #endif |
556 | 612 | ||
557 | #ifdef CONFIG_BCM63XX_CPU_6358 | 613 | #ifdef CONFIG_BCM63XX_CPU_6358 |
558 | &board_96358vw, | 614 | &board_96358vw, |
559 | &board_96358vw2, | 615 | &board_96358vw2, |
560 | &board_AGPFS0, | 616 | &board_AGPFS0, |
617 | &board_DWVS0, | ||
561 | #endif | 618 | #endif |
562 | }; | 619 | }; |
563 | 620 | ||
564 | /* | 621 | /* |
622 | * Register a sane SPROMv2 to make the on-board | ||
623 | * bcm4318 WLAN work | ||
624 | */ | ||
625 | #ifdef CONFIG_SSB_PCIHOST | ||
626 | static 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 | */ | ||
651 | const char *board_get_name(void) | ||
652 | { | ||
653 | return board.name; | ||
654 | } | ||
655 | |||
656 | /* | ||
657 | * register & return a new board mac address | ||
658 | */ | ||
659 | static 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 | /* | ||
565 | * early init callback, read nvram data from flash and checksum it | 692 | * early init callback, read nvram data from flash and checksum it |
566 | */ | 693 | */ |
567 | void __init board_prom_init(void) | 694 | void __init board_prom_init(void) |
@@ -659,6 +786,17 @@ void __init board_prom_init(void) | |||
659 | } | 786 | } |
660 | 787 | ||
661 | 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 | ||
662 | } | 800 | } |
663 | 801 | ||
664 | /* | 802 | /* |
@@ -676,49 +814,6 @@ void __init board_setup(void) | |||
676 | panic("unexpected CPU for bcm963xx board"); | 814 | panic("unexpected CPU for bcm963xx board"); |
677 | } | 815 | } |
678 | 816 | ||
679 | /* | ||
680 | * return board name for /proc/cpuinfo | ||
681 | */ | ||
682 | const char *board_get_name(void) | ||
683 | { | ||
684 | return board.name; | ||
685 | } | ||
686 | |||
687 | /* | ||
688 | * register & return a new board mac address | ||
689 | */ | ||
690 | static int board_get_mac_address(u8 *mac) | ||
691 | { | ||
692 | u8 *p; | ||
693 | int count; | ||
694 | |||
695 | if (mac_addr_used >= nvram.mac_addr_count) { | ||
696 | printk(KERN_ERR PFX "not enough mac address\n"); | ||
697 | return -ENODEV; | ||
698 | } | ||
699 | |||
700 | memcpy(mac, nvram.mac_addr_base, ETH_ALEN); | ||
701 | p = mac + ETH_ALEN - 1; | ||
702 | count = mac_addr_used; | ||
703 | |||
704 | while (count--) { | ||
705 | do { | ||
706 | (*p)++; | ||
707 | if (*p != 0) | ||
708 | break; | ||
709 | p--; | ||
710 | } while (p != mac); | ||
711 | } | ||
712 | |||
713 | if (p == mac) { | ||
714 | printk(KERN_ERR PFX "unable to fetch mac address\n"); | ||
715 | return -ENODEV; | ||
716 | } | ||
717 | |||
718 | mac_addr_used++; | ||
719 | return 0; | ||
720 | } | ||
721 | |||
722 | static struct mtd_partition mtd_partitions[] = { | 817 | static struct mtd_partition mtd_partitions[] = { |
723 | { | 818 | { |
724 | .name = "cfe", | 819 | .name = "cfe", |
@@ -750,33 +845,6 @@ static struct platform_device mtd_dev = { | |||
750 | }, | 845 | }, |
751 | }; | 846 | }; |
752 | 847 | ||
753 | /* | ||
754 | * Register a sane SPROMv2 to make the on-board | ||
755 | * bcm4318 WLAN work | ||
756 | */ | ||
757 | #ifdef CONFIG_SSB_PCIHOST | ||
758 | static struct ssb_sprom bcm63xx_sprom = { | ||
759 | .revision = 0x02, | ||
760 | .board_rev = 0x17, | ||
761 | .country_code = 0x0, | ||
762 | .ant_available_bg = 0x3, | ||
763 | .pa0b0 = 0x15ae, | ||
764 | .pa0b1 = 0xfa85, | ||
765 | .pa0b2 = 0xfe8d, | ||
766 | .pa1b0 = 0xffff, | ||
767 | .pa1b1 = 0xffff, | ||
768 | .pa1b2 = 0xffff, | ||
769 | .gpio0 = 0xff, | ||
770 | .gpio1 = 0xff, | ||
771 | .gpio2 = 0xff, | ||
772 | .gpio3 = 0xff, | ||
773 | .maxpwr_bg = 0x004c, | ||
774 | .itssi_bg = 0x00, | ||
775 | .boardflags_lo = 0x2848, | ||
776 | .boardflags_hi = 0x0000, | ||
777 | }; | ||
778 | #endif | ||
779 | |||
780 | static struct gpio_led_platform_data bcm63xx_led_data; | 848 | static struct gpio_led_platform_data bcm63xx_led_data; |
781 | 849 | ||
782 | static struct platform_device bcm63xx_gpio_leds = { | 850 | static struct platform_device bcm63xx_gpio_leds = { |
@@ -792,6 +860,12 @@ int __init board_register_devices(void) | |||
792 | { | 860 | { |
793 | u32 val; | 861 | u32 val; |
794 | 862 | ||
863 | if (board.has_uart0) | ||
864 | bcm63xx_uart_register(0); | ||
865 | |||
866 | if (board.has_uart1) | ||
867 | bcm63xx_uart_register(1); | ||
868 | |||
795 | if (board.has_pccard) | 869 | if (board.has_pccard) |
796 | bcm63xx_pcmcia_register(); | 870 | bcm63xx_pcmcia_register(); |
797 | 871 | ||
@@ -806,17 +880,6 @@ int __init board_register_devices(void) | |||
806 | if (board.has_dsp) | 880 | if (board.has_dsp) |
807 | bcm63xx_dsp_register(&board.dsp); | 881 | bcm63xx_dsp_register(&board.dsp); |
808 | 882 | ||
809 | /* Generate MAC address for WLAN and | ||
810 | * register our SPROM */ | ||
811 | #ifdef CONFIG_SSB_PCIHOST | ||
812 | if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { | ||
813 | memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); | ||
814 | memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); | ||
815 | if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0) | ||
816 | printk(KERN_ERR "failed to register fallback SPROM\n"); | ||
817 | } | ||
818 | #endif | ||
819 | |||
820 | /* read base address of boot chip select (0) */ | 883 | /* read base address of boot chip select (0) */ |
821 | if (BCMCPU_IS_6345()) | 884 | if (BCMCPU_IS_6345()) |
822 | val = 0x1fc00000; | 885 | val = 0x1fc00000; |