summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXie Xiaobo <r63061@freescale.com>2010-08-23 15:50:31 +0800
committerXie Xiaobo <r63061@freescale.com>2010-08-23 16:22:22 +0800
commit1896588adf301560e711df45e5e544ad3c3b8099 (patch)
treea8b3b0877bdf0f2f36cc771b36ba28d8b96685ea
parenta915af8e905ba2bcbeedc345a9d55129d2ad8358 (diff)
ENGR00126576-2 L2-Switch: support getting mac address from platform data
The L2 Switch can get mac address from platform data. Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
-rw-r--r--drivers/net/fec_switch.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/fec_switch.c b/drivers/net/fec_switch.c
index f2c78e439278..0485349dcd76 100644
--- a/drivers/net/fec_switch.c
+++ b/drivers/net/fec_switch.c
@@ -131,9 +131,13 @@ static void *swap_buffer(void *bufaddr, int len)
/*last read entry from learning interface*/
struct eswPortInfo g_info;
+#ifdef USE_DEFAULT_SWITCH_PORT0_MAC
static unsigned char switch_mac_default[] = {
0x00, 0x08, 0x02, 0x6B, 0xA3, 0x1A,
};
+#else
+static unsigned char switch_mac_default[ETH_ALEN];
+#endif
static void switch_request_intrs(struct net_device *dev,
irqreturn_t switch_net_irq_handler(int irq, void *private),
@@ -3700,6 +3704,19 @@ static int __init switch_enet_init(struct net_device *dev,
fep->phy_interface = plat->fec_enet->phy;
if (plat->fec_enet->init && plat->fec_enet->init())
return -EIO;
+
+ /*
+ * The priority for getting MAC address is:
+ * (1) kernel command line fec_mac = xx:xx:xx...
+ * (2) platform data mac field got from fuse etc
+ * (3) bootloader set the FEC mac register
+ */
+
+ if (!is_valid_ether_addr(switch_mac_default) &&
+ plat->fec_enet->mac &&
+ is_valid_ether_addr(plat->fec_enet->mac))
+ memcpy(switch_mac_default, plat->fec_enet->mac,
+ sizeof(switch_mac_default));
} else
fep->phy_interface = PHY_INTERFACE_MODE_MII;