Skip to content

Commit

Permalink
net: macb: Try to retrieve MAC addess from nvmem provider
Browse files Browse the repository at this point in the history
Call of_get_nvmem_mac_address() to fetch the MAC address from an nvmem
cell, if one is provided in the device tree. This allows the address to
be stored in an I2C EEPROM device for example.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mike Looijmans authored and David S. Miller committed Mar 30, 2018
1 parent 9217e56 commit aa076e3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/net/ethernet/cadence/macb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3952,10 +3952,16 @@ static int macb_probe(struct platform_device *pdev)
dev->max_mtu = ETH_DATA_LEN;

mac = of_get_mac_address(np);
if (mac)
if (mac) {
ether_addr_copy(bp->dev->dev_addr, mac);
else
macb_get_hwaddr(bp);
} else {
err = of_get_nvmem_mac_address(np, bp->dev->dev_addr);
if (err) {
if (err == -EPROBE_DEFER)
goto err_out_free_netdev;
macb_get_hwaddr(bp);
}
}

err = of_get_phy_mode(np);
if (err < 0) {
Expand Down

0 comments on commit aa076e3

Please sign in to comment.