6e7f20634f5ae3bcd2054b9bc5e5f372ffafc6cc
[openwrt/staging/hauke.git] /
1 From 029497e66bdc762e001880e4c85a91f35a54b1e2 Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@gmail.com>
3 Date: Sun, 19 Sep 2021 13:57:25 +0200
4 Subject: [PATCH] net: bgmac-bcma: handle deferred probe error due to
5 mac-address
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Due to the inclusion of nvmem handling into the mac-address getter
11 function of_get_mac_address() by
12 commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
13 it is now possible to get a -EPROBE_DEFER return code. Which did cause
14 bgmac to assign a random ethernet address.
15
16 This exact issue happened on my Meraki MR32. The nvmem provider is
17 an EEPROM (at24c64) which gets instantiated once the module
18 driver is loaded... This happens once the filesystem becomes available.
19
20 With this patch, bgmac_probe() will propagate the -EPROBE_DEFER error.
21 Then the driver subsystem will reschedule the probe at a later time.
22
23 Cc: Petr Štetiar <ynezz@true.cz>
24 Cc: Michael Walle <michael@walle.cc>
25 Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
26 Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
27 Signed-off-by: David S. Miller <davem@davemloft.net>
28 ---
29 drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 ++
30 1 file changed, 2 insertions(+)
31
32 --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
33 +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
34 @@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_devic
35 bcma_set_drvdata(core, bgmac);
36
37 err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
38 + if (err == -EPROBE_DEFER)
39 + return err;
40
41 /* If no MAC address assigned via device tree, check SPROM */
42 if (err) {