diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2014-03-30 21:32:08 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-31 16:34:19 -0400 |
commit | 44934fac2171d5b0ed1838293f2e2db7508ad628 (patch) | |
tree | 0adfcc85a785187d002d90daf6e91d67ad6915db | |
parent | 6dfac5c33620de7f5ecd9dd07e2e2bb6549c4d55 (diff) | |
download | linux-44934fac2171d5b0ed1838293f2e2db7508ad628.tar.bz2 |
net: fec: make sure to init MAC address
Though we made sure to acquire a valid MAC for
the netdevice we never actually programmed it
into the hardware.
So if the bootloader did not set the MAC,
network operation would only work if userspace
explicitly asked to transfer the MAC to hardware.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index e19315eaf2dd..8d69e439f0c5 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1898,10 +1898,11 @@ 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; - - memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); + if (addr) { + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + 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), @@ -2000,6 +2001,8 @@ static int fec_enet_init(struct net_device *ndev) /* Get the Ethernet address */ fec_get_mac(ndev); + /* make sure MAC we just acquired is programmed into the hw */ + fec_set_mac_address(ndev, NULL); /* init the tx & rx ring size */ fep->tx_ring_size = TX_RING_SIZE; |