[openwrt/openwrt] mediatek: filogic: convert GL.iNet MT-2500 to use NVMEM-on-MMC

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 17 19:36:20 PST 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/49ed52b862c9f3e0dc1c1024ccd4db3bc9795122

commit 49ed52b862c9f3e0dc1c1024ccd4db3bc9795122
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Sat Feb 17 22:22:28 2024 +0000

    mediatek: filogic: convert GL.iNet MT-2500 to use NVMEM-on-MMC
    
    Use nvmem-layout in device tree instead of extracting MAC addresses
    in userspace.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../mediatek/dts/mt7981b-glinet-gl-mt2500.dts      | 54 ++++++++++++++++++++++
 .../filogic/base-files/etc/board.d/02_network      |  5 --
 2 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
index 068dd0f236..03cfe4c825 100644
--- a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
+++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
@@ -103,6 +103,8 @@
 
 	gmac0: mac at 0 {
 		compatible = "mediatek,eth-mac";
+		nvmem-cells = <&macaddr_boot1_a 0>;
+		nvmem-cell-names = "mac-address";
 		reg = <0>;
 
 		phy-mode = "2500base-x";
@@ -111,6 +113,8 @@
 
 	gmac1: mac at 1 {
 		compatible = "mediatek,eth-mac";
+		nvmem-cells = <&macaddr_boot1_a 1>;
+		nvmem-cell-names = "mac-address";
 		reg = <1>;
 		phy-mode = "gmii";
 		phy-handle = <&int_gbe_phy>;
@@ -148,4 +152,54 @@
 	vmmc-supply = <&reg_3p3v>;
 	cap-mmc-highspeed;
 	non-removable;
+
+	card at 0 {
+		compatible = "mmc-card";
+		reg = <0>;
+
+		block {
+			compatible = "block-device";
+
+			partitions {
+				block-partition-u-boot-env {
+					partname = "u-boot-env";
+					nvmem-layout {
+						compatible = "u-boot,env-layout";
+					};
+				};
+			};
+		};
+
+		boot1 {
+			compatible = "block-device";
+
+			nvmem-layout {
+				compatible = "fixed-layout";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				macaddr_boot1_a: macaddr at a {
+					compatible = "mac-base";
+					reg = <0xa 0x6>;
+					#nvmem-cell-cells = <1>;
+				};
+
+				ddns_boot1_10 at 10 {
+					reg = <0x10 0x10>;
+				};
+
+				sn_bak_boot1_20 at 20 {
+					reg = <0x20 0x10>;
+				};
+
+				sn_boot1_20 at 30 {
+					reg = <0x30 0x10>;
+				};
+
+				country_code_boot1_88 at 88 {
+					reg = <0x88 0x10>;
+				};
+			};
+		};
+	};
 };
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index caeeaaf223..683282b87c 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -129,11 +129,6 @@ mediatek_setup_macs()
 		;;
 		esac
 		;;
-	glinet,gl-mt2500)
-		label_mac="$(get_mac_binary "/dev/mmcblk0boot1" 0xA)"
-		wan_mac="$label_mac"
-		lan_mac="$(macaddr_add $label_mac 1)"
-		;;
 	h3c,magic-nx30-pro)
 		wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
 		lan_mac=$(macaddr_add "$wan_mac" 1)




More information about the lede-commits mailing list