From ddc87cfcfe7f18529472a537ddb81290d934648c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 5 Oct 2026 18:44:59 +0200 Subject: [PATCH] qualcommax: ipq807x: ax89x: read MAC from Factory UBI volume Currently, AX89X MAC is read for the ethaddr U-Boot env variable, but this variable is only set if user interrupted boot and ran saveenv before. So, instead of relying on U-Boot, lets read the MAC from the same place as U-Boot, from the Factory UBI volume. There is also a Factory2 UBI volume, but MAC-s in both must be indentical as Factory2 is only used during upgrade to store the new versions. Factory UBI volume has 2 MAC-s, one at 0x100e and one at 0x1014. U-Boot uses the one at 0x100e and increments it by one, so we do the same. Fixes: f50435627d37 ("qualcommax: ipq60xx/ipq807x: convert to PPE networking stack") Link: #24604 Signed-off-by: Robert Marko --- .../linux/qualcommax/dts/ipq8074-rt-ax89x.dts | 48 ++++++++++++------- .../linux/qualcommax/ipq807x/config-default | 1 + 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/target/linux/qualcommax/dts/ipq8074-rt-ax89x.dts b/target/linux/qualcommax/dts/ipq8074-rt-ax89x.dts index b4b6b3ed5c1..71f3fccfd2f 100644 --- a/target/linux/qualcommax/dts/ipq8074-rt-ax89x.dts +++ b/target/linux/qualcommax/dts/ipq8074-rt-ax89x.dts @@ -455,18 +455,30 @@ partition@3e0000 { label = "0:appsblenv"; reg = <0x003e0000 0x20000>; - - nvmem-layout { - compatible = "u-boot,env"; - - macaddr_ubootenv_ethaddr: ethaddr {}; - }; }; partition@400000 { compatible = "linux,ubi"; label = "UBI_DEV"; reg = <0x00400000 0xfc00000>; + + volumes { + ubi-volume-factory { + volname = "Factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr: macaddr@1014 { + compatible = "mac-base"; + reg = <0x100e 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; }; }; }; @@ -576,7 +588,7 @@ reg = <1>; label = "lan7"; phy-handle = <&qca8337_0>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -584,7 +596,7 @@ reg = <2>; label = "lan6"; phy-handle = <&qca8337_1>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -592,7 +604,7 @@ reg = <3>; label = "lan5"; phy-handle = <&qca8337_2>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -600,7 +612,7 @@ reg = <4>; label = "lan4"; phy-handle = <&qca8337_3>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -608,7 +620,7 @@ reg = <5>; label = "lan3"; phy-handle = <&qca8337_4>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -619,7 +631,7 @@ phy-handle = <&qca8033>; managed = "in-band-status"; qca,sgmii-enable-pll; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; }; @@ -684,7 +696,7 @@ phy-handle = <&qca8075_8>; phy-mode = "qsgmii"; pcs-handle = <&uniphy0 0>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -694,7 +706,7 @@ phy-handle = <&qca8075_9>; phy-mode = "qsgmii"; pcs-handle = <&uniphy0 1>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -704,7 +716,7 @@ phy-handle = <&qca8075_a>; phy-mode = "qsgmii"; pcs-handle = <&uniphy0 2>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -714,7 +726,7 @@ phy-handle = <&qca8075_b>; phy-mode = "qsgmii"; pcs-handle = <&uniphy0 3>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -725,7 +737,7 @@ phy-mode = "10gbase-r"; managed = "in-band-status"; pcs-handle = <&uniphy1 0>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; @@ -736,7 +748,7 @@ phy-mode = "usxgmii"; managed = "in-band-status"; pcs-handle = <&uniphy2 0>; - nvmem-cells = <&macaddr_ubootenv_ethaddr>; + nvmem-cells = <&macaddr 1>; nvmem-cell-names = "mac-address"; }; }; diff --git a/target/linux/qualcommax/ipq807x/config-default b/target/linux/qualcommax/ipq807x/config-default index 000a39a520f..66d44a56b18 100644 --- a/target/linux/qualcommax/ipq807x/config-default +++ b/target/linux/qualcommax/ipq807x/config-default @@ -8,6 +8,7 @@ CONFIG_MDIO_BITBANG=y CONFIG_MDIO_GPIO=y # CONFIG_MFD_HI6421_SPMI is not set CONFIG_MFD_SPMI_PMIC=y +CONFIG_MTD_UBI_NVMEM=y CONFIG_NET_DSA_QCA8K=y CONFIG_NET_DSA_TAG_QCA=y # CONFIG_NVMEM_SPMI_SDAM is not set