aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2022-09-21 10:44:32 +0200
committerRafał Miłecki <rafal@milecki.pl>2022-09-21 10:44:32 +0200
commitf33b14d11672827e0d4867313d49a9e35b82f3fc (patch)
tree381b82abfdb0890873f15c1b5efb44d34f769fd9
parent4c45c111e0bef4c991d38a2bb1a1c0032bebc8e8 (diff)
downloadupstream-f33b14d11672827e0d4867313d49a9e35b82f3fc.tar.gz
upstream-f33b14d11672827e0d4867313d49a9e35b82f3fc.tar.bz2
upstream-f33b14d11672827e0d4867313d49a9e35b82f3fc.zip
bcm4908: fix -EPROBE_DEFER support in bcm4908_enet
Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 1722e23ffcf9038114142a2129c29eb3cdec8ff9)
-rw-r--r--target/linux/bcm4908/patches-5.4/077-v5.14-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch (renamed from target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch)4
-rw-r--r--target/linux/bcm4908/patches-5.4/078-v6.1-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch61
2 files changed, 64 insertions, 1 deletions
diff --git a/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch b/target/linux/bcm4908/patches-5.4/077-v5.14-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch
index 7e82230f9a..02290c8e64 100644
--- a/target/linux/bcm4908/patches-5.4/170-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch
+++ b/target/linux/bcm4908/patches-5.4/077-v5.14-net-broadcom-bcm4908_enet-reset-DMA-rings-sw-indexes.patch
@@ -1,5 +1,6 @@
+From ddeacc4f6494e07cbb6f033627926623f3e7a9d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Tue, 22 Jun 2021 07:05:04 +0200
+Date: Tue, 22 Jun 2021 07:24:15 +0200
Subject: [PATCH] net: broadcom: bcm4908_enet: reset DMA rings sw indexes
properly
MIME-Version: 1.0
@@ -15,6 +16,7 @@ down & up sequence.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/linux/bcm4908/patches-5.4/078-v6.1-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch b/target/linux/bcm4908/patches-5.4/078-v6.1-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch
new file mode 100644
index 0000000000..de13dcf663
--- /dev/null
+++ b/target/linux/bcm4908/patches-5.4/078-v6.1-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch
@@ -0,0 +1,61 @@
+From e93a766da57fff3273bcb618edf5dfca1fb86b89 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 15 Sep 2022 15:30:13 +0200
+Subject: [PATCH] net: broadcom: bcm4908_enet: handle -EPROBE_DEFER when
+ getting MAC
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Reading MAC from OF may return -EPROBE_DEFER if underlaying NVMEM device
+isn't ready yet. In such case pass that error code up and "wait" to be
+probed later.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Link: https://lore.kernel.org/r/20220915133013.2243-1-zajec5@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/ethernet/broadcom/bcm4908_enet.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
+@@ -716,10 +716,14 @@ static int bcm4908_enet_probe(struct pla
+
+ SET_NETDEV_DEV(netdev, &pdev->dev);
+ mac = of_get_mac_address(dev->of_node);
+- if (!IS_ERR(mac))
++ if (!IS_ERR(mac)) {
+ ether_addr_copy(netdev->dev_addr, mac);
+- else
++ } else if (PTR_ERR(mac) == -EPROBE_DEFER) {
++ err = -EPROBE_DEFER;
++ goto err_dma_free;
++ } else {
+ eth_hw_addr_random(netdev);
++ }
+ netdev->netdev_ops = &bcm4908_enet_netdev_ops;
+ netdev->min_mtu = ETH_ZLEN;
+ netdev->mtu = ETH_DATA_LEN;
+@@ -728,14 +732,17 @@ static int bcm4908_enet_probe(struct pla
+ netif_napi_add(netdev, &enet->rx_ring.napi, bcm4908_enet_poll_rx, NAPI_POLL_WEIGHT);
+
+ err = register_netdev(netdev);
+- if (err) {
+- bcm4908_enet_dma_free(enet);
+- return err;
+- }
++ if (err)
++ goto err_dma_free;
+
+ platform_set_drvdata(pdev, enet);
+
+ return 0;
++
++err_dma_free:
++ bcm4908_enet_dma_free(enet);
++
++ return err;
+ }
+
+ static int bcm4908_enet_remove(struct platform_device *pdev)