Skip to contentSkip to conversation

net: bgmac-platform: handle mac-address deferral

PATCH In review Matthew Hagan 3 participants 4 messages Sep 25, 2021 – Sep 26, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: bgmac-platform: handle mac-address deferral

This patch is a replication of Christian Lamparter's "net: bgmac-bcma:
handle deferred probe error due to mac-address" patch for the bgmac-platform driver [1].

As is the case with the bgmac-bcma driver, this change is to cover the scenario where the MAC address cannot yet be discovered due to reliance on an nvmem provider which is yet to be instantiated, resulting in a random address being assigned that has to be manually overridden.

[1] https://lore.kernel.org/netdev/[email protected]

---
 drivers/net/ethernet/broadcom/bgmac-platform.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bgmac-platform.c +3 -0
index 4ab5bf64d353..df8ff839cc62 100644
@@ -192,6 +192,9 @@ static int bgmac_probe(struct platform_device *pdev)
 	bgmac->dma_dev = &pdev->dev;
 
 	ret = of_get_mac_address(np, bgmac->net_dev->dev_addr);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+
 	if (ret)
 		dev_warn(&pdev->dev,
 			 "MAC address not present in device tree\n");
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 ARM: dts: NSP: MX6X: get mac-address from eeprom

The MAC address on the MX64/MX65 series is located on the AT24 EEPROM. This is the same as other Meraki devices such as the MR32 [1].

[1] https://lore.kernel.org/linux-arm-kernel/fa8271d02ef74a687f365cebe5c55ec846963ab7.1631986106.git.chunkeey@gmail.com/

---
 arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi +8 -0
index 6519b7c61af1..5de727de6a4b 100644
@@ -39,6 +39,8 @@ led-3 {
 
 &amac2 {
 	status = "okay";
+	nvmem-cells = <&mac_address>;
+	nvmem-cell-names = "mac-address";
 };
 
 &ehci0 {
@@ -53,6 +55,12 @@ eeprom@50 {
 		reg = <0x50>;
 		pagesize = <32>;
 		read-only;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		mac_address: mac-address@66 {
+			reg = <0x66 0x6>;
+		};
 	};
 };
 
Signature · 1 line
2.27.0
Reviewed-by on v1 1/2
#2 lore raw
In reply to Matthew Hagan
Quoted 4 lines · Matthew Hagan

This patch is a replication of Christian Lamparter's "net: bgmac-bcma:
handle deferred probe error due to mac-address" patch for the bgmac-platform driver [1].

Quoted 8 lines

As is the case with the bgmac-bcma driver, this change is to cover the scenario where the MAC address cannot yet be discovered due to reliance on an nvmem provider which is yet to be instantiated, resulting in a random address being assigned that has to be manually overridden.

[1] https://lore.kernel.org/netdev/[email protected]

Andrew

Reviewed-by on v1 1/2
#3 lore raw
In reply to Matthew Hagan
Quoted 4 lines · Matthew Hagan

This patch is a replication of Christian Lamparter's "net: bgmac-bcma:
handle deferred probe error due to mac-address" patch for the bgmac-platform driver [1].

Quoted 8 lines

As is the case with the bgmac-bcma driver, this change is to cover the scenario where the MAC address cannot yet be discovered due to reliance on an nvmem provider which is yet to be instantiated, resulting in a random address being assigned that has to be manually overridden.

[1] https://lore.kernel.org/netdev/[email protected]

Signature · 1 line
Florian