convert mtd-mac-address to nvmem implementation

e9hack e9hack at gmail.com
Mon Jul 19 09:42:22 PDT 2021


Am 19.07.2021 um 16:41 schrieb Ansuel Smith:
> The dts has been migrated with a script and we decided to remove the
> dtsi that caused some compilation problem.
> We still need to take a decision for the device that have dtsi that
> declare mtd-mac-address using partition tag declared in user dts
> (dtsi use partition declared in the dts)

For testing, I shifted the uboot partition definition from user dts file to the main dtsi file. Uboot partition definition is in all user dts files the same. MAC address's and partition layout looks fine.

Regards,
Hartmut

diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
index 3f965f5b95..1c72047a3a 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
@@ -146,10 +147,19 @@
  	};
  };
  
+&mtdparts {
+	uboot: partition at 0 {
+		label = "u-boot";
+		reg = <0x000000 0x020000>;
+		read-only;
+	};
+};
+
  &eth0 {
  	status = "okay";
  
-	mtd-mac-address = <&uboot 0x1fc00>;
+	nvmem-cells = <&macaddr_uboot_1fc00>;
+	nvmem-cell-names = "mac-address";
  	mac-address-increment = <1>;
  	phy-handle = <&phy0>;
  	pll-data = <0x56000000 0x00000101 0x00001616>;
@@ -163,7 +173,8 @@
  &eth1 {
  	status = "okay";
  
-	mtd-mac-address = <&uboot 0x1fc00>;
+	nvmem-cells = <&macaddr_uboot_1fc00>;
+	nvmem-cell-names = "mac-address";
  	pll-data = <0x03000101 0x00000101 0x00001616>;
  
  	fixed-link {
@@ -176,5 +187,17 @@
  	status = "okay";
  
  	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&uboot 0x1fc00>;
+	nvmem-cells = <&macaddr_uboot_1fc00>;
+	nvmem-cell-names = "mac-address";
  };
+
+&uboot {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_uboot_1fc00: macaddr at 1fc00 {
+		reg = <0x1fc00 0x6>;
+	};
+};
+
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
index be99b8e3e4..785b4f8675 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
@@ -25,12 +25,6 @@
  };
  
  &mtdparts {
-	uboot: partition at 0 {
-		label = "u-boot";
-		reg = <0x000000 0x020000>;
-		read-only;
-	};
-
  	partition at 20000 {
  		label = "firmware";
  		reg = <0x020000 0xfd0000>;
  




More information about the openwrt-devel mailing list