diff mbox series

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

Message ID 20240803184515.23462-1-mrkiko.rs@gmail.com
State Superseded
Delegated to: Hauke Mehrtens
Headers show
Series mediatek: filogic: convert Mount Stuart series to use NVMEM-on-eMMC | expand

Commit Message

Enrico Mioso Aug. 3, 2024, 6:45 p.m. UTC
Avoids the need of setting MAC addresses in user-space.

Signed-off-by: Enrico Mioso <mrkiko.rs@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(-)

Comments

Hauke Mehrtens Oct. 20, 2024, 10:58 p.m. UTC | #1
On 8/3/24 20:45, Enrico Mioso wrote:
> Avoids the need of setting MAC addresses in user-space.
> 
> Signed-off-by: Enrico Mioso <mrkiko.rs@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(-)
> 

This was mostly superseded by
https://github.com/openwrt/openwrt/commit/3e6de5d77a8b8cda1e02250179d964b840c203fa

Hauke
diff mbox series

Patch

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@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"