diff options
author | Florian Fainelli <florian@openwrt.org> | 2009-11-09 19:13:30 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:53:01 -0500 |
commit | 66f75ccb856304c190fde9c26e651c2b754e3e72 (patch) | |
tree | f63f8fe9362fc9805b73f9146a20457d1ceddff0 /arch/mips/alchemy | |
parent | cf6e47e03239059bcf2942b1b3242e835231ab75 (diff) |
MIPS: Alchemy: Add au1000-eth platform device
This patch makes the board code register the au1000-eth platform device. The
au1000-eth platform data can be overriden with the au1xxx_override_eth_cfg
function like it has to be done for the Bosporus board which uses a
different MAC/PHY setup.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Cc: David Miller <davem@davemloft.net>
Cc: linux-mips@linux-mips.org
Cc: netdev@vger.kernel.org
Patchwork: http://patchwork.linux-mips.org/patch/618/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r-- | arch/mips/alchemy/common/platform.c | 90 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1x00/board_setup.c | 17 |
2 files changed, 107 insertions, 0 deletions
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 3be14b09157c..3fbe30c1fd9a 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c | |||
@@ -19,6 +19,7 @@ | |||
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 | #include <asm/mach-au1x00/au1xxx_eth.h> | ||
22 | 23 | ||
23 | #define PORT(_base, _irq) \ | 24 | #define PORT(_base, _irq) \ |
24 | { \ | 25 | { \ |
@@ -326,6 +327,88 @@ static struct platform_device pbdb_smbus_device = { | |||
326 | }; | 327 | }; |
327 | #endif | 328 | #endif |
328 | 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 | |||
348 | static 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 | static struct resource au1xxx_eth1_resources[] = { | ||
361 | #if defined(CONFIG_SOC_AU1000) | ||
362 | MAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT), | ||
363 | #elif defined(CONFIG_SOC_AU1550) | ||
364 | MAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT), | ||
365 | #elif defined(CONFIG_SOC_AU1500) | ||
366 | MAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT), | ||
367 | #endif | ||
368 | }; | ||
369 | |||
370 | static struct au1000_eth_platform_data au1xxx_eth0_platform_data = { | ||
371 | .phy1_search_mac0 = 1, | ||
372 | }; | ||
373 | |||
374 | static struct platform_device au1xxx_eth0_device = { | ||
375 | .name = "au1000-eth", | ||
376 | .id = 0, | ||
377 | .num_resources = ARRAY_SIZE(au1xxx_eth0_resources), | ||
378 | .resource = au1xxx_eth0_resources, | ||
379 | .dev.platform_data = &au1xxx_eth0_platform_data, | ||
380 | }; | ||
381 | |||
382 | #ifndef CONFIG_SOC_AU1100 | ||
383 | static struct au1000_eth_platform_data au1xxx_eth1_platform_data = { | ||
384 | .phy1_search_mac0 = 1, | ||
385 | }; | ||
386 | |||
387 | static struct platform_device au1xxx_eth1_device = { | ||
388 | .name = "au1000-eth", | ||
389 | .id = 1, | ||
390 | .num_resources = ARRAY_SIZE(au1xxx_eth1_resources), | ||
391 | .resource = au1xxx_eth1_resources, | ||
392 | .dev.platform_data = &au1xxx_eth1_platform_data, | ||
393 | }; | ||
394 | #endif | ||
395 | |||
396 | void __init au1xxx_override_eth_cfg(unsigned int port, | ||
397 | struct au1000_eth_platform_data *eth_data) | ||
398 | { | ||
399 | if (!eth_data || port > 1) | ||
400 | return; | ||
401 | |||
402 | if (port == 0) | ||
403 | memcpy(&au1xxx_eth0_platform_data, eth_data, | ||
404 | sizeof(struct au1000_eth_platform_data)); | ||
405 | #ifndef CONFIG_SOC_AU1100 | ||
406 | else | ||
407 | memcpy(&au1xxx_eth1_platform_data, eth_data, | ||
408 | sizeof(struct au1000_eth_platform_data)); | ||
409 | #endif | ||
410 | } | ||
411 | |||
329 | static struct platform_device *au1xxx_platform_devices[] __initdata = { | 412 | static struct platform_device *au1xxx_platform_devices[] __initdata = { |
330 | &au1xx0_uart_device, | 413 | &au1xx0_uart_device, |
331 | &au1xxx_usb_ohci_device, | 414 | &au1xxx_usb_ohci_device, |
@@ -345,6 +428,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = { | |||
345 | #ifdef SMBUS_PSC_BASE | 428 | #ifdef SMBUS_PSC_BASE |
346 | &pbdb_smbus_device, | 429 | &pbdb_smbus_device, |
347 | #endif | 430 | #endif |
431 | &au1xxx_eth0_device, | ||
348 | }; | 432 | }; |
349 | 433 | ||
350 | static int __init au1xxx_platform_init(void) | 434 | static int __init au1xxx_platform_init(void) |
@@ -356,6 +440,12 @@ static int __init au1xxx_platform_init(void) | |||
356 | for (i = 0; au1x00_uart_data[i].flags; i++) | 440 | for (i = 0; au1x00_uart_data[i].flags; i++) |
357 | au1x00_uart_data[i].uartclk = uartclk; | 441 | au1x00_uart_data[i].uartclk = uartclk; |
358 | 442 | ||
443 | #ifndef CONFIG_SOC_AU1100 | ||
444 | /* Register second MAC if enabled in pinfunc */ | ||
445 | if (!(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) | ||
446 | platform_device_register(&au1xxx_eth1_device); | ||
447 | #endif | ||
448 | |||
359 | return platform_add_devices(au1xxx_platform_devices, | 449 | return platform_add_devices(au1xxx_platform_devices, |
360 | ARRAY_SIZE(au1xxx_platform_devices)); | 450 | ARRAY_SIZE(au1xxx_platform_devices)); |
361 | } | 451 | } |
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c index 7aee14d78eea..b490efff4dca 100644 --- a/arch/mips/alchemy/devboards/db1x00/board_setup.c +++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
33 | 33 | ||
34 | #include <asm/mach-au1x00/au1000.h> | 34 | #include <asm/mach-au1x00/au1000.h> |
35 | #include <asm/mach-au1x00/au1xxx_eth.h> | ||
35 | #include <asm/mach-db1x00/db1x00.h> | 36 | #include <asm/mach-db1x00/db1x00.h> |
36 | #include <asm/mach-db1x00/bcsr.h> | 37 | #include <asm/mach-db1x00/bcsr.h> |
37 | 38 | ||
@@ -44,12 +45,26 @@ char irq_tab_alchemy[][5] __initdata = { | |||
44 | }; | 45 | }; |
45 | #endif | 46 | #endif |
46 | 47 | ||
48 | /* | ||
49 | * Micrel/Kendin 5 port switch attached to MAC0, | ||
50 | * MAC0 is associated with PHY address 5 (== WAN port) | ||
51 | * MAC1 is not associated with any PHY, since it's connected directly | ||
52 | * to the switch. | ||
53 | * no interrupts are used | ||
54 | */ | ||
55 | static struct au1000_eth_platform_data eth0_pdata = { | ||
56 | .phy_static_config = 1, | ||
57 | .phy_addr = 5, | ||
58 | }; | ||
59 | |||
47 | #ifdef CONFIG_MIPS_BOSPORUS | 60 | #ifdef CONFIG_MIPS_BOSPORUS |
48 | char irq_tab_alchemy[][5] __initdata = { | 61 | char irq_tab_alchemy[][5] __initdata = { |
49 | [11] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 11 - miniPCI */ | 62 | [11] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 11 - miniPCI */ |
50 | [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - SN1741 */ | 63 | [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - SN1741 */ |
51 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */ | 64 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */ |
52 | }; | 65 | }; |
66 | |||
67 | |||
53 | #endif | 68 | #endif |
54 | 69 | ||
55 | #ifdef CONFIG_MIPS_MIRAGE | 70 | #ifdef CONFIG_MIPS_MIRAGE |
@@ -103,6 +118,8 @@ void __init board_setup(void) | |||
103 | printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n"); | 118 | printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n"); |
104 | #endif | 119 | #endif |
105 | #ifdef CONFIG_MIPS_BOSPORUS | 120 | #ifdef CONFIG_MIPS_BOSPORUS |
121 | au1xxx_override_eth_cfg(0, ð0_pdata); | ||
122 | |||
106 | printk(KERN_INFO "AMD Alchemy Bosporus Board\n"); | 123 | printk(KERN_INFO "AMD Alchemy Bosporus Board\n"); |
107 | #endif | 124 | #endif |
108 | #ifdef CONFIG_MIPS_MIRAGE | 125 | #ifdef CONFIG_MIPS_MIRAGE |