Jelajahi Sumber

ramips: mt7621: set mac address in dts for DBDC

Support in mt76 has existed for quite a while. Use it.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19806
Signed-off-by: Hauke Mehrtens <[email protected]>
Rosen Penev 4 bulan lalu
induk
melakukan
75c4d43975

+ 13 - 0
target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts

@@ -64,6 +64,15 @@
 		reg = <0x0000 0 0 0 0>;
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_8004>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
@@ -104,6 +113,10 @@
 						reg = <0x0 0xe00>;
 					};
 
+					macaddr_factory_8004: macaddr@8004 {
+						reg = <0x8004 0x6>;
+					};
+
 					macaddr_factory_e000: macaddr@e000 {
 						compatible = "mac-base";
 						reg = <0xe000 0x6>;

+ 18 - 1
target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts

@@ -143,7 +143,9 @@
 				};
 
 				macaddr_factory_4: macaddr@4 {
+					compatible = "mac-base";
 					reg = <0x4 0x6>;
+					#nvmem-cell-cells = <1>;
 				};
 
 				precal_factory_e10: precal@e10 {
@@ -192,6 +194,21 @@
 		nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
 		nvmem-cell-names = "eeprom", "precal";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_factory_4 1>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_4 4>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
@@ -200,7 +217,7 @@
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 0>;
 	nvmem-cell-names = "mac-address";
 };
 

+ 17 - 2
target/linux/ramips/dts/mt7621_dlink_dir-853-a1.dts

@@ -126,7 +126,9 @@
 					};
 
 					macaddr_factory_e000: macaddr@e000 {
+						compatible = "mac-base";
 						reg = <0xe000 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 
 					macaddr_factory_e006: macaddr@e006 {
@@ -169,12 +171,25 @@
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
 
-		/* The correct Mac addresses are set in 10_fix_wifi_mac. */
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_factory_e000 1>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_e000 2>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_factory_e000>;
+	nvmem-cells = <&macaddr_factory_e000 0>;
 	nvmem-cell-names = "mac-address";
 };
 

+ 18 - 2
target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi

@@ -110,7 +110,9 @@
 					};
 
 					macaddr_factory_e000: macaddr@e000 {
+						compatible = "mac-base";
 						reg = <0xe000 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -134,12 +136,26 @@
 		reg = <0x0000 0 0 0 0>;
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
-		/* The correct MAC addresses are set in 10_fix_wifi_mac. */
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_factory_e000 1>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_e000 2>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_factory_e000>;
+	nvmem-cells = <&macaddr_factory_e000 0>;
 	nvmem-cell-names = "mac-address";
 };
 

+ 15 - 0
target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts

@@ -101,6 +101,12 @@
 						reg = <0x0 0x4da8>;
 					};
 
+					macaddr_factory_4: macaddr@4 {
+						compatible = "mac-base";
+						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
+
 					macaddr_factory_4000: macaddr@4000 {
 						compatible = "mac-base";
 						reg = <0x4000 0x6>;
@@ -128,6 +134,15 @@
 		reg = <0x0000 0 0 0 0>;
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_4 1>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 

+ 12 - 1
target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts

@@ -132,7 +132,9 @@
 					};
 
 					macaddr_factory_4: macaddr@4 {
+						compatible = "mac-base";
 						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 
 					macaddr_factory_28: macaddr@28 {
@@ -215,6 +217,15 @@
 		reg = <0x0000 0 0 0 0>;
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_4 2>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
@@ -223,7 +234,7 @@
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_factory_4>;
+	nvmem-cells = <&macaddr_factory_4 0>;
 	nvmem-cell-names = "mac-address";
 };
 

+ 17 - 2
target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts

@@ -125,9 +125,24 @@
 	wifi@0,0 {
 		compatible = "mediatek,mt76";
 		reg = <0x0000 0 0 0 0>;
-		nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_8 0>;
-		nvmem-cell-names = "eeprom", "mac-address";
+		nvmem-cells = <&eeprom_radio_0>;
+		nvmem-cell-names = "eeprom";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_config_8 0>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_config_8 (-1)>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 

+ 13 - 0
target/linux/ramips/dts/mt7621_snr_snr-cpe-me2-sfp.dts

@@ -111,6 +111,10 @@
 						reg = <0x0 0x4da8>;
 					};
 
+					macaddr_factory_8004: macaddr@8004 {
+						reg = <0x8004 0x6>;
+					};
+
 					macaddr_factory_e000: macaddr@e000 {
 						reg = <0xe000 0x6>;
 					};
@@ -200,5 +204,14 @@
 		reg = <0x0000 0 0 0 0>;
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_8004>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };

+ 15 - 0
target/linux/ramips/dts/mt7621_totolink_x5000r.dts

@@ -83,6 +83,12 @@
 						reg = <0x0 0xe00>;
 					};
 
+					macaddr_factory_4: macaddr@0 {
+						compatible = "mac-base";
+						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
+
 					macaddr_factory_e000: macaddr@e000 {
 						reg = <0xe000 0x6>;
 					};
@@ -113,6 +119,15 @@
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_4 4>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 

+ 17 - 2
target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts

@@ -161,9 +161,24 @@
 	wifi@0,0 {
 		compatible = "mediatek,mt76";
 		reg = <0x0000 0 0 0 0>;
-		nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_8 0>;
-		nvmem-cell-names = "eeprom", "mac-address";
+		nvmem-cells = <&eeprom_radio_0>;
+		nvmem-cell-names = "eeprom";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_config_8 0>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_config_8 (-1)>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 

+ 18 - 1
target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts

@@ -79,7 +79,9 @@
 					#size-cells = <1>;
 
 					macaddr: macaddr@8 {
+						compatible = "mac-base";
 						reg = <0x8 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -145,11 +147,26 @@
 		nvmem-cells = <&eeprom_radio_0>;
 		nvmem-cell-names = "eeprom";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr 0>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr 1>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr>;
+	nvmem-cells = <&macaddr 0>;
 	nvmem-cell-names = "mac-address";
 };
 

+ 19 - 2
target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts

@@ -99,7 +99,9 @@
 					#size-cells = <1>;
 
 					macaddr_info_8: macaddr@8 {
+						compatible = "mac-base";
 						reg = <0x8 0x6>;
+						#nvmem-cell-cells = <1>;
 					};
 				};
 			};
@@ -165,11 +167,26 @@
 		nvmem-cells = <&eeprom_radio_0>;
 		nvmem-cell-names = "eeprom";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_info_8 0>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_info_8 1>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_info_8>;
+	nvmem-cells = <&macaddr_info_8 0>;
 	nvmem-cell-names = "mac-address";
 };
 
@@ -178,7 +195,7 @@
 	label = "lan0";
 	phy-handle = <&ethphy0>;
 
-	nvmem-cells = <&macaddr_info_8>;
+	nvmem-cells = <&macaddr_info_8 0>;
 	nvmem-cell-names = "mac-address";
 };
 

+ 17 - 2
target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts

@@ -199,9 +199,24 @@
 	wifi@0,0 {
 		compatible = "mediatek,mt76";
 		reg = <0x0000 0 0 0 0>;
-		nvmem-cells = <&eeprom_radio_0>, <&precal_radio_e10>, <&macaddr_rom_file_f100 0>;
-		nvmem-cell-names = "eeprom", "precal", "mac-address";
+		nvmem-cells = <&eeprom_radio_0>, <&precal_radio_e10>;
+		nvmem-cell-names = "eeprom", "precal";
 		mediatek,disable-radar-background;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@0 {
+			reg = <0>;
+			nvmem-cells = <&macaddr_rom_file_f100 0>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_rom_file_f100 2>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 

+ 15 - 0
target/linux/ramips/dts/mt7621_z-router_zr-2660.dts

@@ -135,6 +135,12 @@
 					reg = <0x0 0xe00>;
 				};
 
+				macaddr_factory_4: macaddr@4 {
+					compatible = "mac-base";
+					reg = <0x4 0x6>;
+					#nvmem-cell-cells = <1>;
+				};
+
 				macaddr_factory_3fff4: macaddr@3fff4 {
 					reg = <0x3fff4 0x6>;
 				};
@@ -179,6 +185,15 @@
 
 		nvmem-cells = <&eeprom_factory_0>;
 		nvmem-cell-names = "eeprom";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		band@1 {
+			reg = <1>;
+			nvmem-cells = <&macaddr_factory_4 1>;
+			nvmem-cell-names = "mac-address";
+		};
 	};
 };
 

+ 0 - 52
target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

@@ -41,25 +41,12 @@ case "$board" in
 		[ "$PHYNBR" = "1" ] && \
 			macaddr_add $lan_mac_addr 8 > /sys${DEVPATH}/macaddress
 		;;
-	comfast,cf-e390ax)
-		[ "$PHYNBR" = "0" ] && echo -n "$(mtd_get_mac_binary factory 0x0004)" > /sys${DEVPATH}/macaddress
-		[ "$PHYNBR" = "1" ] && echo -n "$(mtd_get_mac_binary factory 0x8004)" > /sys${DEVPATH}/macaddress
-		;;
 	cudy,x6-v1|\
 	cudy,x6-v2)
 		hw_mac_addr="$(mtd_get_mac_binary bdinfo 0xde00)"
 		[ "$PHYNBR" = "1" ] && \
 		macaddr_setbit_la "$(macaddr_add $hw_mac_addr 0x100000)" > /sys${DEVPATH}/macaddress
 		;;
-	dlink,dap-1620-b1|\
-	dlink,dir-853-a1|\
-	dlink,dra-1360-a1)
-		lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)"
-		[ "$PHYNBR" = "0" ] && \
-			macaddr_add $lan_mac_addr 1 > /sys${DEVPATH}/macaddress
-		[ "$PHYNBR" = "1" ] && \
-			macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
-		;;
 	dlink,covr-x1860-a1)
 		label_mac=$(mtd_get_mac_ascii config2 factory_mac)
 		[ "$PHYNBR" = "0" ] && \
@@ -67,13 +54,6 @@ case "$board" in
 		[ "$PHYNBR" = "1" ] && \
 			macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress
 		;;
-	dlink,dap-x1860-a1)
-		hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
-		[ "$PHYNBR" = "0" ] && \
-			macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
-		[ "$PHYNBR" = "1" ] && \
-			macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress
-		;;
 	dlink,dir-3040-a1)
 		lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)"
 		[ "$PHYNBR" = "0" ] && \
@@ -91,11 +71,6 @@ case "$board" in
 			macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress
 		fi
 		;;
-	glinet,gl-mt1300|\
-	z-router,zr-2660)
-		[ "$PHYNBR" = "1" ] && \
-			macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress
-		;;
 	h3c,tx1800-plus|\
 	h3c,tx1801-plus|\
 	h3c,tx1806)
@@ -136,11 +111,6 @@ case "$board" in
 		[ "$PHYNBR" = "0" ] && echo $hw_mac_addr > /sys${DEVPATH}/macaddress
 		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 0x800000 > /sys${DEVPATH}/macaddress
 		;;
-	keenetic,kn-1910)
-		lan_mac_addr="$(mtd_get_mac_binary RF-EEPROM 0x4)"
-		[ "$PHYNBR" = "1" ] && \
-			macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
-		;;
 	keenetic,kn-3510)
 		[ "$PHYNBR" = "1" ] && \
 			macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress
@@ -185,11 +155,6 @@ case "$board" in
 		[ "$PHYNBR" = "0" ] && echo -n "$hw_mac_2g" > /sys${DEVPATH}/macaddress
 		[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_5g" > /sys${DEVPATH}/macaddress
 		;;
-	mercusys,mr70x-v1|\
-	tplink,archer-ax23-v1)
-		hw_mac_addr="$(mtd_get_mac_binary config 0x8)"
-		[ "$PHYNBR" = "1" ] &&  macaddr_add "$hw_mac_addr" -1 > "/sys${DEVPATH}/macaddress"
-		;;
 	mts,wg430223)
 		hw_mac_addr=$(macaddr_add $(mtd_get_mac_encrypted_arcadyan "board_data") 1)
 		[ "$PHYNBR" = "0" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
@@ -213,27 +178,10 @@ case "$board" in
 		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
 		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
 		;;
-	snr,snr-cpe-me2-sfp)
-		hw_mac_addr="$(mtd_get_mac_binary factory 0x8004)"
-		[ "$PHYNBR" = "1" ] &&  echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress
-		;;
 	tenbay,t-mb5eu-v01)
 		hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
 		[ "$PHYNBR" = "1" ] &&  macaddr_add $hw_mac_addr "0x100000" > /sys${DEVPATH}/macaddress
 		;;
-	totolink,x5000r)
-		hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
-		[ "$PHYNBR" = "1" ] &&  macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress
-		;;
-	tplink,eap613-v1|\
-	tplink,eap615-wall-v1)
-		hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)"
-		macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress"
-		;;
-	tplink,ex220-v1)
-		hw_mac_addr="$(mtd_get_mac_binary rom_file 0xf100)"
-		[ "$PHYNBR" = "1" ] &&  macaddr_add "$hw_mac_addr" 2 > "/sys${DEVPATH}/macaddress"
-		;;
 	yuncore,ax820|\
 	yuncore,g720)
 		[ "$PHYNBR" = "1" ] && \