[openwrt/openwrt] ath79: ag71xx: support probe defferal for getting MAC address

LEDE Commits lede-commits at lists.infradead.org
Thu Jun 20 02:11:39 PDT 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/150d0ceab7380538798df76a5d7d3c12a3632050

commit 150d0ceab7380538798df76a5d7d3c12a3632050
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Wed Jun 19 11:26:47 2024 +0200

    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 at gmail.com>
---
 .../ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 8f2a9c7723..f63e93f978 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -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);
 	}




More information about the lede-commits mailing list