ath79: migrate Archer C7 5GHz radio device paths
authorDavid Santamaría Rogado <howl.nsp@gmail.com>
Tue, 4 Jun 2019 20:06:17 +0000 (22:06 +0200)
committerChristian Lamparter <chunkeey@gmail.com>
Mon, 10 Jun 2019 09:25:46 +0000 (11:25 +0200)
When upgrading a TP-Link Archer C7 v2 from ar71xx to ath79,
the 5ghz radio stops working because the device path changed.

Some people subtitute the unsupported QCA9880v1 in the Archer v1
with supported QCA9880v2 radio. Since the stock radio doesn't
work, so it's safe to apply the change also for the Archer v1
images as well.

Also this patch renames the migration file and variables from
wmac to wifi.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
[removed comment, added return 0 (not that it matters since uci is
clever, see 00-wmac-migration thread), reworded commit message]

target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration [new file with mode: 0644]
target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wmac-migration [deleted file]

diff --git a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration
new file mode 100644 (file)
index 0000000..b182430
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+WIFI_PATH_CHANGED=0
+
+. /lib/functions.sh
+
+migrate_wifi_path() {
+       local section="$1"
+       local path
+
+       config_get path ${section} path
+       case ${path} in
+               "pci0000:01/0000:01:00.0")
+                       board=$(board_name)
+
+                       case "$board" in
+                               tplink,archer-c7-v1|\
+                               tplink,archer-c7-v2)
+                                       path="pci0000:00/0000:00:00.0"
+                                       WIFI_PATH_CHANGED=1
+                               ;;
+                               *)
+                                       return 0
+                               ;;
+                       esac
+               ;;
+               "platform/qca955x_wmac")
+                       path="platform/ahb/ahb:apb/18100000.wmac"
+                       WIFI_PATH_CHANGED=1
+               ;;
+               "platform/ar933x_wmac")
+                       path="platform/ahb/18100000.wmac"
+                       WIFI_PATH_CHANGED=1
+               ;;
+               *)
+                       return 0
+               ;;
+       esac
+
+       uci set wireless.${section}.path=${path}
+}
+
+[ "${ACTION}" = "add" ] && {
+       [ ! -e /etc/config/wireless ] && return 0
+
+       config_load wireless
+       config_foreach migrate_wifi_path wifi-device
+
+       [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
+}
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wmac-migration b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wmac-migration
deleted file mode 100644 (file)
index b051daf..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-WMAC_PATH_CHANGED=0
-
-. /lib/functions.sh
-
-migrate_wmac_path() {
-       local section="$1"
-       local path
-
-       config_get path ${section} path
-       case ${path} in
-               "platform/qca955x_wmac")
-                       path="platform/ahb/ahb:apb/18100000.wmac"
-                       WMAC_PATH_CHANGED=1
-               ;;
-               "platform/ar933x_wmac")
-                       path="platform/ahb/18100000.wmac"
-                       WMAC_PATH_CHANGED=1
-               ;;
-               *)
-                       return 0
-               ;;
-       esac
-
-       uci set wireless.${section}.path=${path}
-}
-
-[ "${ACTION}" = "add" ] && {
-       [ ! -e /etc/config/wireless ] && return 0
-
-       config_load wireless
-       config_foreach migrate_wmac_path wifi-device
-
-       [ "${WMAC_PATH_CHANGED}" = "1" ] && uci commit wireless
-}