aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig8
-rw-r--r--arch/mips/alchemy/devboards/db1200/platform.c16
-rw-r--r--arch/mips/alchemy/devboards/db1x00/platform.c47
-rw-r--r--arch/mips/bcm47xx/Kconfig31
-rw-r--r--arch/mips/bcm47xx/Makefile3
-rw-r--r--arch/mips/bcm47xx/gpio.c82
-rw-r--r--arch/mips/bcm47xx/irq.c12
-rw-r--r--arch/mips/bcm47xx/nvram.c29
-rw-r--r--arch/mips/bcm47xx/serial.c46
-rw-r--r--arch/mips/bcm47xx/setup.c90
-rw-r--r--arch/mips/bcm47xx/time.c16
-rw-r--r--arch/mips/bcm47xx/wgt634u.c14
-rw-r--r--arch/mips/include/asm/compat.h3
-rw-r--r--arch/mips/include/asm/lasat/lasat.h6
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_psc.h13
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h26
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/gpio.h108
-rw-r--r--arch/mips/pci/pci-bcm47xx.c6
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_serial.c73
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c2
20 files changed, 540 insertions, 91 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a9264843824..62b9677c39a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -94,15 +94,8 @@ config BCM47XX
94 select DMA_NONCOHERENT 94 select DMA_NONCOHERENT
95 select HW_HAS_PCI 95 select HW_HAS_PCI
96 select IRQ_CPU 96 select IRQ_CPU
97 select SYS_HAS_CPU_MIPS32_R1
98 select SYS_SUPPORTS_32BIT_KERNEL 97 select SYS_SUPPORTS_32BIT_KERNEL
99 select SYS_SUPPORTS_LITTLE_ENDIAN 98 select SYS_SUPPORTS_LITTLE_ENDIAN
100 select SSB
101 select SSB_DRIVER_MIPS
102 select SSB_DRIVER_EXTIF
103 select SSB_EMBEDDED
104 select SSB_B43_PCI_BRIDGE if PCI
105 select SSB_PCICORE_HOSTMODE if PCI
106 select GENERIC_GPIO 99 select GENERIC_GPIO
107 select SYS_HAS_EARLY_PRINTK 100 select SYS_HAS_EARLY_PRINTK
108 select CFE 101 select CFE
@@ -794,6 +787,7 @@ endchoice
794 787
795source "arch/mips/alchemy/Kconfig" 788source "arch/mips/alchemy/Kconfig"
796source "arch/mips/ath79/Kconfig" 789source "arch/mips/ath79/Kconfig"
790source "arch/mips/bcm47xx/Kconfig"
797source "arch/mips/bcm63xx/Kconfig" 791source "arch/mips/bcm63xx/Kconfig"
798source "arch/mips/jazz/Kconfig" 792source "arch/mips/jazz/Kconfig"
799source "arch/mips/jz4740/Kconfig" 793source "arch/mips/jz4740/Kconfig"
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c
index aae08c1e876..c61867c93c4 100644
--- a/arch/mips/alchemy/devboards/db1200/platform.c
+++ b/arch/mips/alchemy/devboards/db1200/platform.c
@@ -489,6 +489,7 @@ static struct resource au1200_psc1_res[] = {
489 }, 489 },
490}; 490};
491 491
492/* AC97 or I2S device */
492static struct platform_device db1200_audio_dev = { 493static struct platform_device db1200_audio_dev = {
493 /* name assigned later based on switch setting */ 494 /* name assigned later based on switch setting */
494 .id = 1, /* PSC ID */ 495 .id = 1, /* PSC ID */
@@ -496,11 +497,22 @@ static struct platform_device db1200_audio_dev = {
496 .resource = au1200_psc1_res, 497 .resource = au1200_psc1_res,
497}; 498};
498 499
500/* DB1200 ASoC card device */
501static struct platform_device db1200_sound_dev = {
502 /* name assigned later based on switch setting */
503 .id = 1, /* PSC ID */
504};
505
499static struct platform_device db1200_stac_dev = { 506static struct platform_device db1200_stac_dev = {
500 .name = "ac97-codec", 507 .name = "ac97-codec",
501 .id = 1, /* on PSC1 */ 508 .id = 1, /* on PSC1 */
502}; 509};
503 510
511static struct platform_device db1200_audiodma_dev = {
512 .name = "au1xpsc-pcm",
513 .id = 1, /* PSC ID */
514};
515
504static struct platform_device *db1200_devs[] __initdata = { 516static struct platform_device *db1200_devs[] __initdata = {
505 NULL, /* PSC0, selected by S6.8 */ 517 NULL, /* PSC0, selected by S6.8 */
506 &db1200_ide_dev, 518 &db1200_ide_dev,
@@ -509,8 +521,10 @@ static struct platform_device *db1200_devs[] __initdata = {
509 &db1200_eth_dev, 521 &db1200_eth_dev,
510 &db1200_rtc_dev, 522 &db1200_rtc_dev,
511 &db1200_nand_dev, 523 &db1200_nand_dev,
524 &db1200_audiodma_dev,
512 &db1200_audio_dev, 525 &db1200_audio_dev,
513 &db1200_stac_dev, 526 &db1200_stac_dev,
527 &db1200_sound_dev,
514}; 528};
515 529
516static int __init db1200_dev_init(void) 530static int __init db1200_dev_init(void)
@@ -570,10 +584,12 @@ static int __init db1200_dev_init(void)
570 if (sw == BCSR_SWITCHES_DIP_8) { 584 if (sw == BCSR_SWITCHES_DIP_8) {
571 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX); 585 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX);
572 db1200_audio_dev.name = "au1xpsc_i2s"; 586 db1200_audio_dev.name = "au1xpsc_i2s";
587 db1200_sound_dev.name = "db1200-i2s";
573 printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n"); 588 printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n");
574 } else { 589 } else {
575 bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0); 590 bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0);
576 db1200_audio_dev.name = "au1xpsc_ac97"; 591 db1200_audio_dev.name = "au1xpsc_ac97";
592 db1200_sound_dev.name = "db1200-ac97";
577 printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n"); 593 printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n");
578 } 594 }
579 595
diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c
index 8704865306a..9e6b3d442ac 100644
--- a/arch/mips/alchemy/devboards/db1x00/platform.c
+++ b/arch/mips/alchemy/devboards/db1x00/platform.c
@@ -19,10 +19,12 @@
19 */ 19 */
20 20
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/interrupt.h>
22#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24 25
25#include <asm/mach-au1x00/au1000.h> 26#include <asm/mach-au1x00/au1000.h>
27#include <asm/mach-au1x00/au1000_dma.h>
26#include <asm/mach-db1x00/bcsr.h> 28#include <asm/mach-db1x00/bcsr.h>
27#include "../platform.h" 29#include "../platform.h"
28 30
@@ -237,6 +239,45 @@ static struct platform_device au1100_lcd_device = {
237}; 239};
238#endif 240#endif
239 241
242static struct resource alchemy_ac97c_res[] = {
243 [0] = {
244 .start = AU1000_AC97_PHYS_ADDR,
245 .end = AU1000_AC97_PHYS_ADDR + 0xfff,
246 .flags = IORESOURCE_MEM,
247 },
248 [1] = {
249 .start = DMA_ID_AC97C_TX,
250 .end = DMA_ID_AC97C_TX,
251 .flags = IORESOURCE_DMA,
252 },
253 [2] = {
254 .start = DMA_ID_AC97C_RX,
255 .end = DMA_ID_AC97C_RX,
256 .flags = IORESOURCE_DMA,
257 },
258};
259
260static struct platform_device alchemy_ac97c_dev = {
261 .name = "alchemy-ac97c",
262 .id = -1,
263 .resource = alchemy_ac97c_res,
264 .num_resources = ARRAY_SIZE(alchemy_ac97c_res),
265};
266
267static struct platform_device alchemy_ac97c_dma_dev = {
268 .name = "alchemy-pcm-dma",
269 .id = 0,
270};
271
272static struct platform_device db1x00_codec_dev = {
273 .name = "ac97-codec",
274 .id = -1,
275};
276
277static struct platform_device db1x00_audio_dev = {
278 .name = "db1000-audio",
279};
280
240static int __init db1xxx_dev_init(void) 281static int __init db1xxx_dev_init(void)
241{ 282{
242#ifdef DB1XXX_HAS_PCMCIA 283#ifdef DB1XXX_HAS_PCMCIA
@@ -264,6 +305,12 @@ static int __init db1xxx_dev_init(void)
264 platform_device_register(&au1100_lcd_device); 305 platform_device_register(&au1100_lcd_device);
265#endif 306#endif
266 db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED); 307 db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED);
308
309 platform_device_register(&db1x00_codec_dev);
310 platform_device_register(&alchemy_ac97c_dma_dev);
311 platform_device_register(&alchemy_ac97c_dev);
312 platform_device_register(&db1x00_audio_dev);
313
267 return 0; 314 return 0;
268} 315}
269device_initcall(db1xxx_dev_init); 316device_initcall(db1xxx_dev_init);
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
new file mode 100644
index 00000000000..6210b8d8410
--- /dev/null
+++ b/arch/mips/bcm47xx/Kconfig
@@ -0,0 +1,31 @@
1if BCM47XX
2
3config BCM47XX_SSB
4 bool "SSB Support for Broadcom BCM47XX"
5 select SYS_HAS_CPU_MIPS32_R1
6 select SSB
7 select SSB_DRIVER_MIPS
8 select SSB_DRIVER_EXTIF
9 select SSB_EMBEDDED
10 select SSB_B43_PCI_BRIDGE if PCI
11 select SSB_PCICORE_HOSTMODE if PCI
12 default y
13 help
14 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
15
16 This will generate an image with support for SSB and MIPS32 R1 instruction set.
17
18config BCM47XX_BCMA
19 bool "BCMA Support for Broadcom BCM47XX"
20 select SYS_HAS_CPU_MIPS32_R2
21 select BCMA
22 select BCMA_HOST_SOC
23 select BCMA_DRIVER_MIPS
24 select BCMA_DRIVER_PCI_HOSTMODE if PCI
25 default y
26 help
27 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
28
29 This will generate an image with support for BCMA and MIPS32 R2 instruction set.
30
31endif
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
index 7465e8a72d9..4add17349ff 100644
--- a/arch/mips/bcm47xx/Makefile
+++ b/arch/mips/bcm47xx/Makefile
@@ -3,4 +3,5 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o 6obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o
7obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
diff --git a/arch/mips/bcm47xx/gpio.c b/arch/mips/bcm47xx/gpio.c
index e4a5ee9c972..57b425fd4d4 100644
--- a/arch/mips/bcm47xx/gpio.c
+++ b/arch/mips/bcm47xx/gpio.c
@@ -20,42 +20,82 @@ static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
20 20
21int gpio_request(unsigned gpio, const char *tag) 21int gpio_request(unsigned gpio, const char *tag)
22{ 22{
23 if (ssb_chipco_available(&ssb_bcm47xx.chipco) && 23 switch (bcm47xx_bus_type) {
24 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) 24#ifdef CONFIG_BCM47XX_SSB
25 return -EINVAL; 25 case BCM47XX_BUS_TYPE_SSB:
26 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
27 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
28 return -EINVAL;
26 29
27 if (ssb_extif_available(&ssb_bcm47xx.extif) && 30 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
28 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES)) 31 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
29 return -EINVAL; 32 return -EINVAL;
30 33
31 if (test_and_set_bit(gpio, gpio_in_use)) 34 if (test_and_set_bit(gpio, gpio_in_use))
32 return -EBUSY; 35 return -EBUSY;
33 36
34 return 0; 37 return 0;
38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 case BCM47XX_BUS_TYPE_BCMA:
41 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
42 return -EINVAL;
43
44 if (test_and_set_bit(gpio, gpio_in_use))
45 return -EBUSY;
46
47 return 0;
48#endif
49 }
50 return -EINVAL;
35} 51}
36EXPORT_SYMBOL(gpio_request); 52EXPORT_SYMBOL(gpio_request);
37 53
38void gpio_free(unsigned gpio) 54void gpio_free(unsigned gpio)
39{ 55{
40 if (ssb_chipco_available(&ssb_bcm47xx.chipco) && 56 switch (bcm47xx_bus_type) {
41 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) 57#ifdef CONFIG_BCM47XX_SSB
42 return; 58 case BCM47XX_BUS_TYPE_SSB:
59 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
60 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
61 return;
62
63 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
64 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
65 return;
43 66
44 if (ssb_extif_available(&ssb_bcm47xx.extif) && 67 clear_bit(gpio, gpio_in_use);
45 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
46 return; 68 return;
69#endif
70#ifdef CONFIG_BCM47XX_BCMA
71 case BCM47XX_BUS_TYPE_BCMA:
72 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
73 return;
47 74
48 clear_bit(gpio, gpio_in_use); 75 clear_bit(gpio, gpio_in_use);
76 return;
77#endif
78 }
49} 79}
50EXPORT_SYMBOL(gpio_free); 80EXPORT_SYMBOL(gpio_free);
51 81
52int gpio_to_irq(unsigned gpio) 82int gpio_to_irq(unsigned gpio)
53{ 83{
54 if (ssb_chipco_available(&ssb_bcm47xx.chipco)) 84 switch (bcm47xx_bus_type) {
55 return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2; 85#ifdef CONFIG_BCM47XX_SSB
56 else if (ssb_extif_available(&ssb_bcm47xx.extif)) 86 case BCM47XX_BUS_TYPE_SSB:
57 return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2; 87 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
58 else 88 return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
59 return -EINVAL; 89 else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
90 return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
91 else
92 return -EINVAL;
93#endif
94#ifdef CONFIG_BCM47XX_BCMA
95 case BCM47XX_BUS_TYPE_BCMA:
96 return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2;
97#endif
98 }
99 return -EINVAL;
60} 100}
61EXPORT_SYMBOL_GPL(gpio_to_irq); 101EXPORT_SYMBOL_GPL(gpio_to_irq);
diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
index 325757acd02..8cf3833b2d2 100644
--- a/arch/mips/bcm47xx/irq.c
+++ b/arch/mips/bcm47xx/irq.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <asm/irq_cpu.h> 28#include <asm/irq_cpu.h>
29#include <bcm47xx.h>
29 30
30void plat_irq_dispatch(void) 31void plat_irq_dispatch(void)
31{ 32{
@@ -51,5 +52,16 @@ void plat_irq_dispatch(void)
51 52
52void __init arch_init_irq(void) 53void __init arch_init_irq(void)
53{ 54{
55#ifdef CONFIG_BCM47XX_BCMA
56 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {
57 bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,
58 BCMA_MIPS_MIPS74K_INTMASK(5), 1 << 31);
59 /*
60 * the kernel reads the timer irq from some register and thinks
61 * it's #5, but we offset it by 2 and route to #7
62 */
63 cp0_compare_irq = 7;
64 }
65#endif
54 mips_cpu_irq_init(); 66 mips_cpu_irq_init();
55} 67}
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 54db815bc86..a84e3bb7387 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -26,14 +26,35 @@ static char nvram_buf[NVRAM_SPACE];
26/* Probe for NVRAM header */ 26/* Probe for NVRAM header */
27static void early_nvram_init(void) 27static void early_nvram_init(void)
28{ 28{
29 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 29#ifdef CONFIG_BCM47XX_SSB
30 struct ssb_mipscore *mcore_ssb;
31#endif
32#ifdef CONFIG_BCM47XX_BCMA
33 struct bcma_drv_cc *bcma_cc;
34#endif
30 struct nvram_header *header; 35 struct nvram_header *header;
31 int i; 36 int i;
32 u32 base, lim, off; 37 u32 base = 0;
38 u32 lim = 0;
39 u32 off;
33 u32 *src, *dst; 40 u32 *src, *dst;
34 41
35 base = mcore->flash_window; 42 switch (bcm47xx_bus_type) {
36 lim = mcore->flash_window_size; 43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 mcore_ssb = &bcm47xx_bus.ssb.mipscore;
46 base = mcore_ssb->flash_window;
47 lim = mcore_ssb->flash_window_size;
48 break;
49#endif
50#ifdef CONFIG_BCM47XX_BCMA
51 case BCM47XX_BUS_TYPE_BCMA:
52 bcma_cc = &bcm47xx_bus.bcma.bus.drv_cc;
53 base = bcma_cc->pflash.window;
54 lim = bcma_cc->pflash.window_size;
55 break;
56#endif
57 }
37 58
38 off = FLASH_MIN; 59 off = FLASH_MIN;
39 while (off <= lim) { 60 while (off <= lim) {
diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
index 59c11afdb2a..57981e4fe2b 100644
--- a/arch/mips/bcm47xx/serial.c
+++ b/arch/mips/bcm47xx/serial.c
@@ -23,10 +23,11 @@ static struct platform_device uart8250_device = {
23 }, 23 },
24}; 24};
25 25
26static int __init uart8250_init(void) 26#ifdef CONFIG_BCM47XX_SSB
27static int __init uart8250_init_ssb(void)
27{ 28{
28 int i; 29 int i;
29 struct ssb_mipscore *mcore = &(ssb_bcm47xx.mipscore); 30 struct ssb_mipscore *mcore = &(bcm47xx_bus.ssb.mipscore);
30 31
31 memset(&uart8250_data, 0, sizeof(uart8250_data)); 32 memset(&uart8250_data, 0, sizeof(uart8250_data));
32 33
@@ -44,6 +45,47 @@ static int __init uart8250_init(void)
44 } 45 }
45 return platform_device_register(&uart8250_device); 46 return platform_device_register(&uart8250_device);
46} 47}
48#endif
49
50#ifdef CONFIG_BCM47XX_BCMA
51static int __init uart8250_init_bcma(void)
52{
53 int i;
54 struct bcma_drv_cc *cc = &(bcm47xx_bus.bcma.bus.drv_cc);
55
56 memset(&uart8250_data, 0, sizeof(uart8250_data));
57
58 for (i = 0; i < cc->nr_serial_ports; i++) {
59 struct plat_serial8250_port *p = &(uart8250_data[i]);
60 struct bcma_serial_port *bcma_port;
61 bcma_port = &(cc->serial_ports[i]);
62
63 p->mapbase = (unsigned int) bcma_port->regs;
64 p->membase = (void *) bcma_port->regs;
65 p->irq = bcma_port->irq + 2;
66 p->uartclk = bcma_port->baud_base;
67 p->regshift = bcma_port->reg_shift;
68 p->iotype = UPIO_MEM;
69 p->flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
70 }
71 return platform_device_register(&uart8250_device);
72}
73#endif
74
75static int __init uart8250_init(void)
76{
77 switch (bcm47xx_bus_type) {
78#ifdef CONFIG_BCM47XX_SSB
79 case BCM47XX_BUS_TYPE_SSB:
80 return uart8250_init_ssb();
81#endif
82#ifdef CONFIG_BCM47XX_BCMA
83 case BCM47XX_BUS_TYPE_BCMA:
84 return uart8250_init_bcma();
85#endif
86 }
87 return -EINVAL;
88}
47 89
48module_init(uart8250_init); 90module_init(uart8250_init);
49 91
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index cfae81571de..17c3d14d7c4 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -29,21 +29,36 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/ssb/ssb.h> 30#include <linux/ssb/ssb.h>
31#include <linux/ssb/ssb_embedded.h> 31#include <linux/ssb/ssb_embedded.h>
32#include <linux/bcma/bcma_soc.h>
32#include <asm/bootinfo.h> 33#include <asm/bootinfo.h>
33#include <asm/reboot.h> 34#include <asm/reboot.h>
34#include <asm/time.h> 35#include <asm/time.h>
35#include <bcm47xx.h> 36#include <bcm47xx.h>
36#include <asm/mach-bcm47xx/nvram.h> 37#include <asm/mach-bcm47xx/nvram.h>
37 38
38struct ssb_bus ssb_bcm47xx; 39union bcm47xx_bus bcm47xx_bus;
39EXPORT_SYMBOL(ssb_bcm47xx); 40EXPORT_SYMBOL(bcm47xx_bus);
41
42enum bcm47xx_bus_type bcm47xx_bus_type;
43EXPORT_SYMBOL(bcm47xx_bus_type);
40 44
41static void bcm47xx_machine_restart(char *command) 45static void bcm47xx_machine_restart(char *command)
42{ 46{
43 printk(KERN_ALERT "Please stand by while rebooting the system...\n"); 47 printk(KERN_ALERT "Please stand by while rebooting the system...\n");
44 local_irq_disable(); 48 local_irq_disable();
45 /* Set the watchdog timer to reset immediately */ 49 /* Set the watchdog timer to reset immediately */
46 ssb_watchdog_timer_set(&ssb_bcm47xx, 1); 50 switch (bcm47xx_bus_type) {
51#ifdef CONFIG_BCM47XX_SSB
52 case BCM47XX_BUS_TYPE_SSB:
53 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
54 break;
55#endif
56#ifdef CONFIG_BCM47XX_BCMA
57 case BCM47XX_BUS_TYPE_BCMA:
58 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1);
59 break;
60#endif
61 }
47 while (1) 62 while (1)
48 cpu_relax(); 63 cpu_relax();
49} 64}
@@ -52,11 +67,23 @@ static void bcm47xx_machine_halt(void)
52{ 67{
53 /* Disable interrupts and watchdog and spin forever */ 68 /* Disable interrupts and watchdog and spin forever */
54 local_irq_disable(); 69 local_irq_disable();
55 ssb_watchdog_timer_set(&ssb_bcm47xx, 0); 70 switch (bcm47xx_bus_type) {
71#ifdef CONFIG_BCM47XX_SSB
72 case BCM47XX_BUS_TYPE_SSB:
73 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0);
74 break;
75#endif
76#ifdef CONFIG_BCM47XX_BCMA
77 case BCM47XX_BUS_TYPE_BCMA:
78 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 0);
79 break;
80#endif
81 }
56 while (1) 82 while (1)
57 cpu_relax(); 83 cpu_relax();
58} 84}
59 85
86#ifdef CONFIG_BCM47XX_SSB
60#define READ_FROM_NVRAM(_outvar, name, buf) \ 87#define READ_FROM_NVRAM(_outvar, name, buf) \
61 if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\ 88 if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
62 sprom->_outvar = simple_strtoul(buf, NULL, 0); 89 sprom->_outvar = simple_strtoul(buf, NULL, 0);
@@ -247,7 +274,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
247 return 0; 274 return 0;
248} 275}
249 276
250void __init plat_mem_setup(void) 277static void __init bcm47xx_register_ssb(void)
251{ 278{
252 int err; 279 int err;
253 char buf[100]; 280 char buf[100];
@@ -258,12 +285,12 @@ void __init plat_mem_setup(void)
258 printk(KERN_WARNING "bcm47xx: someone else already registered" 285 printk(KERN_WARNING "bcm47xx: someone else already registered"
259 " a ssb SPROM callback handler (err %d)\n", err); 286 " a ssb SPROM callback handler (err %d)\n", err);
260 287
261 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, 288 err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE,
262 bcm47xx_get_invariants); 289 bcm47xx_get_invariants);
263 if (err) 290 if (err)
264 panic("Failed to initialize SSB bus (err %d)\n", err); 291 panic("Failed to initialize SSB bus (err %d)\n", err);
265 292
266 mcore = &ssb_bcm47xx.mipscore; 293 mcore = &bcm47xx_bus.ssb.mipscore;
267 if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) { 294 if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
268 if (strstr(buf, "console=ttyS1")) { 295 if (strstr(buf, "console=ttyS1")) {
269 struct ssb_serial_port port; 296 struct ssb_serial_port port;
@@ -276,8 +303,57 @@ void __init plat_mem_setup(void)
276 memcpy(&mcore->serial_ports[1], &port, sizeof(port)); 303 memcpy(&mcore->serial_ports[1], &port, sizeof(port));
277 } 304 }
278 } 305 }
306}
307#endif
308
309#ifdef CONFIG_BCM47XX_BCMA
310static void __init bcm47xx_register_bcma(void)
311{
312 int err;
313
314 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
315 if (err)
316 panic("Failed to initialize BCMA bus (err %d)\n", err);
317}
318#endif
319
320void __init plat_mem_setup(void)
321{
322 struct cpuinfo_mips *c = &current_cpu_data;
323
324 if (c->cputype == CPU_74K) {
325 printk(KERN_INFO "bcm47xx: using bcma bus\n");
326#ifdef CONFIG_BCM47XX_BCMA
327 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
328 bcm47xx_register_bcma();
329#endif
330 } else {
331 printk(KERN_INFO "bcm47xx: using ssb bus\n");
332#ifdef CONFIG_BCM47XX_SSB
333 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
334 bcm47xx_register_ssb();
335#endif
336 }
279 337
280 _machine_restart = bcm47xx_machine_restart; 338 _machine_restart = bcm47xx_machine_restart;
281 _machine_halt = bcm47xx_machine_halt; 339 _machine_halt = bcm47xx_machine_halt;
282 pm_power_off = bcm47xx_machine_halt; 340 pm_power_off = bcm47xx_machine_halt;
283} 341}
342
343static int __init bcm47xx_register_bus_complete(void)
344{
345 switch (bcm47xx_bus_type) {
346#ifdef CONFIG_BCM47XX_SSB
347 case BCM47XX_BUS_TYPE_SSB:
348 /* Nothing to do */
349 break;
350#endif
351#ifdef CONFIG_BCM47XX_BCMA
352 case BCM47XX_BUS_TYPE_BCMA:
353 bcma_bus_register(&bcm47xx_bus.bcma.bus);
354 break;
355#endif
356 }
357 return 0;
358}
359device_initcall(bcm47xx_register_bus_complete);
diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
index 0c6f47b3fd9..536374dcba7 100644
--- a/arch/mips/bcm47xx/time.c
+++ b/arch/mips/bcm47xx/time.c
@@ -30,7 +30,7 @@
30 30
31void __init plat_time_init(void) 31void __init plat_time_init(void)
32{ 32{
33 unsigned long hz; 33 unsigned long hz = 0;
34 34
35 /* 35 /*
36 * Use deterministic values for initial counter interrupt 36 * Use deterministic values for initial counter interrupt
@@ -39,7 +39,19 @@ void __init plat_time_init(void)
39 write_c0_count(0); 39 write_c0_count(0);
40 write_c0_compare(0xffff); 40 write_c0_compare(0xffff);
41 41
42 hz = ssb_cpu_clock(&ssb_bcm47xx.mipscore) / 2; 42 switch (bcm47xx_bus_type) {
43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2;
46 break;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 hz = bcma_cpu_clock(&bcm47xx_bus.bcma.bus.drv_mips) / 2;
51 break;
52#endif
53 }
54
43 if (!hz) 55 if (!hz)
44 hz = 100000000; 56 hz = 100000000;
45 57
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 74d06965326..e9f9ec8d443 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -108,7 +108,7 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored)
108 108
109 /* Interrupts are shared, check if the current one is 109 /* Interrupts are shared, check if the current one is
110 a GPIO interrupt. */ 110 a GPIO interrupt. */
111 if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco, 111 if (!ssb_chipco_irq_status(&bcm47xx_bus.ssb.chipco,
112 SSB_CHIPCO_IRQ_GPIO)) 112 SSB_CHIPCO_IRQ_GPIO))
113 return IRQ_NONE; 113 return IRQ_NONE;
114 114
@@ -132,22 +132,26 @@ static int __init wgt634u_init(void)
132 * machine. Use the MAC address as an heuristic. Netgear Inc. has 132 * machine. Use the MAC address as an heuristic. Netgear Inc. has
133 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx. 133 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
134 */ 134 */
135 u8 *et0mac;
135 136
136 u8 *et0mac = ssb_bcm47xx.sprom.et0mac; 137 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
138 return -ENODEV;
139
140 et0mac = bcm47xx_bus.ssb.sprom.et0mac;
137 141
138 if (et0mac[0] == 0x00 && 142 if (et0mac[0] == 0x00 &&
139 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 143 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
140 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) { 144 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
141 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 145 struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;
142 146
143 printk(KERN_INFO "WGT634U machine detected.\n"); 147 printk(KERN_INFO "WGT634U machine detected.\n");
144 148
145 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET), 149 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
146 gpio_interrupt, IRQF_SHARED, 150 gpio_interrupt, IRQF_SHARED,
147 "WGT634U GPIO", &ssb_bcm47xx.chipco)) { 151 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
148 gpio_direction_input(WGT634U_GPIO_RESET); 152 gpio_direction_input(WGT634U_GPIO_RESET);
149 gpio_intmask(WGT634U_GPIO_RESET, 1); 153 gpio_intmask(WGT634U_GPIO_RESET, 1);
150 ssb_chipco_irq_mask(&ssb_bcm47xx.chipco, 154 ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
151 SSB_CHIPCO_IRQ_GPIO, 155 SSB_CHIPCO_IRQ_GPIO,
152 SSB_CHIPCO_IRQ_GPIO); 156 SSB_CHIPCO_IRQ_GPIO);
153 } 157 }
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index dbc51065df5..b77df0366ee 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -111,7 +111,8 @@ struct compat_statfs {
111 int f_bavail; 111 int f_bavail;
112 compat_fsid_t f_fsid; 112 compat_fsid_t f_fsid;
113 int f_namelen; 113 int f_namelen;
114 int f_spare[6]; 114 int f_flags;
115 int f_spare[5];
115}; 116};
116 117
117#define COMPAT_RLIM_INFINITY 0x7fffffffUL 118#define COMPAT_RLIM_INFINITY 0x7fffffffUL
diff --git a/arch/mips/include/asm/lasat/lasat.h b/arch/mips/include/asm/lasat/lasat.h
index a1ada1c27c1..e8ff70f80e1 100644
--- a/arch/mips/include/asm/lasat/lasat.h
+++ b/arch/mips/include/asm/lasat/lasat.h
@@ -41,10 +41,8 @@ enum lasat_mtdparts {
41 41
42/* 42/*
43 * The format of the data record in the EEPROM. 43 * The format of the data record in the EEPROM.
44 * See Documentation/LASAT/eeprom.txt for a detailed description 44 * See the LASAT Hardware Configuration field specification for a detailed
45 * of the fields in this struct, and the LASAT Hardware Configuration 45 * description of the config field.
46 * field specification for a detailed description of the config
47 * field.
48 */ 46 */
49#include <linux/types.h> 47#include <linux/types.h>
50 48
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h b/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h
index 8e2fa674be4..4e3f3bc26c6 100644
--- a/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h
@@ -368,19 +368,6 @@ typedef struct psc_spi {
368#define PSC_SPITXRX_LC (1 << 29) 368#define PSC_SPITXRX_LC (1 << 29)
369#define PSC_SPITXRX_SR (1 << 28) 369#define PSC_SPITXRX_SR (1 << 28)
370 370
371/* PSC in SMBus (I2C) Mode. */
372typedef struct psc_smb {
373 u32 psc_sel;
374 u32 psc_ctrl;
375 u32 psc_smbcfg;
376 u32 psc_smbmsk;
377 u32 psc_smbpcr;
378 u32 psc_smbstat;
379 u32 psc_smbevnt;
380 u32 psc_smbtxrx;
381 u32 psc_smbtmr;
382} psc_smb_t;
383
384/* SMBus Config Register. */ 371/* SMBus Config Register. */
385#define PSC_SMBCFG_RT_MASK (3 << 30) 372#define PSC_SMBCFG_RT_MASK (3 << 30)
386#define PSC_SMBCFG_RT_FIFO1 (0 << 30) 373#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index d008f47a28b..de95e0723e2 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -19,7 +19,29 @@
19#ifndef __ASM_BCM47XX_H 19#ifndef __ASM_BCM47XX_H
20#define __ASM_BCM47XX_H 20#define __ASM_BCM47XX_H
21 21
22/* SSB bus */ 22#include <linux/ssb/ssb.h>
23extern struct ssb_bus ssb_bcm47xx; 23#include <linux/bcma/bcma.h>
24#include <linux/bcma/bcma_soc.h>
25
26enum bcm47xx_bus_type {
27#ifdef CONFIG_BCM47XX_SSB
28 BCM47XX_BUS_TYPE_SSB,
29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 BCM47XX_BUS_TYPE_BCMA,
32#endif
33};
34
35union bcm47xx_bus {
36#ifdef CONFIG_BCM47XX_SSB
37 struct ssb_bus ssb;
38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 struct bcma_soc bcma;
41#endif
42};
43
44extern union bcm47xx_bus bcm47xx_bus;
45extern enum bcm47xx_bus_type bcm47xx_bus_type;
24 46
25#endif /* __ASM_BCM47XX_H */ 47#endif /* __ASM_BCM47XX_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 98504142124..76961cabeed 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -10,6 +10,7 @@
10#define __BCM47XX_GPIO_H 10#define __BCM47XX_GPIO_H
11 11
12#include <linux/ssb/ssb_embedded.h> 12#include <linux/ssb/ssb_embedded.h>
13#include <linux/bcma/bcma.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
15#define BCM47XX_EXTIF_GPIO_LINES 5 16#define BCM47XX_EXTIF_GPIO_LINES 5
@@ -21,41 +22,118 @@ extern int gpio_to_irq(unsigned gpio);
21 22
22static inline int gpio_get_value(unsigned gpio) 23static inline int gpio_get_value(unsigned gpio)
23{ 24{
24 return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio); 25 switch (bcm47xx_bus_type) {
26#ifdef CONFIG_BCM47XX_SSB
27 case BCM47XX_BUS_TYPE_SSB:
28 return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 case BCM47XX_BUS_TYPE_BCMA:
32 return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc,
33 1 << gpio);
34#endif
35 }
36 return -EINVAL;
25} 37}
26 38
27static inline void gpio_set_value(unsigned gpio, int value) 39static inline void gpio_set_value(unsigned gpio, int value)
28{ 40{
29 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 41 switch (bcm47xx_bus_type) {
42#ifdef CONFIG_BCM47XX_SSB
43 case BCM47XX_BUS_TYPE_SSB:
44 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
45 value ? 1 << gpio : 0);
46 return;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
51 value ? 1 << gpio : 0);
52 return;
53#endif
54 }
30} 55}
31 56
32static inline int gpio_direction_input(unsigned gpio) 57static inline int gpio_direction_input(unsigned gpio)
33{ 58{
34 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0); 59 switch (bcm47xx_bus_type) {
35 return 0; 60#ifdef CONFIG_BCM47XX_SSB
61 case BCM47XX_BUS_TYPE_SSB:
62 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
63 return 0;
64#endif
65#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
68 0);
69 return 0;
70#endif
71 }
72 return -EINVAL;
36} 73}
37 74
38static inline int gpio_direction_output(unsigned gpio, int value) 75static inline int gpio_direction_output(unsigned gpio, int value)
39{ 76{
40 /* first set the gpio out value */ 77 switch (bcm47xx_bus_type) {
41 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 78#ifdef CONFIG_BCM47XX_SSB
42 /* then set the gpio mode */ 79 case BCM47XX_BUS_TYPE_SSB:
43 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio); 80 /* first set the gpio out value */
44 return 0; 81 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
82 value ? 1 << gpio : 0);
83 /* then set the gpio mode */
84 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
85 return 0;
86#endif
87#ifdef CONFIG_BCM47XX_BCMA
88 case BCM47XX_BUS_TYPE_BCMA:
89 /* first set the gpio out value */
90 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
91 value ? 1 << gpio : 0);
92 /* then set the gpio mode */
93 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
94 1 << gpio);
95 return 0;
96#endif
97 }
98 return -EINVAL;
45} 99}
46 100
47static inline int gpio_intmask(unsigned gpio, int value) 101static inline int gpio_intmask(unsigned gpio, int value)
48{ 102{
49 ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio, 103 switch (bcm47xx_bus_type) {
50 value ? 1 << gpio : 0); 104#ifdef CONFIG_BCM47XX_SSB
51 return 0; 105 case BCM47XX_BUS_TYPE_SSB:
106 ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
107 value ? 1 << gpio : 0);
108 return 0;
109#endif
110#ifdef CONFIG_BCM47XX_BCMA
111 case BCM47XX_BUS_TYPE_BCMA:
112 bcma_chipco_gpio_intmask(&bcm47xx_bus.bcma.bus.drv_cc,
113 1 << gpio, value ? 1 << gpio : 0);
114 return 0;
115#endif
116 }
117 return -EINVAL;
52} 118}
53 119
54static inline int gpio_polarity(unsigned gpio, int value) 120static inline int gpio_polarity(unsigned gpio, int value)
55{ 121{
56 ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio, 122 switch (bcm47xx_bus_type) {
57 value ? 1 << gpio : 0); 123#ifdef CONFIG_BCM47XX_SSB
58 return 0; 124 case BCM47XX_BUS_TYPE_SSB:
125 ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
126 value ? 1 << gpio : 0);
127 return 0;
128#endif
129#ifdef CONFIG_BCM47XX_BCMA
130 case BCM47XX_BUS_TYPE_BCMA:
131 bcma_chipco_gpio_polarity(&bcm47xx_bus.bcma.bus.drv_cc,
132 1 << gpio, value ? 1 << gpio : 0);
133 return 0;
134#endif
135 }
136 return -EINVAL;
59} 137}
60 138
61 139
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
index 455f8e50a00..400535a955d 100644
--- a/arch/mips/pci/pci-bcm47xx.c
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -25,6 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/ssb/ssb.h> 27#include <linux/ssb/ssb.h>
28#include <bcm47xx.h>
28 29
29int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 30int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
30{ 31{
@@ -33,9 +34,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
33 34
34int pcibios_plat_dev_init(struct pci_dev *dev) 35int pcibios_plat_dev_init(struct pci_dev *dev)
35{ 36{
37#ifdef CONFIG_BCM47XX_SSB
36 int res; 38 int res;
37 u8 slot, pin; 39 u8 slot, pin;
38 40
41 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
42 return 0;
43
39 res = ssb_pcibios_plat_dev_init(dev); 44 res = ssb_pcibios_plat_dev_init(dev);
40 if (res < 0) { 45 if (res < 0) {
41 printk(KERN_ALERT "PCI: Failed to init device %s\n", 46 printk(KERN_ALERT "PCI: Failed to init device %s\n",
@@ -55,5 +60,6 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
55 } 60 }
56 61
57 dev->irq = res; 62 dev->irq = res;
63#endif
58 return 0; 64 return 0;
59} 65}
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_serial.c b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
index f7261628d8a..a1c7c7da233 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_serial.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
@@ -27,6 +27,7 @@
27#include <linux/serial.h> 27#include <linux/serial.h>
28#include <linux/serial_core.h> 28#include <linux/serial_core.h>
29#include <linux/serial_reg.h> 29#include <linux/serial_reg.h>
30#include <linux/slab.h>
30 31
31#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
32#include <asm/io.h> 33#include <asm/io.h>
@@ -38,6 +39,55 @@
38#include <msp_int.h> 39#include <msp_int.h>
39#include <msp_regs.h> 40#include <msp_regs.h>
40 41
42struct msp_uart_data {
43 int last_lcr;
44};
45
46static void msp_serial_out(struct uart_port *p, int offset, int value)
47{
48 struct msp_uart_data *d = p->private_data;
49
50 if (offset == UART_LCR)
51 d->last_lcr = value;
52
53 offset <<= p->regshift;
54 writeb(value, p->membase + offset);
55}
56
57static unsigned int msp_serial_in(struct uart_port *p, int offset)
58{
59 offset <<= p->regshift;
60
61 return readb(p->membase + offset);
62}
63
64static int msp_serial_handle_irq(struct uart_port *p)
65{
66 struct msp_uart_data *d = p->private_data;
67 unsigned int iir = readb(p->membase + (UART_IIR << p->regshift));
68
69 if (serial8250_handle_irq(p, iir)) {
70 return 1;
71 } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
72 /*
73 * The DesignWare APB UART has an Busy Detect (0x07) interrupt
74 * meaning an LCR write attempt occurred while the UART was
75 * busy. The interrupt must be cleared by reading the UART
76 * status register (USR) and the LCR re-written.
77 *
78 * Note: MSP reserves 0x20 bytes of address space for the UART
79 * and the USR is mapped in a separate block at an offset of
80 * 0xc0 from the start of the UART.
81 */
82 (void)readb(p->membase + 0xc0);
83 writeb(d->last_lcr, p->membase + (UART_LCR << p->regshift));
84
85 return 1;
86 }
87
88 return 0;
89}
90
41void __init msp_serial_setup(void) 91void __init msp_serial_setup(void)
42{ 92{
43 char *s; 93 char *s;
@@ -59,13 +109,22 @@ void __init msp_serial_setup(void)
59 up.irq = MSP_INT_UART0; 109 up.irq = MSP_INT_UART0;
60 up.uartclk = uartclk; 110 up.uartclk = uartclk;
61 up.regshift = 2; 111 up.regshift = 2;
62 up.iotype = UPIO_DWAPB; /* UPIO_MEM like */ 112 up.iotype = UPIO_MEM;
63 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 113 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
64 up.type = PORT_16550A; 114 up.type = PORT_16550A;
65 up.line = 0; 115 up.line = 0;
66 up.private_data = (void*)UART0_STATUS_REG; 116 up.serial_out = msp_serial_out;
67 if (early_serial_setup(&up)) 117 up.serial_in = msp_serial_in;
68 printk(KERN_ERR "Early serial init of port 0 failed\n"); 118 up.handle_irq = msp_serial_handle_irq;
119 up.private_data = kzalloc(sizeof(struct msp_uart_data), GFP_KERNEL);
120 if (!up.private_data) {
121 pr_err("failed to allocate uart private data\n");
122 return;
123 }
124 if (early_serial_setup(&up)) {
125 kfree(up.private_data);
126 pr_err("Early serial init of port 0 failed\n");
127 }
69 128
70 /* Initialize the second serial port, if one exists */ 129 /* Initialize the second serial port, if one exists */
71 switch (mips_machtype) { 130 switch (mips_machtype) {
@@ -88,6 +147,8 @@ void __init msp_serial_setup(void)
88 up.irq = MSP_INT_UART1; 147 up.irq = MSP_INT_UART1;
89 up.line = 1; 148 up.line = 1;
90 up.private_data = (void*)UART1_STATUS_REG; 149 up.private_data = (void*)UART1_STATUS_REG;
91 if (early_serial_setup(&up)) 150 if (early_serial_setup(&up)) {
92 printk(KERN_ERR "Early serial init of port 1 failed\n"); 151 kfree(up.private_data);
152 pr_err("Early serial init of port 1 failed\n");
153 }
93} 154}
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index e9f95dcde37..ba3cec3155d 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -321,7 +321,7 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
321static u32 tx4939_get_eth_speed(struct net_device *dev) 321static u32 tx4939_get_eth_speed(struct net_device *dev)
322{ 322{
323 struct ethtool_cmd cmd; 323 struct ethtool_cmd cmd;
324 if (dev_ethtool_get_settings(dev, &cmd)) 324 if (__ethtool_get_settings(dev, &cmd))
325 return 100; /* default 100Mbps */ 325 return 100; /* default 100Mbps */
326 326
327 return ethtool_cmd_speed(&cmd); 327 return ethtool_cmd_speed(&cmd);