ath79: ag71xx: support probe defferal for getting MAC address

Currently, of_get_ethdev_address() return is checked for any return error
code which means that trying to get the MAC from NVMEM cells that is backed
by MTD will fail if it was not probed before ag71xx.

So, lets check the return error code for EPROBE_DEFER and defer the ag71xx
probe in that case until the underlying NVMEM device is live.

Link: https://github.com/openwrt/openwrt/pull/15752
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Robert Marko 2024-06-19 11:26:47 +02:00
parent 0b6b54eca9
commit 150d0ceab7

View File

@ -1668,7 +1668,11 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->stop_desc->ctrl = 0;
ag->stop_desc->next = (u32) ag->stop_desc_dma;
if (of_get_ethdev_address(np, dev)) {
err = of_get_ethdev_address(np, dev);
if (err) {
if (err == -EPROBE_DEFER)
return err;
dev_err(&pdev->dev, "invalid MAC address, using random address\n");
eth_hw_addr_random(dev);
}