[PATCH v2] ath79: engenius,eXXX: fix MAC assignment
Tomasz Maciej Nowak
tmn505 at gmail.com
Mon May 4 12:41:50 PDT 2026
W dniu 4.05.2026 o 21:07, Rosen Penev pisze:
> On Mon, May 4, 2026 at 10:43 AM Tomasz Maciej Nowak <tmn505 at terefe.re> wrote:
>>
>> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>
>> Partially revert d6d90566d1cd. Unfortunately the ethaddr value in U-Boot
>> environment is enclosed in double quotes which makes it longer than
>> ETH_ALEN, thus nvmem returns EINVAL. Switch back to handling the MAC
>> addresses in user space.
>> While at it, specify proper environment size.
>>
>> Fixes: d6d90566d1cd ("ath79: engenius,eXXX: use nvmem")
>> Fixes: https://github.com/openwrt/openwrt/issues/22963
>> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>> ---
>>
>> v2
>> Keep nvmem node.
>> Specify correct environment size.
>> Add Fixes tag.
>>
>> target/linux/ath79/dts/qca9557_engenius_esr1200.dts | 8 ++++----
>> target/linux/ath79/dts/qca9558_engenius_epg5000.dts | 8 ++++----
>> target/linux/ath79/dts/qca9558_engenius_esr1750.dts | 8 ++++----
>> target/linux/ath79/dts/qca9558_engenius_esr900.dts | 8 ++++----
>> target/linux/ath79/dts/qca955x_senao_router-dual.dtsi | 10 +---------
>> .../ath79/generic/base-files/etc/board.d/02_network | 1 +
>> .../base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | 9 +++++++++
>> .../generic/base-files/lib/preinit/10_fix_eth_mac.sh | 6 ++++++
>> 8 files changed, 33 insertions(+), 25 deletions(-)
>>
>> diff --git a/target/linux/ath79/dts/qca9557_engenius_esr1200.dts b/target/linux/ath79/dts/qca9557_engenius_esr1200.dts
>> index 5faf3277fab7..23dd0523354b 100644
>> --- a/target/linux/ath79/dts/qca9557_engenius_esr1200.dts
>> +++ b/target/linux/ath79/dts/qca9557_engenius_esr1200.dts
>> @@ -80,13 +80,13 @@
>> };
>>
>> &wmac {
>> - nvmem-cells = <&calibration_art_1000>, <&macaddr_uboot_eth 1>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_1000>;
>> + nvmem-cell-names = "calibration";
>> };
>>
>> &wifi0 {
>> compatible = "qcom,ath10k";
>>
>> - nvmem-cells = <&calibration_art_5000>, <&macaddr_uboot_eth 0>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_5000>;
>> + nvmem-cell-names = "calibration";
>> };
>> diff --git a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts
>> index 560436b0df9b..1ad6d0f8dd10 100644
>> --- a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts
>> +++ b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts
>> @@ -80,13 +80,13 @@
>> };
>>
>> &wmac {
>> - nvmem-cells = <&calibration_art_1000>, <&macaddr_uboot_eth 1>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_1000>;
>> + nvmem-cell-names = "calibration";
>> };
>>
>> &wifi0 {
>> compatible = "qcom,ath10k";
>>
>> - nvmem-cells = <&calibration_art_5000>, <&macaddr_uboot_eth 0>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_5000>;
>> + nvmem-cell-names = "calibration";
>> };
>> diff --git a/target/linux/ath79/dts/qca9558_engenius_esr1750.dts b/target/linux/ath79/dts/qca9558_engenius_esr1750.dts
>> index 52075d248133..adb6ba3dd245 100644
>> --- a/target/linux/ath79/dts/qca9558_engenius_esr1750.dts
>> +++ b/target/linux/ath79/dts/qca9558_engenius_esr1750.dts
>> @@ -80,13 +80,13 @@
>> };
>>
>> &wmac {
>> - nvmem-cells = <&calibration_art_1000>, <&macaddr_uboot_eth 1>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_1000>;
>> + nvmem-cell-names = "calibration";
>> };
>>
>> &wifi0 {
>> compatible = "qcom,ath10k";
>>
>> - nvmem-cells = <&calibration_art_5000>, <&macaddr_uboot_eth 0>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_5000>;
>> + nvmem-cell-names = "calibration";
>> };
>> diff --git a/target/linux/ath79/dts/qca9558_engenius_esr900.dts b/target/linux/ath79/dts/qca9558_engenius_esr900.dts
>> index 9ceacb0199b0..c8f37645a4e4 100644
>> --- a/target/linux/ath79/dts/qca9558_engenius_esr900.dts
>> +++ b/target/linux/ath79/dts/qca9558_engenius_esr900.dts
>> @@ -80,13 +80,13 @@
>> };
>>
>> &wmac {
>> - nvmem-cells = <&calibration_art_1000>, <&macaddr_uboot_eth 0>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_1000>;
>> + nvmem-cell-names = "calibration";
>> };
>>
>> &wifi0 {
>> compatible = "pci168c,0033";
>>
>> - nvmem-cells = <&calibration_art_5000>, <&macaddr_uboot_eth 1>;
>> - nvmem-cell-names = "calibration", "mac-address";
>> + nvmem-cells = <&calibration_art_5000>;
>> + nvmem-cell-names = "calibration";
>> };
>> diff --git a/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi b/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi
>> index b8680772ce11..e47d34e374bf 100644
>> --- a/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi
>> +++ b/target/linux/ath79/dts/qca955x_senao_router-dual.dtsi
>> @@ -30,9 +30,6 @@
>>
>> phy-handle = <&phy0>;
>> pll-data = <0xa6000000 0x00000101 0x00001616>;
>> -
>> - nvmem-cells = <&macaddr_uboot_eth 0>;
>> - nvmem-cell-names = "mac-address";
>> };
>>
>> &mdio0 {
>> @@ -77,12 +74,7 @@
>>
>> nvmem-layout {
>> compatible = "u-boot,env";
>> - #address-cells = <1>;
>> - #size-cells = <1>;
>> -
>> - macaddr_uboot_eth: ethaddr {
>> - #nvmem-cell-cells = <1>;
>> - };
>> + env-size = <0x1000>;
>> };
>> };
>>
>> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
>> index 1d5ddc605c43..f409c1c89739 100644
>> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
>> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
>> @@ -735,6 +735,7 @@ ath79_setup_macs()
>> engenius,esr1200|\
>> engenius,esr1750|\
>> engenius,esr900)
>> + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
>> wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
>> ;;
>> hak5,lan-turtle|\
>> diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>> index 0ef322e898ec..d8a92f227cef 100644
>> --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>> +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>> @@ -93,6 +93,15 @@ case "$board" in
>> [ "$PHYNBR" -eq 1 ] && \
>> mtd_get_mac_ascii devdata wlan24mac > /sys${DEVPATH}/macaddress
>> ;;
>> + engenius,epg5000|\
>> + engenius,esr1200|\
>> + engenius,esr1750|\
>> + engenius,esr900)
>> + [ "$PHYNBR" -eq 0 ] && \
>> + macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
>> + [ "$PHYNBR" -eq 1 ] && \
>> + macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 0 > /sys${DEVPATH}/macaddress
>> + ;;
> does uboot have a different variable by any chance? I see a different
> engenius device uses athaddr.
There is only wlanaddr but it has generic value of 00:AA:BB:CC:DD:12,
so nothing usable.
>> phicomm,k2t)
>> [ "$PHYNBR" -eq 0 ] && \
>> k2t_get_mac "5g_mac" > /sys${DEVPATH}/macaddress
>> diff --git a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
>> index 1126a1eefc02..4b6cb7b6ede0 100644
>> --- a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
>> +++ b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
>> @@ -12,6 +12,12 @@ preinit_set_mac_address() {
>> ip link set dev eth0 address $(mtd_get_mac_ascii bdcfg "lanmac")
>> ip link set dev eth1 address $(mtd_get_mac_ascii bdcfg "wanmac")
>> ;;
>> + engenius,epg5000|\
>> + engenius,esr1200|\
>> + engenius,esr1750|\
>> + engenius,esr900)
>> + ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env ethaddr)
>> + ;;
>> siemens,ws-ap3610)
>> ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
>> ;;
>> --
>> 2.54.0
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
--
TMN
More information about the openwrt-devel
mailing list