Skip to content

Commit fb71774

Browse files
nehebrobimarko
authored andcommitted
lantiq: handle EPROBE_DEFER for MAC
If nvmem is used for ethernet mac address, we need to defer loading to get the proper mac. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: openwrt/openwrt#21955 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent bc3b417 commit fb71774

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

target/linux/lantiq/patches-6.12/028-NET-lantiq-various-etop-fixes.patch

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
766766

767767
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
768768
if (!res) {
769-
@@ -671,18 +872,54 @@ ltq_etop_probe(struct platform_device *p
769+
@@ -671,18 +872,60 @@ ltq_etop_probe(struct platform_device *p
770770
goto err_out;
771771
}
772772

@@ -805,7 +805,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
805805
+ if (err)
806806
+ pr_err("Can't find phy-mode for port\n");
807807
+
808-
+ of_get_mac_address(pdev->dev.of_node, priv->mac);
808+
+ err = of_get_mac_address(pdev->dev.of_node, priv->mac);
809+
+ if (err == -EPROBE_DEFER)
810+
+ goto err_out;
811+
+ if (err) {
812+
+ eth_hw_addr_random(dev);
813+
+ dev_err(&pdev->dev, "generated random MAC address %pM\n", priv->mac);
814+
+ }
809815
+
810816
+ priv->clk_ppe = clk_get(&pdev->dev, NULL);
811817
+ if (IS_ERR(priv->clk_ppe))
@@ -827,7 +833,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
827833
spin_lock_init(&priv->lock);
828834
SET_NETDEV_DEV(dev, &pdev->dev);
829835

830-
@@ -698,15 +935,10 @@ ltq_etop_probe(struct platform_device *p
836+
@@ -698,15 +941,10 @@ ltq_etop_probe(struct platform_device *p
831837
goto err_free;
832838
}
833839

@@ -847,7 +853,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
847853

848854
err = register_netdev(dev);
849855
if (err)
850-
@@ -733,31 +965,22 @@ static void ltq_etop_remove(struct platf
856+
@@ -733,31 +971,22 @@ static void ltq_etop_remove(struct platf
851857
}
852858
}
853859

0 commit comments

Comments
 (0)