]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
qualcommax: ipq807x: use ascii-env driver for Linksys MX devices
authorPaweł Owoc <frut3k7@gmail.com>
Wed, 7 May 2025 17:05:46 +0000 (19:05 +0200)
committerRobert Marko <robimarko@gmail.com>
Tue, 16 Sep 2025 13:19:54 +0000 (15:19 +0200)
ascii-env driver allows reading mac addresses directly from devinfo partition from dts level.

Additionally label mac address have been set.

Signed-off-by: Paweł Owoc <frut3k7@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18759
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx8500.dts
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi
target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network

index 5bd2f6ccad3122bfaf91581ab688e47c8385455e..b0be9a9e6f168008889b5cdd594624ec68fe7649 100644 (file)
                                label = "devinfo";
                                reg = <0x1060000 0x20000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "ascii-eq-delim-env";
+
+                                       hw_mac_addr: hw_mac_addr {
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@1080000 {
        phy-mode = "qsgmii";
        phy-handle = <&qca8075_0>;
        label = "lan1";
+       nvmem-cells = <&hw_mac_addr 1>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp2 {
        phy-mode = "qsgmii";
        phy-handle = <&qca8075_1>;
        label = "lan2";
+       nvmem-cells = <&hw_mac_addr 1>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp3 {
        phy-mode = "qsgmii";
        phy-handle = <&qca8075_2>;
        label = "lan3";
+       nvmem-cells = <&hw_mac_addr 1>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp4 {
        phy-mode = "qsgmii";
        phy-handle = <&qca8075_3>;
        label = "lan4";
+       nvmem-cells = <&hw_mac_addr 1>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp6_syn {
        phy-mode = "usxgmii";
        phy-handle = <&aqr114c>;
        label = "wan";
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &ssphy_0 {
index c56bc704cec733b5f21542a4e71958d551a81912..e623036df9d5efd51f99ed3afc6ab69b8f63738c 100644 (file)
@@ -9,6 +9,8 @@
        compatible = "linksys,homewrk", "qcom,ipq8074";
 
        aliases {
+               ethernet1 = &dp2;
+               ethernet2 = &dp3;
                ethernet3 = &dp4;
                ethernet4 = &dp5;
        };
index 5867cd42227b8bd3c839185f6f0d5e1f59ebaf0d..612ad6b50df2bf032cd4bcd6211d116ad3f3f064 100644 (file)
@@ -3,13 +3,6 @@
 
 #include "ipq8174-mx4x00.dtsi"
 
-/ {
-       aliases {
-               ethernet3 = &dp4;
-               ethernet4 = &dp5;
-       };
-};
-
 &tlmm {
        iot_pins: iot-state {
                recovery-pins {
                                label = "devinfo";
                                reg = <0x1060000 0x20000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "ascii-eq-delim-env";
+
+                                       hw_mac_addr: hw_mac_addr {
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@1080000 {
index 7946e5c54d3d44c2b175e9051780640d6a6f08b3..fb096483573776952e7cca6e70fe66b8b2bd1124 100644 (file)
@@ -9,6 +9,13 @@
 / {
        model = "Linksys MX4200v1";
        compatible = "linksys,mx4200v1", "qcom,ipq8074";
+
+       aliases {
+               ethernet1 = &dp2;
+               ethernet2 = &dp3;
+               ethernet3 = &dp4;
+               ethernet4 = &dp5;
+       };
 };
 
 &wifi {
index 44e1b72f16a7cb03cecc9abee3f5e4c26abba487..da3af3c75bc12d426d0c9df3d983a65a69844964 100644 (file)
@@ -8,6 +8,30 @@
 / {
        model = "Linksys MX4200v2";
        compatible = "linksys,mx4200v2", "qcom,ipq8074";
+
+       aliases {
+               label-mac-device = &dp2;
+       };
+};
+
+&dp2 {
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&dp3 {
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&dp4 {
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&dp5 {
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &wifi {
index 6d9b94a0bb37ac7b4bbeff541b76ed57ca634c09..7e72195b5f5fd42c11dfe0f0e592670ddf02eb9a 100644 (file)
                bootargs-find-2 = "ubi.mtd=24,2048";
                bootargs-replace-2 = "ubi.mtd=24,4096";
        };
+
+       aliases {
+               label-mac-device = &dp2;
+       };
 };
 
 &qpic_nand {
                                label = "devinfo";
                                reg = <0x1200000 0x40000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "ascii-eq-delim-env";
+
+                                       hw_mac_addr: hw_mac_addr {
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
                        };
 
                        partition@1240000 {
        status = "okay";
        phy-handle = <&qca8075_1>;
        label = "wan";
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp3 {
        status = "okay";
        phy-handle = <&qca8075_2>;
        label = "lan3";
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp4 {
        status = "okay";
        phy-handle = <&qca8075_3>;
        label = "lan2";
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &dp5 {
        status = "okay";
        phy-handle = <&qca8075_4>;
        label = "lan1";
+       nvmem-cells = <&hw_mac_addr 0>;
+       nvmem-cell-names = "mac-address";
 };
 
 &wifi {
index 84e68dae356bac7e73d1bf87e04b82eb35509129..1bd150c160bedb6dc8948651d567e85a0ed0947b 100644 (file)
        aliases {
                serial0 = &blsp1_uart5;
                serial1 = &blsp1_uart3;
-               /*
-                * Aliases as required by u-boot
-                * to patch MAC addresses
-                */
-               ethernet1 = &dp2;
-               ethernet2 = &dp3;
                led-boot = &led_system_blue;
                led-running = &led_system_blue;
                led-failsafe = &led_system_red;
index 437b3936b3e68a19006492a7a8606d08a6bc8e27..70f8a3134be4b18dbb6951f27bbdcca38c815923 100644 (file)
@@ -90,17 +90,6 @@ ipq807x_setup_macs()
                lan_mac=$(macaddr_add "$wan_mac" 1)
                label_mac="$wan_mac"
                ;;
-       linksys,mx4200v2|\
-       linksys,mx4300)
-               label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
-               [ "$(mtd_get_mac_ascii u_env eth1addr)" != "$label_mac" ] && wan_mac=$label_mac
-               [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && lan_mac=$label_mac
-               ;;
-       linksys,mx8500)
-               label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
-               lan_mac=$(macaddr_add $label_mac 1)
-               wan_mac=$label_mac
-               ;;
        tplink,deco-x80-5g)
                label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0)
                lan_mac=$(macaddr_add $label_mac 1)