[openwrt/openwrt] apm821xx: meraki: fix mac addresses in dts

LEDE Commits lede-commits at lists.infradead.org
Sun Sep 15 04:16:50 PDT 2024


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

commit 8d302f5ebc6e2787d01d6c6a8ef6bcc403949705
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Tue Aug 20 12:54:04 2024 -0700

    apm821xx: meraki: fix mac addresses in dts
    
    The one for the mx60 was wrong. The LAN MAC is offset by one.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/14037
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../lib/preinit/05_set_iface_mac_apm821xx          | 13 ------------
 target/linux/apm821xx/dts/meraki-mr24.dts          | 20 ++++++++++++++++++
 target/linux/apm821xx/dts/meraki-mx60.dts          | 24 ++++++++++++++++++++++
 3 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/target/linux/apm821xx/base-files/lib/preinit/05_set_iface_mac_apm821xx b/target/linux/apm821xx/base-files/lib/preinit/05_set_iface_mac_apm821xx
deleted file mode 100644
index 5f92c01931..0000000000
--- a/target/linux/apm821xx/base-files/lib/preinit/05_set_iface_mac_apm821xx
+++ /dev/null
@@ -1,13 +0,0 @@
-preinit_set_mac_address() {
-	. /lib/functions.sh
-
-	case $(board_name) in
-		meraki,mr24|\
-		meraki,mx60)
-			mac_lan=$(mtd_get_mac_binary_ubi board-config 0x66)
-			[ -n "$mac_lan" ] && ip link set eth0 address "$mac_lan"
-			;;
-	esac
-}
-
-boot_hook_add preinit_main preinit_set_mac_address
diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts
index a49a4de13f..24ae3dd13f 100644
--- a/target/linux/apm821xx/dts/meraki-mr24.dts
+++ b/target/linux/apm821xx/dts/meraki-mr24.dts
@@ -86,8 +86,25 @@
 			};
 
 			partition at 180000 {
+				compatible = "linux,ubi";
 				label = "ubi";
 				reg = <0x00180000 0x01e80000>;
+
+				volumes {
+					ubi-volume-board-config {
+						volume = "board-config";
+
+						nvmem-layout {
+							compatible = "fixed-layout";
+							#address-cells = <1>;
+							#size-cells = <1>;
+
+							macaddr_board_66: macaddr at 66 {
+								reg = <0x66 0x6>;
+							};
+						};
+					};
+				};
 			};
 		};
 	};
@@ -110,6 +127,9 @@
 &EMAC0 {
 	status = "okay";
 
+	nvmem-cells = <&macaddr_board_66>;
+	nvmem-cell-names = "mac-address";
+
 	phy-mode = "rgmii-id";
 	phy-map = <0x2>;
 	phy-address = <0x1>;
diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts
index 6e4df54bd2..10ced9fc09 100644
--- a/target/linux/apm821xx/dts/meraki-mx60.dts
+++ b/target/linux/apm821xx/dts/meraki-mx60.dts
@@ -71,8 +71,27 @@
 			};
 
 			partition at 240000 {
+				compatible = "linux,ubi";
 				label = "ubi";
 				reg = <0x00240000 0x3fdc0000>;
+
+				volumes {
+					ubi-volume-board-config {
+						volume = "board-config";
+
+						nvmem-layout {
+							compatible = "fixed-layout";
+							#address-cells = <1>;
+							#size-cells = <1>;
+
+							macaddr_board_66: macaddr at 66 {
+								compatible = "mac-base";
+								reg = <0x66 0x6>;
+								#nvmem-cell-cells = <1>;
+							};
+						};
+					};
+				};
 			};
 		};
 	};
@@ -93,6 +112,9 @@
 &EMAC0 {
 	status = "okay";
 
+	nvmem-cells = <&macaddr_board_66 0>;
+	nvmem-cell-names = "mac-address";
+
 	fixed-link {
 		speed = <1000>;
 		full-duplex;
@@ -296,6 +318,8 @@
 					label = "wan";
 					phy-mode = "internal";
 					phy-handle = <&phy_port5>;
+					nvmem-cells = <&macaddr_board_66 1>;
+					nvmem-cell-names = "mac-address";
 
 					leds {
 						#address-cells = <1>;




More information about the lede-commits mailing list