qualcommax: ipq807x: use ascii-env driver for Linksys MX devices

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>
This commit is contained in:
Paweł Owoc 2025-05-07 19:05:46 +02:00 committed by Robert Marko
parent 57fcb37401
commit 35a4607008
8 changed files with 82 additions and 24 deletions

View file

@ -257,6 +257,15 @@
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 {
@ -446,6 +455,8 @@
phy-mode = "qsgmii";
phy-handle = <&qca8075_0>;
label = "lan1";
nvmem-cells = <&hw_mac_addr 1>;
nvmem-cell-names = "mac-address";
};
&dp2 {
@ -453,6 +464,8 @@
phy-mode = "qsgmii";
phy-handle = <&qca8075_1>;
label = "lan2";
nvmem-cells = <&hw_mac_addr 1>;
nvmem-cell-names = "mac-address";
};
&dp3 {
@ -460,6 +473,8 @@
phy-mode = "qsgmii";
phy-handle = <&qca8075_2>;
label = "lan3";
nvmem-cells = <&hw_mac_addr 1>;
nvmem-cell-names = "mac-address";
};
&dp4 {
@ -467,6 +482,8 @@
phy-mode = "qsgmii";
phy-handle = <&qca8075_3>;
label = "lan4";
nvmem-cells = <&hw_mac_addr 1>;
nvmem-cell-names = "mac-address";
};
&dp6_syn {
@ -474,6 +491,8 @@
phy-mode = "usxgmii";
phy-handle = <&aqr114c>;
label = "wan";
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&ssphy_0 {

View file

@ -9,6 +9,8 @@
compatible = "linksys,homewrk", "qcom,ipq8074";
aliases {
ethernet1 = &dp2;
ethernet2 = &dp3;
ethernet3 = &dp4;
ethernet4 = &dp5;
};

View file

@ -3,13 +3,6 @@
#include "ipq8174-mx4x00.dtsi"
/ {
aliases {
ethernet3 = &dp4;
ethernet4 = &dp5;
};
};
&tlmm {
iot_pins: iot-state {
recovery-pins {
@ -184,6 +177,15 @@
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 {

View file

@ -9,6 +9,13 @@
/ {
model = "Linksys MX4200v1";
compatible = "linksys,mx4200v1", "qcom,ipq8074";
aliases {
ethernet1 = &dp2;
ethernet2 = &dp3;
ethernet3 = &dp4;
ethernet4 = &dp5;
};
};
&wifi {

View 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 {

View file

@ -20,6 +20,10 @@
bootargs-find-2 = "ubi.mtd=24,2048";
bootargs-replace-2 = "ubi.mtd=24,4096";
};
aliases {
label-mac-device = &dp2;
};
};
&qpic_nand {
@ -175,6 +179,15 @@
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 {
@ -246,24 +259,32 @@
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 {

View file

@ -12,12 +12,6 @@
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;

View 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)