Skip to content

Commit b231dc3

Browse files
MikeLooijmansclaudiubeznea
authored andcommitted
net: macb: Try to retrieve MAC addess from nvmem provider
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>
1 parent 24f5c71 commit b231dc3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,10 +3952,16 @@ static int macb_probe(struct platform_device *pdev)
39523952
dev->max_mtu = ETH_DATA_LEN;
39533953

39543954
mac = of_get_mac_address(np);
3955-
if (mac)
3955+
if (mac) {
39563956
ether_addr_copy(bp->dev->dev_addr, mac);
3957-
else
3958-
macb_get_hwaddr(bp);
3957+
} else {
3958+
err = of_get_nvmem_mac_address(np, bp->dev->dev_addr);
3959+
if (err) {
3960+
if (err == -EPROBE_DEFER)
3961+
goto err_out_free_netdev;
3962+
macb_get_hwaddr(bp);
3963+
}
3964+
}
39593965

39603966
err = of_get_phy_mode(np);
39613967
if (err < 0) {

0 commit comments

Comments
 (0)