[openwrt/openwrt] ath79: mr18: use nvmem for MACs

LEDE Commits lede-commits at lists.infradead.org
Tue Feb 17 11:56:31 PST 2026


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/27a673916c350909fa569835c9fc2a1349357141

commit 27a673916c350909fa569835c9fc2a1349357141
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Wed Dec 3 21:23:33 2025 -0800

    ath79: mr18: use nvmem for MACs
    
    NVMEM in UBI support has been present for a while. Use it to get the
    MACs. Seems caldata needs to continue to be obtained through userspace.
    
    This fixes label-mac-device as it needs a mac-address nvmem cell.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/17068
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/ath79/dts/qca9557_meraki_mr18.dts     | 28 ++++++++++++++++++++++
 .../ath79/nand/base-files/etc/board.d/02_network   |  3 ---
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  3 ---
 target/linux/ath79/nand/config-default             |  1 +
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/target/linux/ath79/dts/qca9557_meraki_mr18.dts b/target/linux/ath79/dts/qca9557_meraki_mr18.dts
index 4e9b3d1e9a..3fa4e57456 100644
--- a/target/linux/ath79/dts/qca9557_meraki_mr18.dts
+++ b/target/linux/ath79/dts/qca9557_meraki_mr18.dts
@@ -127,6 +127,24 @@
 		partition at 1080000 {
 			label = "ubi";
 			reg = <0x1080000 0x6f00000>;
+
+			volumes {
+				ubi-volume-board-config {
+					volname = "board-config";
+
+					nvmem-layout {
+						compatible = "fixed-layout";
+						#address-cells = <1>;
+						#size-cells = <1>;
+
+						macaddr_board_102: macaddr at 102 {
+							compatible = "mac-base";
+							reg = <0x102 0x6>;
+							#nvmem-cell-cells = <1>;
+						};
+					};
+				};
+			};
 		};
 
 		partition at 7fe0000 {
@@ -158,6 +176,8 @@
 		compatible = "pci168c,0033";
 		reg = <0x0000 0 0 0 0>;
 		qca,no-eeprom;
+		nvmem-cells = <&macaddr_board_102 2>;
+		nvmem-cell-names = "mac-address";
 	};
 };
 
@@ -168,6 +188,8 @@
 		compatible = "pci168c,0033";
 		reg = <0x0000 0 0 0 0>;
 		qca,no-eeprom;
+		nvmem-cells = <&macaddr_board_102 3>;
+		nvmem-cell-names = "mac-address";
 	};
 };
 
@@ -184,6 +206,9 @@
 	pll-data = <0xa6000000 0xa0000101 0x80001313>;
 	phy-handle = <&phy>;
 
+	nvmem-cells = <&macaddr_board_102 0>;
+	nvmem-cell-names = "mac-address";
+
 	gmac-config {
 		device = <&gmac>;
 		rgmii-enabled = <1>;
@@ -195,4 +220,7 @@
 &wmac {
 	status = "okay";
 	qca,no-eeprom;
+
+	nvmem-cells = <&macaddr_board_102 1>;
+	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network
index 968a441617..362898630f 100644
--- a/target/linux/ath79/nand/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network
@@ -104,9 +104,6 @@ ath79_setup_macs()
 		wan_mac=$(mtd_get_mac_binary art 0x0)
 		lan_mac=$(macaddr_add "$wan_mac" 1)
 		;;
-	meraki,mr18)
-		lan_mac=$(mtd_get_mac_binary_ubi board-config 102)
-		;;
 	netgear,wndr3700-v4|\
 	netgear,wndr4300|\
 	netgear,wndr4300sw|\
diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index ca722040f6..d88bcb552f 100644
--- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -17,7 +17,6 @@ case "$FIRMWARE" in
 		else
 			caldata_extract "odm-caldata" 0x1000 0x440
 		fi
-		ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 1)
 		;;
 	*)
 		caldata_die "board $board is not supported yet"
@@ -34,7 +33,6 @@ case "$FIRMWARE" in
 		else
 			caldata_extract "odm-caldata" 0x5000 0x440
 		fi
-		ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 2)
 		;;
 	*)
 		caldata_die "board $board is not supported yet"
@@ -51,7 +49,6 @@ case "$FIRMWARE" in
 		else
 			caldata_extract "odm-caldata" 0x9000 0x440
 		fi
-		ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 3)
 		;;
 	*)
 		caldata_die "board $board is not supported yet"
diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default
index 71ce1caad7..10dc596693 100644
--- a/target/linux/ath79/nand/config-default
+++ b/target/linux/ath79/nand/config-default
@@ -16,6 +16,7 @@ CONFIG_MTD_SPI_NAND=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
 CONFIG_MTD_UBI_BLOCK=y
+CONFIG_MTD_UBI_NVMEM=y
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
 # CONFIG_PCI_AR71XX is not set
 CONFIG_POWER_RESET=y




More information about the lede-commits mailing list