[PATCH] mediatek: filogic: convert Mount Stuart series to use NVMEM-on-eMMC

Enrico Mioso mrkiko.rs at gmail.com
Sat Aug 3 11:45:12 PDT 2024


Avoids the need of setting MAC addresses in user-space.

Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
 .../dts/mt7988a-smartrg-mt-stuart.dtsi        | 30 +++++++++++++++++++
 .../base-files/lib/preinit/10_fix_eth_mac.sh  |  4 +--
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
index fac267abf4..d05271e8a2 100644
--- a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
+++ b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
@@ -251,12 +251,16 @@
 
 &gmac0 {
 	status = "okay";
+	nvmem-cells = <&macaddr_mfginfo 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &gmac1 {
 	label = "wan";
 	status = "okay";
 	phy-mode = "usxgmii";
+	nvmem-cells = <&macaddr_mfginfo 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &gmac2 {
@@ -265,6 +269,8 @@
 	phy-mode = "usxgmii";
 	phy-connection-type = "usxgmii";
 	phy = <&phy8>;
+	nvmem-cells = <&macaddr_mfginfo 1>;
+	nvmem-cell-names = "mac-address";
 };
 
 &gsw_phy0 {
@@ -500,6 +506,14 @@
 			compatible = "block-device";
 
 			partitions {
+				block-partition-u-boot-env {
+					partname = "u-boot-env";
+
+					nvmem-layout {
+						compatible = "u-boot,env";
+					};
+				};
+
 				block-partition-factory {
 					partname = "factory";
 
@@ -513,6 +527,22 @@
 						};
 					};
 				};
+
+				block-partition-mfginfo {
+					partname = "mfginfo";
+
+					nvmem-layout {
+						compatible = "fixed-layout";
+						#address-cells = <1>;
+						#size-cells = <1>;
+
+						macaddr_mfginfo: macaddr at 1D {
+							compatible = "mac-base";
+							reg = <0x1d 0x11>;
+							#nvmem-cell-cells = <1>;
+						};
+					};
+				};
 			};
 		};
 	};
diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
index fefca2327b..09e738883c 100644
--- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
@@ -23,9 +23,7 @@ preinit_set_mac_address() {
 		ip link set dev eth1 address "$(macaddr_add $addr 1)"
 		;;
 	smartrg,sdg-8612|\
-	smartrg,sdg-8614|\
-	smartrg,sdg-8733|\
-	smartrg,sdg-8734)
+	smartrg,sdg-8614)
 		addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
 		lan_addr=$(macaddr_add $addr 1)
 		ip link set dev wan address "$addr"
-- 
2.46.0




More information about the openwrt-devel mailing list