mvebu: 6.6: copy files, patches & configs from 6.1
[openwrt/openwrt.git] / target / linux / mvebu / patches-6.6 / 701-mvpp2-read-mac-address-from-nvmem.patch
diff --git a/target/linux/mvebu/patches-6.6/701-mvpp2-read-mac-address-from-nvmem.patch b/target/linux/mvebu/patches-6.6/701-mvpp2-read-mac-address-from-nvmem.patch
new file mode 100644 (file)
index 0000000..1c41947
--- /dev/null
@@ -0,0 +1,27 @@
+From: Tobias Schramm <tobias@t-sys.eu>
+Subject: mvpp2: support fetching mac address from nvmem
+
+The mvpp2 driver did not query nvmem for hardware mac addresses. This
+patch adds querying of mac addresses stored in nvmem cells as a further
+fallback option before assigning a random address.
+Purposely added separately to fwnode_get_mac_address() above to maintain
+existing behaviour with builtin adapter mac address still taking
+precedence.
+
+Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
+---
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+@@ -6134,6 +6134,12 @@ static void mvpp2_port_copy_mac_addr(str
+               }
+       }
++      if (!of_get_mac_address(to_of_node(fwnode), hw_mac_addr)) {
++              *mac_from = "nvmem cell";
++              eth_hw_addr_set(dev, hw_mac_addr);
++              return;
++      }
++
+       *mac_from = "random";
+       eth_hw_addr_random(dev);
+ }