netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fec: add the initial to set the physical mac address
@ 2013-08-22 11:17 Fugang Duan
  2013-08-22 14:07 ` Li Frank-B20596
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Fugang Duan @ 2013-08-22 11:17 UTC (permalink / raw)
  To: b20596, b45643, davem; +Cc: netdev, shawn.guo, bhutchings, R49496, stephen

For imx6slx evk platform, the fec driver cannot work since there
have no valid mac address set in physical mac registers.

For imx serial platform, fec/enet IPs both need the physical MAC
address initial, otherwise it cannot work.

After acquiring the valid MAC address from devices tree/pfuse/
kernel command line/random mac address, and then set it to the
physical MAC address registers.

Signed-off-by: Fugang Duan  <B38611@freescale.com>
---
 drivers/net/ethernet/freescale/fec_main.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4349a9e..9b5e08c 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1867,10 +1867,12 @@ fec_set_mac_address(struct net_device *ndev, void *p)
 	struct fec_enet_private *fep = netdev_priv(ndev);
 	struct sockaddr *addr = p;
 
-	if (!is_valid_ether_addr(addr->sa_data))
-		return -EADDRNOTAVAIL;
+	if (p) {
+		if (!is_valid_ether_addr(addr->sa_data))
+			return -EADDRNOTAVAIL;
 
-	memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
+		memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
+	}
 
 	writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
 		(ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24),
@@ -1969,6 +1971,7 @@ static int fec_enet_init(struct net_device *ndev)
 
 	/* Get the Ethernet address */
 	fec_get_mac(ndev);
+	fec_set_mac_address(ndev, NULL);
 
 	/* Set receive and transmit descriptor base. */
 	fep->rx_bd_base = cbd_base;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-11  1:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 11:17 [PATCH] net: fec: add the initial to set the physical mac address Fugang Duan
2013-08-22 14:07 ` Li Frank-B20596
2013-08-27 14:18 ` Lucas Stach
2013-08-28  2:11   ` Duan Fugang-B38611
2013-08-30  1:59     ` Duan Fugang-B38611
2013-09-10  1:45     ` Duan Fugang-B38611
2013-09-10  5:07       ` David Miller
2013-09-10  5:23         ` Duan Fugang-B38611
2013-09-10 14:19 ` Denis Kirjanov
2013-09-11  1:15   ` Duan Fugang-B38611

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).