aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm63xx
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/mips/bcm63xx
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/mips/bcm63xx')
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c257
-rw-r--r--arch/mips/bcm63xx/cpu.c5
-rw-r--r--arch/mips/bcm63xx/dev-uart.c66
-rw-r--r--arch/mips/bcm63xx/gpio.c4
-rw-r--r--arch/mips/bcm63xx/prom.c3
-rw-r--r--arch/mips/bcm63xx/timer.c34
6 files changed, 233 insertions, 136 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
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 70378bb5e3f9..cbb7caf86d77 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -36,6 +36,7 @@ static const unsigned long bcm96338_regs_base[] = {
36 [RSET_TIMER] = BCM_6338_TIMER_BASE, 36 [RSET_TIMER] = BCM_6338_TIMER_BASE,
37 [RSET_WDT] = BCM_6338_WDT_BASE, 37 [RSET_WDT] = BCM_6338_WDT_BASE,
38 [RSET_UART0] = BCM_6338_UART0_BASE, 38 [RSET_UART0] = BCM_6338_UART0_BASE,
39 [RSET_UART1] = BCM_6338_UART1_BASE,
39 [RSET_GPIO] = BCM_6338_GPIO_BASE, 40 [RSET_GPIO] = BCM_6338_GPIO_BASE,
40 [RSET_SPI] = BCM_6338_SPI_BASE, 41 [RSET_SPI] = BCM_6338_SPI_BASE,
41 [RSET_OHCI0] = BCM_6338_OHCI0_BASE, 42 [RSET_OHCI0] = BCM_6338_OHCI0_BASE,
@@ -72,6 +73,7 @@ static const unsigned long bcm96345_regs_base[] = {
72 [RSET_TIMER] = BCM_6345_TIMER_BASE, 73 [RSET_TIMER] = BCM_6345_TIMER_BASE,
73 [RSET_WDT] = BCM_6345_WDT_BASE, 74 [RSET_WDT] = BCM_6345_WDT_BASE,
74 [RSET_UART0] = BCM_6345_UART0_BASE, 75 [RSET_UART0] = BCM_6345_UART0_BASE,
76 [RSET_UART1] = BCM_6345_UART1_BASE,
75 [RSET_GPIO] = BCM_6345_GPIO_BASE, 77 [RSET_GPIO] = BCM_6345_GPIO_BASE,
76 [RSET_SPI] = BCM_6345_SPI_BASE, 78 [RSET_SPI] = BCM_6345_SPI_BASE,
77 [RSET_UDC0] = BCM_6345_UDC0_BASE, 79 [RSET_UDC0] = BCM_6345_UDC0_BASE,
@@ -109,6 +111,7 @@ static const unsigned long bcm96348_regs_base[] = {
109 [RSET_TIMER] = BCM_6348_TIMER_BASE, 111 [RSET_TIMER] = BCM_6348_TIMER_BASE,
110 [RSET_WDT] = BCM_6348_WDT_BASE, 112 [RSET_WDT] = BCM_6348_WDT_BASE,
111 [RSET_UART0] = BCM_6348_UART0_BASE, 113 [RSET_UART0] = BCM_6348_UART0_BASE,
114 [RSET_UART1] = BCM_6348_UART1_BASE,
112 [RSET_GPIO] = BCM_6348_GPIO_BASE, 115 [RSET_GPIO] = BCM_6348_GPIO_BASE,
113 [RSET_SPI] = BCM_6348_SPI_BASE, 116 [RSET_SPI] = BCM_6348_SPI_BASE,
114 [RSET_OHCI0] = BCM_6348_OHCI0_BASE, 117 [RSET_OHCI0] = BCM_6348_OHCI0_BASE,
@@ -150,6 +153,7 @@ static const unsigned long bcm96358_regs_base[] = {
150 [RSET_TIMER] = BCM_6358_TIMER_BASE, 153 [RSET_TIMER] = BCM_6358_TIMER_BASE,
151 [RSET_WDT] = BCM_6358_WDT_BASE, 154 [RSET_WDT] = BCM_6358_WDT_BASE,
152 [RSET_UART0] = BCM_6358_UART0_BASE, 155 [RSET_UART0] = BCM_6358_UART0_BASE,
156 [RSET_UART1] = BCM_6358_UART1_BASE,
153 [RSET_GPIO] = BCM_6358_GPIO_BASE, 157 [RSET_GPIO] = BCM_6358_GPIO_BASE,
154 [RSET_SPI] = BCM_6358_SPI_BASE, 158 [RSET_SPI] = BCM_6358_SPI_BASE,
155 [RSET_OHCI0] = BCM_6358_OHCI0_BASE, 159 [RSET_OHCI0] = BCM_6358_OHCI0_BASE,
@@ -170,6 +174,7 @@ static const unsigned long bcm96358_regs_base[] = {
170static const int bcm96358_irqs[] = { 174static const int bcm96358_irqs[] = {
171 [IRQ_TIMER] = BCM_6358_TIMER_IRQ, 175 [IRQ_TIMER] = BCM_6358_TIMER_IRQ,
172 [IRQ_UART0] = BCM_6358_UART0_IRQ, 176 [IRQ_UART0] = BCM_6358_UART0_IRQ,
177 [IRQ_UART1] = BCM_6358_UART1_IRQ,
173 [IRQ_DSL] = BCM_6358_DSL_IRQ, 178 [IRQ_DSL] = BCM_6358_DSL_IRQ,
174 [IRQ_ENET0] = BCM_6358_ENET0_IRQ, 179 [IRQ_ENET0] = BCM_6358_ENET0_IRQ,
175 [IRQ_ENET1] = BCM_6358_ENET1_IRQ, 180 [IRQ_ENET1] = BCM_6358_ENET1_IRQ,
diff --git a/arch/mips/bcm63xx/dev-uart.c b/arch/mips/bcm63xx/dev-uart.c
index b0519461ad9b..c2963da0253e 100644
--- a/arch/mips/bcm63xx/dev-uart.c
+++ b/arch/mips/bcm63xx/dev-uart.c
@@ -11,31 +11,65 @@
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <bcm63xx_cpu.h> 12#include <bcm63xx_cpu.h>
13 13
14static struct resource uart_resources[] = { 14static struct resource uart0_resources[] = {
15 { 15 {
16 .start = -1, /* filled at runtime */ 16 /* start & end filled at runtime */
17 .end = -1, /* filled at runtime */
18 .flags = IORESOURCE_MEM, 17 .flags = IORESOURCE_MEM,
19 }, 18 },
20 { 19 {
21 .start = -1, /* filled at runtime */ 20 /* start filled at runtime */
22 .flags = IORESOURCE_IRQ, 21 .flags = IORESOURCE_IRQ,
23 }, 22 },
24}; 23};
25 24
26static struct platform_device bcm63xx_uart_device = { 25static struct resource uart1_resources[] = {
27 .name = "bcm63xx_uart", 26 {
28 .id = 0, 27 /* start & end filled at runtime */
29 .num_resources = ARRAY_SIZE(uart_resources), 28 .flags = IORESOURCE_MEM,
30 .resource = uart_resources, 29 },
30 {
31 /* start filled at runtime */
32 .flags = IORESOURCE_IRQ,
33 },
34};
35
36static struct platform_device bcm63xx_uart_devices[] = {
37 {
38 .name = "bcm63xx_uart",
39 .id = 0,
40 .num_resources = ARRAY_SIZE(uart0_resources),
41 .resource = uart0_resources,
42 },
43
44 {
45 .name = "bcm63xx_uart",
46 .id = 1,
47 .num_resources = ARRAY_SIZE(uart1_resources),
48 .resource = uart1_resources,
49 }
31}; 50};
32 51
33int __init bcm63xx_uart_register(void) 52int __init bcm63xx_uart_register(unsigned int id)
34{ 53{
35 uart_resources[0].start = bcm63xx_regset_address(RSET_UART0); 54 if (id >= ARRAY_SIZE(bcm63xx_uart_devices))
36 uart_resources[0].end = uart_resources[0].start; 55 return -ENODEV;
37 uart_resources[0].end += RSET_UART_SIZE - 1; 56
38 uart_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0); 57 if (id == 1 && !BCMCPU_IS_6358())
39 return platform_device_register(&bcm63xx_uart_device); 58 return -ENODEV;
59
60 if (id == 0) {
61 uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0);
62 uart0_resources[0].end = uart0_resources[0].start +
63 RSET_UART_SIZE - 1;
64 uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
65 }
66
67 if (id == 1) {
68 uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1);
69 uart1_resources[0].end = uart1_resources[0].start +
70 RSET_UART_SIZE - 1;
71 uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1);
72 }
73
74 return platform_device_register(&bcm63xx_uart_devices[id]);
40} 75}
41arch_initcall(bcm63xx_uart_register);
diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
index 87ca39046334..315bc7f79ce1 100644
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
@@ -125,10 +125,10 @@ static struct gpio_chip bcm63xx_gpio_chip = {
125 125
126int __init bcm63xx_gpio_init(void) 126int __init bcm63xx_gpio_init(void)
127{ 127{
128 gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
129 gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
128 bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count(); 130 bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
129 pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio); 131 pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
130 132
131 return gpiochip_add(&bcm63xx_gpio_chip); 133 return gpiochip_add(&bcm63xx_gpio_chip);
132} 134}
133
134arch_initcall(bcm63xx_gpio_init);
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
index fb284fbc5853..be252efa0757 100644
--- a/arch/mips/bcm63xx/prom.c
+++ b/arch/mips/bcm63xx/prom.c
@@ -40,9 +40,6 @@ void __init prom_init(void)
40 reg &= ~mask; 40 reg &= ~mask;
41 bcm_perf_writel(reg, PERF_CKCTL_REG); 41 bcm_perf_writel(reg, PERF_CKCTL_REG);
42 42
43 /* assign command line from kernel config */
44 strcpy(arcs_cmdline, CONFIG_CMDLINE);
45
46 /* register gpiochip */ 43 /* register gpiochip */
47 bcm63xx_gpio_init(); 44 bcm63xx_gpio_init();
48 45
diff --git a/arch/mips/bcm63xx/timer.c b/arch/mips/bcm63xx/timer.c
index ba522bdcde4b..5f1135981568 100644
--- a/arch/mips/bcm63xx/timer.c
+++ b/arch/mips/bcm63xx/timer.c
@@ -17,8 +17,8 @@
17#include <bcm63xx_timer.h> 17#include <bcm63xx_timer.h>
18#include <bcm63xx_regs.h> 18#include <bcm63xx_regs.h>
19 19
20static DEFINE_SPINLOCK(timer_reg_lock); 20static DEFINE_RAW_SPINLOCK(timer_reg_lock);
21static DEFINE_SPINLOCK(timer_data_lock); 21static DEFINE_RAW_SPINLOCK(timer_data_lock);
22static struct clk *periph_clk; 22static struct clk *periph_clk;
23 23
24static struct timer_data { 24static struct timer_data {
@@ -31,23 +31,23 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
31 u32 stat; 31 u32 stat;
32 int i; 32 int i;
33 33
34 spin_lock(&timer_reg_lock); 34 raw_spin_lock(&timer_reg_lock);
35 stat = bcm_timer_readl(TIMER_IRQSTAT_REG); 35 stat = bcm_timer_readl(TIMER_IRQSTAT_REG);
36 bcm_timer_writel(stat, TIMER_IRQSTAT_REG); 36 bcm_timer_writel(stat, TIMER_IRQSTAT_REG);
37 spin_unlock(&timer_reg_lock); 37 raw_spin_unlock(&timer_reg_lock);
38 38
39 for (i = 0; i < BCM63XX_TIMER_COUNT; i++) { 39 for (i = 0; i < BCM63XX_TIMER_COUNT; i++) {
40 if (!(stat & TIMER_IRQSTAT_TIMER_CAUSE(i))) 40 if (!(stat & TIMER_IRQSTAT_TIMER_CAUSE(i)))
41 continue; 41 continue;
42 42
43 spin_lock(&timer_data_lock); 43 raw_spin_lock(&timer_data_lock);
44 if (!timer_data[i].cb) { 44 if (!timer_data[i].cb) {
45 spin_unlock(&timer_data_lock); 45 raw_spin_unlock(&timer_data_lock);
46 continue; 46 continue;
47 } 47 }
48 48
49 timer_data[i].cb(timer_data[i].data); 49 timer_data[i].cb(timer_data[i].data);
50 spin_unlock(&timer_data_lock); 50 raw_spin_unlock(&timer_data_lock);
51 } 51 }
52 52
53 return IRQ_HANDLED; 53 return IRQ_HANDLED;
@@ -61,7 +61,7 @@ int bcm63xx_timer_enable(int id)
61 if (id >= BCM63XX_TIMER_COUNT) 61 if (id >= BCM63XX_TIMER_COUNT)
62 return -EINVAL; 62 return -EINVAL;
63 63
64 spin_lock_irqsave(&timer_reg_lock, flags); 64 raw_spin_lock_irqsave(&timer_reg_lock, flags);
65 65
66 reg = bcm_timer_readl(TIMER_CTLx_REG(id)); 66 reg = bcm_timer_readl(TIMER_CTLx_REG(id));
67 reg |= TIMER_CTL_ENABLE_MASK; 67 reg |= TIMER_CTL_ENABLE_MASK;
@@ -71,7 +71,7 @@ int bcm63xx_timer_enable(int id)
71 reg |= TIMER_IRQSTAT_TIMER_IR_EN(id); 71 reg |= TIMER_IRQSTAT_TIMER_IR_EN(id);
72 bcm_timer_writel(reg, TIMER_IRQSTAT_REG); 72 bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
73 73
74 spin_unlock_irqrestore(&timer_reg_lock, flags); 74 raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
75 return 0; 75 return 0;
76} 76}
77 77
@@ -85,7 +85,7 @@ int bcm63xx_timer_disable(int id)
85 if (id >= BCM63XX_TIMER_COUNT) 85 if (id >= BCM63XX_TIMER_COUNT)
86 return -EINVAL; 86 return -EINVAL;
87 87
88 spin_lock_irqsave(&timer_reg_lock, flags); 88 raw_spin_lock_irqsave(&timer_reg_lock, flags);
89 89
90 reg = bcm_timer_readl(TIMER_CTLx_REG(id)); 90 reg = bcm_timer_readl(TIMER_CTLx_REG(id));
91 reg &= ~TIMER_CTL_ENABLE_MASK; 91 reg &= ~TIMER_CTL_ENABLE_MASK;
@@ -95,7 +95,7 @@ int bcm63xx_timer_disable(int id)
95 reg &= ~TIMER_IRQSTAT_TIMER_IR_EN(id); 95 reg &= ~TIMER_IRQSTAT_TIMER_IR_EN(id);
96 bcm_timer_writel(reg, TIMER_IRQSTAT_REG); 96 bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
97 97
98 spin_unlock_irqrestore(&timer_reg_lock, flags); 98 raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
99 return 0; 99 return 0;
100} 100}
101 101
@@ -110,7 +110,7 @@ int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data)
110 return -EINVAL; 110 return -EINVAL;
111 111
112 ret = 0; 112 ret = 0;
113 spin_lock_irqsave(&timer_data_lock, flags); 113 raw_spin_lock_irqsave(&timer_data_lock, flags);
114 if (timer_data[id].cb) { 114 if (timer_data[id].cb) {
115 ret = -EBUSY; 115 ret = -EBUSY;
116 goto out; 116 goto out;
@@ -120,7 +120,7 @@ int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data)
120 timer_data[id].data = data; 120 timer_data[id].data = data;
121 121
122out: 122out:
123 spin_unlock_irqrestore(&timer_data_lock, flags); 123 raw_spin_unlock_irqrestore(&timer_data_lock, flags);
124 return ret; 124 return ret;
125} 125}
126 126
@@ -133,9 +133,9 @@ void bcm63xx_timer_unregister(int id)
133 if (id >= BCM63XX_TIMER_COUNT) 133 if (id >= BCM63XX_TIMER_COUNT)
134 return; 134 return;
135 135
136 spin_lock_irqsave(&timer_data_lock, flags); 136 raw_spin_lock_irqsave(&timer_data_lock, flags);
137 timer_data[id].cb = NULL; 137 timer_data[id].cb = NULL;
138 spin_unlock_irqrestore(&timer_data_lock, flags); 138 raw_spin_unlock_irqrestore(&timer_data_lock, flags);
139} 139}
140 140
141EXPORT_SYMBOL(bcm63xx_timer_unregister); 141EXPORT_SYMBOL(bcm63xx_timer_unregister);
@@ -159,7 +159,7 @@ int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us)
159 if (countdown & ~TIMER_CTL_COUNTDOWN_MASK) 159 if (countdown & ~TIMER_CTL_COUNTDOWN_MASK)
160 return -EINVAL; 160 return -EINVAL;
161 161
162 spin_lock_irqsave(&timer_reg_lock, flags); 162 raw_spin_lock_irqsave(&timer_reg_lock, flags);
163 reg = bcm_timer_readl(TIMER_CTLx_REG(id)); 163 reg = bcm_timer_readl(TIMER_CTLx_REG(id));
164 164
165 if (monotonic) 165 if (monotonic)
@@ -171,7 +171,7 @@ int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us)
171 reg |= countdown; 171 reg |= countdown;
172 bcm_timer_writel(reg, TIMER_CTLx_REG(id)); 172 bcm_timer_writel(reg, TIMER_CTLx_REG(id));
173 173
174 spin_unlock_irqrestore(&timer_reg_lock, flags); 174 raw_spin_unlock_irqrestore(&timer_reg_lock, flags);
175 return 0; 175 return 0;
176} 176}
177 177