[openwrt/openwrt] mpc85xx: convert Watchguard T10 mac-assignment to NVMEM

LEDE Commits lede-commits at lists.infradead.org
Thu Oct 17 02:23:28 PDT 2024


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

commit e2f64ce5926118bf1c65d53d06560726e85ac9b3
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Wed Nov 22 02:45:13 2023 +0100

    mpc85xx: convert Watchguard T10 mac-assignment to NVMEM
    
    MAC-addresses are stored with colons, thus they can now be referenced
    using NVMEM.
    
    Signed-off-by: David Bauer <mail at david-bauer.net>
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/16310
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../base-files/lib/preinit/10_fix_eth_mac.sh       |  5 ---
 .../files/arch/powerpc/boot/dts/firebox-t10.dts    | 36 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh
index fc4beaef1a..23d20ed08c 100644
--- a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh
+++ b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh
@@ -11,11 +11,6 @@ preinit_set_mac_address() {
 		ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
 		ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr)
 		;;
-	watchguard,firebox-t10)
-		ip link set dev eth0 address "$(mtd_get_mac_text "device_id" 0x1830)"
-		ip link set dev eth1 address "$(mtd_get_mac_text "device_id" 0x1844)"
-		ip link set dev eth2 address "$(mtd_get_mac_text "device_id" 0x1858)"
-		;;
 	esac
 }
 
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts
index 087138bbc2..7f6235ad35 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts
@@ -21,6 +21,9 @@
 		led-failsafe = &led_failover;
 		led-running = &led_mode;
 		led-upgrade = &led_attention;
+		/delete-property/ ethernet0;
+		/delete-property/ ethernet1;
+		/delete-property/ ethernet2;
 	};
 
 	memory {
@@ -105,6 +108,30 @@
 						reg = <0xc0000 0x40000>;
 						label = "device_id";
 						read-only;
+
+						nvmem-layout {
+							compatible = "fixed-layout";
+							#address-cells = <1>;
+							#size-cells = <1>;
+
+							macaddr_device_id_1830: mac-address at 1830 {
+								compatible = "mac-base";
+								reg = <0x1830 0x11>;
+								#nvmem-cell-cells = <1>;
+							};
+
+							macaddr_device_id_1844: mac-address at 1844 {
+								compatible = "mac-base";
+								reg = <0x1844 0x11>;
+								#nvmem-cell-cells = <1>;
+							};
+
+							macaddr_device_id_1858: mac-address at 1858 {
+								compatible = "mac-base";
+								reg = <0x1858 0x11>;
+								#nvmem-cell-cells = <1>;
+							};
+						};
 					};
 				};
 			};
@@ -149,18 +176,27 @@
 		enet0: ethernet at b0000 {
 			phy-handle = <&phy1>;
 			phy-connection-type = "rgmii-id";
+
+			nvmem-cells = <&macaddr_device_id_1830 0>;
+			nvmem-cell-names = "mac-address";
 		};
 
 		enet1: ethernet at b1000 {
 			tbi-handle = <&tbi_phy1>;
 			phy-handle = <&phy2>;
 			phy-connection-type = "sgmii";
+
+			nvmem-cells = <&macaddr_device_id_1844 0>;
+			nvmem-cell-names = "mac-address";
 		};
 
 		enet2: ethernet at b2000 {
 			tbi-handle = <&tbi_phy2>;
 			phy-handle = <&phy3>;
 			phy-connection-type = "sgmii";
+
+			nvmem-cells = <&macaddr_device_id_1858 0>;
+			nvmem-cell-names = "mac-address";
 		};
 
 		sdhc at 2e000 {




More information about the lede-commits mailing list