[PATCH] ath79: engenius,eXXX: fix MAC assignment

Tomasz Maciej Nowak tmn505 at gmail.com
Tue Mar 17 07:19:21 PDT 2026


W dniu 17.03.2026 o 00:11, Rosen Penev pisze:
> On Mon, Mar 16, 2026 at 3:29 PM Tomasz Maciej Nowak <tmn505 at gmail.com> wrote:
>>
>> W dniu 16.03.2026 o 22:15, Rosen Penev pisze:
>>> On Mon, Mar 16, 2026 at 12:34 PM 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.
>>> I see that there's also a wanaddr uboot variable that gets used.
>>>
>>> Would it be possible to do all the addresses based on that instead of ethaddr?
>>
>> Well, the ethaddr and wanaddr are 504 (decimal) appart in case of my device.
>> That's rather big and I don't know if other devices have similar difference.
> Ah nvm then.
>>
>>> The goal being to prevent someone(me most likely) from doing this again.
>>
>> I usually check history of the file I'm trying to change, I hope You do too :)
> Yeah. u-boot env nvmem driver came later.

Don't get me wrong, I accept fallouts on general rework, but don't like if
something gets fixed in consequence, then gets broken again because someone
didn't check history. That's unacceptable from my POV.

>>
>>>>
>>>> Fixes: d6d90566d1cd ("ath79: engenius,eXXX: use nvmem")
>>>> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>>> ---
>>>>  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 ++++----
>>>>  .../linux/ath79/dts/qca955x_senao_router-dual.dtsi  | 13 -------------
>>>>  .../ath79/generic/base-files/etc/board.d/02_network |  1 +
>>>>  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac         |  9 +++++++++
>>>>  .../base-files/lib/preinit/10_fix_eth_mac.sh        |  6 ++++++
>>>>  8 files changed, 32 insertions(+), 29 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..d6f2ebf56ffc 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 {
>>>> @@ -74,16 +71,6 @@
>>>>                                 label = "u-boot-env";
>>>>                                 reg = <0x030000 0x010000>;
>>>>                                 read-only;
>>>> -
>>>> -                               nvmem-layout {
>>>> -                                       compatible = "u-boot,env";
>>>> -                                       #address-cells = <1>;
>>>> -                                       #size-cells = <1>;
>>>> -
>>>> -                                       macaddr_uboot_eth: ethaddr {
>>>> -                                               #nvmem-cell-cells = <1>;
>>>> -                                       };
>>>> -                               };
>>>>                         };
>>>>
>>>>                         partition at 40000 {
>>>> 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
>>>> +               ;;
>>>>         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.53.0
>>>>
>> --
>> TMN


-- 
TMN



More information about the openwrt-devel mailing list