mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-02-16 11:59:07 +01:00
ramips: mtk_eth_soc: handle EPROBE_DEFER for MAC
If nvmem is used for ethernet mac address, we need to defer loading to get the proper mac. Move to probe as ndo_init is the wrong place to handle EPROBE_DEFER. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21920 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
3553eda283
commit
0780972fd5
1 changed files with 11 additions and 7 deletions
|
|
@ -1359,13 +1359,6 @@ static int __init fe_init(struct net_device *dev)
|
|||
|
||||
fe_reset_phy(priv);
|
||||
|
||||
/* Set the MAC address if it is correct, if not use a random MAC address */
|
||||
if (of_get_ethdev_address(priv->dev->of_node, dev)) {
|
||||
eth_hw_addr_random(dev);
|
||||
dev_err(priv->dev, "generated random MAC address %pM\n",
|
||||
dev->dev_addr);
|
||||
}
|
||||
|
||||
err = fe_mdio_init(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
@ -1554,6 +1547,17 @@ static int fe_probe(struct platform_device *pdev)
|
|||
netdev->netdev_ops = &fe_netdev_ops;
|
||||
netdev->base_addr = (unsigned long)fe_base;
|
||||
|
||||
/* Set the MAC address if it is correct, if not use a random MAC address */
|
||||
err = of_get_ethdev_address(pdev->dev.of_node, netdev);
|
||||
if (err == -EPROBE_DEFER)
|
||||
return err;
|
||||
|
||||
if (err) {
|
||||
eth_hw_addr_random(netdev);
|
||||
dev_err(&pdev->dev, "generated random MAC address %pM\n",
|
||||
netdev->dev_addr);
|
||||
}
|
||||
|
||||
netdev->irq = platform_get_irq(pdev, 0);
|
||||
if (netdev->irq < 0)
|
||||
return -ENXIO;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue