aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy/common/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/alchemy/common/platform.c')
-rw-r--r--arch/mips/alchemy/common/platform.c153
1 files changed, 119 insertions, 34 deletions
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 117f99f7064..2580e77624d 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -19,39 +19,40 @@
19#include <asm/mach-au1x00/au1xxx.h> 19#include <asm/mach-au1x00/au1xxx.h>
20#include <asm/mach-au1x00/au1xxx_dbdma.h> 20#include <asm/mach-au1x00/au1xxx_dbdma.h>
21#include <asm/mach-au1x00/au1100_mmc.h> 21#include <asm/mach-au1x00/au1100_mmc.h>
22 22#include <asm/mach-au1x00/au1xxx_eth.h>
23#define PORT(_base, _irq) \ 23
24 { \ 24#define PORT(_base, _irq) \
25 .iobase = _base, \ 25 { \
26 .membase = (void __iomem *)_base,\ 26 .mapbase = _base, \
27 .mapbase = CPHYSADDR(_base), \ 27 .irq = _irq, \
28 .irq = _irq, \ 28 .regshift = 2, \
29 .regshift = 2, \ 29 .iotype = UPIO_AU, \
30 .iotype = UPIO_AU, \ 30 .flags = UPF_SKIP_TEST | UPF_IOREMAP | \
31 .flags = UPF_SKIP_TEST \ 31 UPF_FIXED_TYPE, \
32 .type = PORT_16550A, \
32 } 33 }
33 34
34static struct plat_serial8250_port au1x00_uart_data[] = { 35static struct plat_serial8250_port au1x00_uart_data[] = {
35#if defined(CONFIG_SERIAL_8250_AU1X00) 36#if defined(CONFIG_SERIAL_8250_AU1X00)
36#if defined(CONFIG_SOC_AU1000) 37#if defined(CONFIG_SOC_AU1000)
37 PORT(UART0_ADDR, AU1000_UART0_INT), 38 PORT(UART0_PHYS_ADDR, AU1000_UART0_INT),
38 PORT(UART1_ADDR, AU1000_UART1_INT), 39 PORT(UART1_PHYS_ADDR, AU1000_UART1_INT),
39 PORT(UART2_ADDR, AU1000_UART2_INT), 40 PORT(UART2_PHYS_ADDR, AU1000_UART2_INT),
40 PORT(UART3_ADDR, AU1000_UART3_INT), 41 PORT(UART3_PHYS_ADDR, AU1000_UART3_INT),
41#elif defined(CONFIG_SOC_AU1500) 42#elif defined(CONFIG_SOC_AU1500)
42 PORT(UART0_ADDR, AU1500_UART0_INT), 43 PORT(UART0_PHYS_ADDR, AU1500_UART0_INT),
43 PORT(UART3_ADDR, AU1500_UART3_INT), 44 PORT(UART3_PHYS_ADDR, AU1500_UART3_INT),
44#elif defined(CONFIG_SOC_AU1100) 45#elif defined(CONFIG_SOC_AU1100)
45 PORT(UART0_ADDR, AU1100_UART0_INT), 46 PORT(UART0_PHYS_ADDR, AU1100_UART0_INT),
46 PORT(UART1_ADDR, AU1100_UART1_INT), 47 PORT(UART1_PHYS_ADDR, AU1100_UART1_INT),
47 PORT(UART3_ADDR, AU1100_UART3_INT), 48 PORT(UART3_PHYS_ADDR, AU1100_UART3_INT),
48#elif defined(CONFIG_SOC_AU1550) 49#elif defined(CONFIG_SOC_AU1550)
49 PORT(UART0_ADDR, AU1550_UART0_INT), 50 PORT(UART0_PHYS_ADDR, AU1550_UART0_INT),
50 PORT(UART1_ADDR, AU1550_UART1_INT), 51 PORT(UART1_PHYS_ADDR, AU1550_UART1_INT),
51 PORT(UART3_ADDR, AU1550_UART3_INT), 52 PORT(UART3_PHYS_ADDR, AU1550_UART3_INT),
52#elif defined(CONFIG_SOC_AU1200) 53#elif defined(CONFIG_SOC_AU1200)
53 PORT(UART0_ADDR, AU1200_UART0_INT), 54 PORT(UART0_PHYS_ADDR, AU1200_UART0_INT),
54 PORT(UART1_ADDR, AU1200_UART1_INT), 55 PORT(UART1_PHYS_ADDR, AU1200_UART1_INT),
55#endif 56#endif
56#endif /* CONFIG_SERIAL_8250_AU1X00 */ 57#endif /* CONFIG_SERIAL_8250_AU1X00 */
57 { }, 58 { },
@@ -73,8 +74,8 @@ static struct resource au1xxx_usb_ohci_resources[] = {
73 .flags = IORESOURCE_MEM, 74 .flags = IORESOURCE_MEM,
74 }, 75 },
75 [1] = { 76 [1] = {
76 .start = AU1000_USB_HOST_INT, 77 .start = FOR_PLATFORM_C_USB_HOST_INT,
77 .end = AU1000_USB_HOST_INT, 78 .end = FOR_PLATFORM_C_USB_HOST_INT,
78 .flags = IORESOURCE_IRQ, 79 .flags = IORESOURCE_IRQ,
79 }, 80 },
80}; 81};
@@ -132,8 +133,8 @@ static struct resource au1xxx_usb_ehci_resources[] = {
132 .flags = IORESOURCE_MEM, 133 .flags = IORESOURCE_MEM,
133 }, 134 },
134 [1] = { 135 [1] = {
135 .start = AU1000_USB_HOST_INT, 136 .start = AU1200_USB_INT,
136 .end = AU1000_USB_HOST_INT, 137 .end = AU1200_USB_INT,
137 .flags = IORESOURCE_IRQ, 138 .flags = IORESOURCE_IRQ,
138 }, 139 },
139}; 140};
@@ -308,11 +309,6 @@ static struct platform_device au1200_mmc1_device = {
308#endif /* #ifndef CONFIG_MIPS_DB1200 */ 309#endif /* #ifndef CONFIG_MIPS_DB1200 */
309#endif /* #ifdef CONFIG_SOC_AU1200 */ 310#endif /* #ifdef CONFIG_SOC_AU1200 */
310 311
311static struct platform_device au1x00_pcmcia_device = {
312 .name = "au1x00-pcmcia",
313 .id = 0,
314};
315
316/* All Alchemy demoboards with I2C have this #define in their headers */ 312/* All Alchemy demoboards with I2C have this #define in their headers */
317#ifdef SMBUS_PSC_BASE 313#ifdef SMBUS_PSC_BASE
318static struct resource pbdb_smbus_resources[] = { 314static struct resource pbdb_smbus_resources[] = {
@@ -331,10 +327,92 @@ static struct platform_device pbdb_smbus_device = {
331}; 327};
332#endif 328#endif
333 329
330/* Macro to help defining the Ethernet MAC resources */
331#define MAC_RES(_base, _enable, _irq) \
332 { \
333 .start = CPHYSADDR(_base), \
334 .end = CPHYSADDR(_base + 0xffff), \
335 .flags = IORESOURCE_MEM, \
336 }, \
337 { \
338 .start = CPHYSADDR(_enable), \
339 .end = CPHYSADDR(_enable + 0x3), \
340 .flags = IORESOURCE_MEM, \
341 }, \
342 { \
343 .start = _irq, \
344 .end = _irq, \
345 .flags = IORESOURCE_IRQ \
346 }
347
348static struct resource au1xxx_eth0_resources[] = {
349#if defined(CONFIG_SOC_AU1000)
350 MAC_RES(AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT),
351#elif defined(CONFIG_SOC_AU1100)
352 MAC_RES(AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT),
353#elif defined(CONFIG_SOC_AU1550)
354 MAC_RES(AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT),
355#elif defined(CONFIG_SOC_AU1500)
356 MAC_RES(AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT),
357#endif
358};
359
360
361static struct au1000_eth_platform_data au1xxx_eth0_platform_data = {
362 .phy1_search_mac0 = 1,
363};
364
365static struct platform_device au1xxx_eth0_device = {
366 .name = "au1000-eth",
367 .id = 0,
368 .num_resources = ARRAY_SIZE(au1xxx_eth0_resources),
369 .resource = au1xxx_eth0_resources,
370 .dev.platform_data = &au1xxx_eth0_platform_data,
371};
372
373#ifndef CONFIG_SOC_AU1100
374static struct resource au1xxx_eth1_resources[] = {
375#if defined(CONFIG_SOC_AU1000)
376 MAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT),
377#elif defined(CONFIG_SOC_AU1550)
378 MAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT),
379#elif defined(CONFIG_SOC_AU1500)
380 MAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT),
381#endif
382};
383
384static struct au1000_eth_platform_data au1xxx_eth1_platform_data = {
385 .phy1_search_mac0 = 1,
386};
387
388static struct platform_device au1xxx_eth1_device = {
389 .name = "au1000-eth",
390 .id = 1,
391 .num_resources = ARRAY_SIZE(au1xxx_eth1_resources),
392 .resource = au1xxx_eth1_resources,
393 .dev.platform_data = &au1xxx_eth1_platform_data,
394};
395#endif
396
397void __init au1xxx_override_eth_cfg(unsigned int port,
398 struct au1000_eth_platform_data *eth_data)
399{
400 if (!eth_data || port > 1)
401 return;
402
403 if (port == 0)
404 memcpy(&au1xxx_eth0_platform_data, eth_data,
405 sizeof(struct au1000_eth_platform_data));
406#ifndef CONFIG_SOC_AU1100
407 else
408 memcpy(&au1xxx_eth1_platform_data, eth_data,
409 sizeof(struct au1000_eth_platform_data));
410#endif
411}
412
334static struct platform_device *au1xxx_platform_devices[] __initdata = { 413static struct platform_device *au1xxx_platform_devices[] __initdata = {
335 &au1xx0_uart_device, 414 &au1xx0_uart_device,
336 &au1xxx_usb_ohci_device, 415 &au1xxx_usb_ohci_device,
337 &au1x00_pcmcia_device,
338#ifdef CONFIG_FB_AU1100 416#ifdef CONFIG_FB_AU1100
339 &au1100_lcd_device, 417 &au1100_lcd_device,
340#endif 418#endif
@@ -351,6 +429,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
351#ifdef SMBUS_PSC_BASE 429#ifdef SMBUS_PSC_BASE
352 &pbdb_smbus_device, 430 &pbdb_smbus_device,
353#endif 431#endif
432 &au1xxx_eth0_device,
354}; 433};
355 434
356static int __init au1xxx_platform_init(void) 435static int __init au1xxx_platform_init(void)
@@ -362,6 +441,12 @@ static int __init au1xxx_platform_init(void)
362 for (i = 0; au1x00_uart_data[i].flags; i++) 441 for (i = 0; au1x00_uart_data[i].flags; i++)
363 au1x00_uart_data[i].uartclk = uartclk; 442 au1x00_uart_data[i].uartclk = uartclk;
364 443
444#ifndef CONFIG_SOC_AU1100
445 /* Register second MAC if enabled in pinfunc */
446 if (!(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2))
447 platform_device_register(&au1xxx_eth1_device);
448#endif
449
365 return platform_add_devices(au1xxx_platform_devices, 450 return platform_add_devices(au1xxx_platform_devices,
366 ARRAY_SIZE(au1xxx_platform_devices)); 451 ARRAY_SIZE(au1xxx_platform_devices));
367} 452}