bde62f3b1b8c294ffac4d4db1847148d17de2594
[openwrt/staging/aparcar.git] /
1 From 763716a55cb1f480ffe1a9702e6b5d9ea1a80a24 Mon Sep 17 00:00:00 2001
2 From: Matthew Hagan <mnhagan88@gmail.com>
3 Date: Sat, 25 Sep 2021 11:36:27 +0000
4 Subject: [PATCH] net: bgmac-platform: handle mac-address deferral
5
6 This patch is a replication of Christian Lamparter's "net: bgmac-bcma:
7 handle deferred probe error due to mac-address" patch for the
8 bgmac-platform driver [1].
9
10 As is the case with the bgmac-bcma driver, this change is to cover the
11 scenario where the MAC address cannot yet be discovered due to reliance
12 on an nvmem provider which is yet to be instantiated, resulting in a
13 random address being assigned that has to be manually overridden.
14
15 [1] https://lore.kernel.org/netdev/20210919115725.29064-1-chunkeey@gmail.com
16
17 Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
18 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
19 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 ---
22 drivers/net/ethernet/broadcom/bgmac-platform.c | 3 +++
23 1 file changed, 3 insertions(+)
24
25 --- a/drivers/net/ethernet/broadcom/bgmac-platform.c
26 +++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
27 @@ -193,6 +193,9 @@ static int bgmac_probe(struct platform_d
28 bgmac->dma_dev = &pdev->dev;
29
30 ret = of_get_mac_address(np, bgmac->net_dev->dev_addr);
31 + if (ret == -EPROBE_DEFER)
32 + return ret;
33 +
34 if (ret)
35 dev_warn(&pdev->dev,
36 "MAC address not present in device tree\n");