diff mbox series

[OpenWrt-Devel] mpc85xx: correct TP-LINK TL-WDR4900 MAC addresses

Message ID 20191013221353.186756-1-mail@david-bauer.net
State Accepted, archived
Delegated to: David Bauer
Headers show
Series [OpenWrt-Devel] mpc85xx: correct TP-LINK TL-WDR4900 MAC addresses | expand

Commit Message

David Bauer Oct. 13, 2019, 10:13 p.m. UTC
This commit fixes TP-Link TL-WDR4900 v1 MAC address assignment.
Previously, the MAC addrss was read for the ethernet from the "config"
partition. However, the content of this partition is dependent on the
firmware which was previously installed on the device.

Switch the MAC address source to the U-Boot partition, where the MAC
address is always present at a fixed partition. The partition was
previously already used for the WiFi MAC-addresses.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 target/linux/mpc85xx/base-files/etc/board.d/02_network      | 2 +-
 .../mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Adrian Schmutzler Oct. 14, 2019, 10:33 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On Behalf Of David Bauer
> Sent: Montag, 14. Oktober 2019 00:14
> To: openwrt-devel@lists.openwrt.org
> Subject: [OpenWrt-Devel] [PATCH] mpc85xx: correct TP-LINK TL-WDR4900 MAC addresses
> 
> This commit fixes TP-Link TL-WDR4900 v1 MAC address assignment.
> Previously, the MAC addrss was read for the ethernet from the "config"
> partition. However, the content of this partition is dependent on the
> firmware which was previously installed on the device.
> 
> Switch the MAC address source to the U-Boot partition, where the MAC
> address is always present at a fixed partition. The partition was
> previously already used for the WiFi MAC-addresses.
> 
> Signed-off-by: David Bauer <mail@david-bauer.net>

Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Best

Adrian
Adrian Schmutzler Oct. 15, 2019, 4:36 p.m. UTC | #2
> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On Behalf Of Adrian Schmutzler
> Sent: Montag, 14. Oktober 2019 12:33
> To: 'David Bauer' <mail@david-bauer.net>; openwrt-devel@lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH] mpc85xx: correct TP-LINK TL-WDR4900 MAC addresses
> 
> Hi,
> 
> > -----Original Message-----
> > From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On Behalf Of David Bauer
> > Sent: Montag, 14. Oktober 2019 00:14
> > To: openwrt-devel@lists.openwrt.org
> > Subject: [OpenWrt-Devel] [PATCH] mpc85xx: correct TP-LINK TL-WDR4900 MAC addresses
> >
> > This commit fixes TP-Link TL-WDR4900 v1 MAC address assignment.
> > Previously, the MAC addrss was read for the ethernet from the "config"
> > partition. However, the content of this partition is dependent on the
> > firmware which was previously installed on the device.
> >
> > Switch the MAC address source to the U-Boot partition, where the MAC
> > address is always present at a fixed partition. The partition was
> > previously already used for the WiFi MAC-addresses.
> >
> > Signed-off-by: David Bauer <mail@david-bauer.net>
> 

This should be backported, at least for 19.07.

Best

Adrian
diff mbox series

Patch

diff --git a/target/linux/mpc85xx/base-files/etc/board.d/02_network b/target/linux/mpc85xx/base-files/etc/board.d/02_network
index f907fd2edb..aa33a4af96 100755
--- a/target/linux/mpc85xx/base-files/etc/board.d/02_network
+++ b/target/linux/mpc85xx/base-files/etc/board.d/02_network
@@ -21,7 +21,7 @@  ocedo,panda)
 tplink,tl-wdr4900-v1)
 	ucidef_add_switch "switch0" \
 		"0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
-	ucidef_set_interface_macaddr "wan" "$(mtd_get_mac_binary config 0x14c)"
+	ucidef_set_interface_macaddr "wan" "$(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) 1)"
 	;;
 *)
 	ucidef_set_interfaces_lan_wan "eth0" "eth1"
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
index 0e0d74c0d8..0998a4933a 100644
--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
@@ -49,7 +49,7 @@ 
 					#address-cells = <1>;
 					#size-cells = <1>;
 
-					partition@0 {
+					uboot: partition@0 {
 						reg = <0x0 0x0050000>;
 						label = "u-boot";
 						read-only;
@@ -67,7 +67,7 @@ 
 						label = "firmware";
 					};
 
-					config: partition@fe0000 {
+					partition@fe0000 {
 						reg = <0x00fe0000 0x00010000>;
 						label = "config";
 						read-only;
@@ -119,7 +119,7 @@ 
 		enet0: ethernet@b0000 {
 			phy-handle = <&phy0>;
 			phy-connection-type = "rgmii-id";
-			mtd-mac-address = <&config 0x144>;
+			mtd-mac-address = <&uboot 0x4fc00>;
 		};
 
 		enet1: ethernet@b1000 {