[OpenWrt-Devel] [RFC PATCH 1/3] ath79: fix wmac initialization for Zyxel NBG6716

Adrian Schmutzler freifunk at adrianschmutzler.de
Wed Apr 8 09:22:27 EDT 2020


From: Guillaume Lefebvre <guillaume at zelig.ch>

2.4 GHz Wifi on ath79 is set up in 10-ath9k-eeprom, but in ar71xx
it was done with ath79_register_wmac.

Thus, the following errors are observed on the device:
ath: phy1: Unable to initialize hardware; initialization status: -5
ath9k 18100000.wmac: failed to initialize device
ath9k: probe of 18100000.wmac failed with error -5

This patch changes the ath79 support to properly use wmac as well.
This will also require fixing the MAC address in a different way.

Signed-off-by: Guillaume Lefebvre <guillaume at zelig.ch>
[several adjustments to 10-fix-wifi-mac, use correct MAC address,
rewrite commit message]
Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

---

While the device seems to come up correctly now, the MAC adjustment
is not working (random MAC address for 2g).
---
 .../linux/ath79/dts/qca9558_zyxel_nbg6716.dts  |  2 ++
 .../etc/hotplug.d/firmware/10-ath9k-eeprom     |  4 ----
 .../etc/hotplug.d/ieee80211/10-fix-wifi-mac    | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac

diff --git a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts
index 4ad65c31e8..a495bb187b 100644
--- a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts
+++ b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts
@@ -262,6 +262,8 @@
 
 &wmac {
 	status = "okay";
+
+	mtd-cal-data = <&art 0x1000>;
 };
 
 &pcie1 {
diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index d2f8bae1ca..f5fae46dfb 100644
--- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -15,10 +15,6 @@ case "$FIRMWARE" in
 	netgear,wndr4500-v3)
 		caldata_extract "caldata" 0x1000 0x440
 		;;
-	zyxel,nbg6716)
-		caldata_extract "art" 0x1000 0x440
-		ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
-		;;
 	*)
 		caldata_die "board $board is not supported yet"
 		;;
diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac
new file mode 100644
index 0000000000..1940a5a576
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac
@@ -0,0 +1,18 @@
+[ "$ACTION" = "add" ] || exit 0
+
+PHYNBR=${DEVPATH##*/phy}
+
+[ -n $PHYNBR ] || exit 0
+
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+board=$(board_name)
+
+case $board in
+	zyxel,nbg6716)
+		# Set mac address for ath9k device
+		[ "$PHYNBR" -eq 1 ] && \
+			mtd_get_mac_ascii u-boot-env ethaddr > /sys${DEVPATH}/macaddress
+		;;
+esac
-- 
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