aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/alchemy/common/platform.c15
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_eth.h1
-rw-r--r--drivers/net/au1000_eth.c31
3 files changed, 22 insertions, 25 deletions
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index c233d64a0d60..1dc55ee2681b 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/etherdevice.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
17#include <linux/init.h> 18#include <linux/init.h>
@@ -21,6 +22,8 @@
21#include <asm/mach-au1x00/au1100_mmc.h> 22#include <asm/mach-au1x00/au1100_mmc.h>
22#include <asm/mach-au1x00/au1xxx_eth.h> 23#include <asm/mach-au1x00/au1xxx_eth.h>
23 24
25#include <prom.h>
26
24#define PORT(_base, _irq) \ 27#define PORT(_base, _irq) \
25 { \ 28 { \
26 .mapbase = _base, \ 29 .mapbase = _base, \
@@ -434,17 +437,27 @@ static int __init au1xxx_platform_init(void)
434{ 437{
435 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 438 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
436 int err, i; 439 int err, i;
440 unsigned char ethaddr[6];
437 441
438 /* Fill up uartclk. */ 442 /* Fill up uartclk. */
439 for (i = 0; au1x00_uart_data[i].flags; i++) 443 for (i = 0; au1x00_uart_data[i].flags; i++)
440 au1x00_uart_data[i].uartclk = uartclk; 444 au1x00_uart_data[i].uartclk = uartclk;
441 445
446 /* use firmware-provided mac addr if available and necessary */
447 i = prom_get_ethernet_addr(ethaddr);
448 if (!i && !is_valid_ether_addr(au1xxx_eth0_platform_data.mac))
449 memcpy(au1xxx_eth0_platform_data.mac, ethaddr, 6);
450
442 err = platform_add_devices(au1xxx_platform_devices, 451 err = platform_add_devices(au1xxx_platform_devices,
443 ARRAY_SIZE(au1xxx_platform_devices)); 452 ARRAY_SIZE(au1xxx_platform_devices));
444#ifndef CONFIG_SOC_AU1100 453#ifndef CONFIG_SOC_AU1100
454 ethaddr[5] += 1; /* next addr for 2nd MAC */
455 if (!i && !is_valid_ether_addr(au1xxx_eth1_platform_data.mac))
456 memcpy(au1xxx_eth1_platform_data.mac, ethaddr, 6);
457
445 /* Register second MAC if enabled in pinfunc */ 458 /* Register second MAC if enabled in pinfunc */
446 if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) 459 if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2))
447 platform_device_register(&au1xxx_eth1_device); 460 err = platform_device_register(&au1xxx_eth1_device);
448#endif 461#endif
449 462
450 return err; 463 return err;
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
index bae9b758fcde..49dc8d9db186 100644
--- a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
@@ -9,6 +9,7 @@ struct au1000_eth_platform_data {
9 int phy_addr; 9 int phy_addr;
10 int phy_busid; 10 int phy_busid;
11 int phy_irq; 11 int phy_irq;
12 char mac[6];
12}; 13};
13 14
14void __init au1xxx_override_eth_cfg(unsigned port, 15void __init au1xxx_override_eth_cfg(unsigned port,
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index ece6128bef14..17e7e27eb222 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -104,14 +104,6 @@ MODULE_VERSION(DRV_VERSION);
104 * complete immediately. 104 * complete immediately.
105 */ 105 */
106 106
107/* These addresses are only used if yamon doesn't tell us what
108 * the mac address is, and the mac address is not passed on the
109 * command line.
110 */
111static unsigned char au1000_mac_addr[6] __devinitdata = {
112 0x00, 0x50, 0xc2, 0x0c, 0x30, 0x00
113};
114
115struct au1000_private *au_macs[NUM_ETH_INTERFACES]; 107struct au1000_private *au_macs[NUM_ETH_INTERFACES];
116 108
117/* 109/*
@@ -1002,7 +994,6 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1002 db_dest_t *pDB, *pDBfree; 994 db_dest_t *pDB, *pDBfree;
1003 int irq, i, err = 0; 995 int irq, i, err = 0;
1004 struct resource *base, *macen; 996 struct resource *base, *macen;
1005 char ethaddr[6];
1006 997
1007 base = platform_get_resource(pdev, IORESOURCE_MEM, 0); 998 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1008 if (!base) { 999 if (!base) {
@@ -1079,24 +1070,13 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1079 } 1070 }
1080 aup->mac_id = pdev->id; 1071 aup->mac_id = pdev->id;
1081 1072
1082 if (pdev->id == 0) { 1073 if (pdev->id == 0)
1083 if (prom_get_ethernet_addr(ethaddr) == 0)
1084 memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
1085 else {
1086 netdev_info(dev, "No MAC address found\n");
1087 /* Use the hard coded MAC addresses */
1088 }
1089
1090 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); 1074 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
1091 } else if (pdev->id == 1) 1075 else if (pdev->id == 1)
1092 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); 1076 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
1093 1077
1094 /* 1078 /* set a random MAC now in case platform_data doesn't provide one */
1095 * Assign to the Ethernet ports two consecutive MAC addresses 1079 random_ether_addr(dev->dev_addr);
1096 * to match those that are printed on their stickers
1097 */
1098 memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
1099 dev->dev_addr[5] += pdev->id;
1100 1080
1101 *aup->enable = 0; 1081 *aup->enable = 0;
1102 aup->mac_enabled = 0; 1082 aup->mac_enabled = 0;
@@ -1106,6 +1086,9 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1106 dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n"); 1086 dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n");
1107 aup->phy1_search_mac0 = 1; 1087 aup->phy1_search_mac0 = 1;
1108 } else { 1088 } else {
1089 if (is_valid_ether_addr(pd->mac))
1090 memcpy(dev->dev_addr, pd->mac, 6);
1091
1109 aup->phy_static_config = pd->phy_static_config; 1092 aup->phy_static_config = pd->phy_static_config;
1110 aup->phy_search_highest_addr = pd->phy_search_highest_addr; 1093 aup->phy_search_highest_addr = pd->phy_search_highest_addr;
1111 aup->phy1_search_mac0 = pd->phy1_search_mac0; 1094 aup->phy1_search_mac0 = pd->phy1_search_mac0;