[openwrt/openwrt] ipq40xx: glinet-b1300: fix LAN and WAN MAC address assigments

LEDE Commits lede-commits at lists.infradead.org
Sun Oct 2 23:07:03 PDT 2022


ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/606eb43b729513e07a2843e090f36c92a848c390

commit 606eb43b729513e07a2843e090f36c92a848c390
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Fri Aug 12 13:51:40 2022 +0200

    ipq40xx: glinet-b1300: fix LAN and WAN MAC address assigments
    
    When testing the DSA changes with 5.15.60 kernel, I've noticed, that the
    MAC addresses are not properly configured, there is single MAC being
    used for LAN and WAN interfaces:
    
     eth0: 94:83:c4:XX:YY:4a (MAC on sticker)
     lan1 at eth0: 94:83:c4:XX:YY:4a
     lan2 at eth0: 94:83:c4:XX:YY:4a
     wan at eth0: 94:83:c4:XX:YY:4a
     wlan0: 94:83:c4:XX:YY:4a
     wlan1: 94:83:c4:XX:YY:4b
    
    The same config, prior to the DSA conversion:
    
     lan/eth0: 94:83:c4:XX:YY:4a (MAC on sticker)
     wan/eth1: 94:83:c4:XX:YY:4b
     wlan0: 94:83:c4:XX:YY:4a
     wlan1: 94:83:c4:XX:YY:4b
    
    Settings in ART partition:
    
     root at OpenWrt:/# hexdump -C /dev/mtd7 | grep '94 83'
     00000000  94 83 c4 XX YY 4a 94 83  c4 0e YY 4b ff ff ff ff  |.....J.....K....|
     00001000  20 2f 8d 8c 01 01 94 83  c4 XX YY 4a 00 00 20 00  | /.........J.. .|
     00005000  20 2f 5a 3a 01 01 94 83  c4 XX YY 4b 00 00 20 00  | /Z:.......K.. .|
    
    So let's fix it by keeping same MAC address assigment as was done before
    DSA conversion and while at it, define `label-mac-device` as well.
    
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 .../files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
index 9e46555480..7e4519a746 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
@@ -28,6 +28,7 @@
 		led-failsafe = &power;
 		led-running = &power;
 		led-upgrade = &power;
+		label-mac-device = &swport4;
 	};
 
 	memory {
@@ -205,6 +206,14 @@
 				precal_art_5000: precal at 5000 {
 					reg = <0x5000 0x2f20>;
 				};
+
+				macaddr_gmac0: macaddr at 0 {
+					reg = <0x0 0x6>;
+				};
+
+				macaddr_gmac1: macaddr at 6 {
+					reg = <0x6 0x6>;
+				};
 			};
 
 			firmware at 180000 {
@@ -278,16 +287,24 @@
 	status = "okay";
 
 	label = "lan2";
+	nvmem-cell-names = "mac-address";
+	nvmem-cells = <&macaddr_gmac0>;
+	mac-address-increment = <2>;
 };
 
 &swport4 {
 	status = "okay";
 
 	label = "lan1";
+	nvmem-cell-names = "mac-address";
+	nvmem-cells = <&macaddr_gmac0>;
 };
 
 &swport5 {
 	status = "okay";
+
+	nvmem-cell-names = "mac-address";
+	nvmem-cells = <&macaddr_gmac1>;
 };
 
 &wifi0 {




More information about the lede-commits mailing list