[OpenWrt-Devel] [PATCH] ath79: fix source of label MAC address for Ubiquiti XM devices
Adrian Schmutzler
freifunk at adrianschmutzler.de
Fri Nov 22 07:44:32 EST 2019
In d421a8b94489 ("ath79: read label MAC address from flash instead
of using phy0/phy1") the source of the label MAC address was changed
for devices just reading it from phy0. To get rid of the dependency
from phy startup, addresses were read directly from the flash
locations that are used to initialize the phy MAC addresses.
Unfortunately, it turned out that Ubiquiti XM devices seem to have
different flash locations than expected, and also seem to have
specific locations for different devices (all in art/EEPROM):
0xe012 AR9280 Nanostation M2 - 0x120c
0xe035 AR9280 Nanostation M3 - 0x120c
0xe1b2 AR9280 Rocket M2 - 0x120c
0xe1c3 AR9280 Rocket M3 - 0x120c
0xe1b5 AR9280 Rocket M5 - 0x120c
0xe2d5 AR9280 Bullet M2 Titanium - 0x120c
0xe2b5 AR9280 Nanobridge M5 - 0x120c
0xe202 AR9280 Bullet M2 - 0x120c
0xe232 AR9287 Nanobridge M2 - 0x110c
0xe4a2 AR9285 AirRouter - 0xa0bf
Picostation M2 - 0x120c and 0xa0bf
Nanostation Loco M2 - not in 0x120c, other locations not checked
An additional problem of the Ubiquiti device support in OpenWrt is
that we provide images that match several subvariants of the devices,
which might have different MAC address locations.
Given that reading the address from phy0 in 02_network _is_ working
for the ath79 target in general, it does not seem reasonable to
rebuild a complex MAC address retrieval mechanism which is already
present in the ath9k driver.
So, this patch reverts the label MAC address source for Ubiquiti XM
devices (and the Unifi AP) to /sys/class/ieee80211/phy0/macaddress.
This doesn't affect XW and Unifi AC devices, where the label MAC
address source is defined via device tree.
For alfa-network,ap121f the location 0x1002 is kept, as this has
been verified during device support preparation in PR #2199.
Fixes: d421a8b94489 ("ath79: read label MAC address from flash
instead of using phy0/phy1")
Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
.../generic/base-files/etc/board.d/02_network | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
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 07f3c4e83c..be6df558a6 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -282,12 +282,7 @@ ath79_setup_macs()
lan_mac=$(mtd_get_mac_binary "Board data" 2)
label_mac=$lan_mac
;;
- alfa-network,ap121f|\
- ubnt,airrouter|\
- ubnt,bullet-m|\
- ubnt,nanostation-m|\
- ubnt,rocket-m|\
- ubnt,unifi)
+ alfa-network,ap121f)
label_mac=$(mtd_get_mac_binary art 0x1002)
;;
avm,fritz300e)
@@ -392,6 +387,13 @@ ath79_setup_macs()
wan_mac=$(mtd_get_mac_text mac 0x18)
label_mac=$wan_mac
;;
+ ubnt,airrouter|\
+ ubnt,bullet-m|\
+ ubnt,nanostation-m|\
+ ubnt,rocket-m|\
+ ubnt,unifi)
+ label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
+ ;;
ubnt,routerstation|\
ubnt,routerstation-pro)
wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa)
--
2.20.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list