ath79: add wmac migration for all ar93xx/qca95xx SoCs
[openwrt/openwrt.git] / target / linux / ath79 / base-files / etc / hotplug.d / ieee80211 / 00-wifi-migration
1 #!/bin/sh
2
3 WIFI_PATH_CHANGED=0
4
5 . /lib/functions.sh
6
7 migrate_wifi_path() {
8 local section="$1"
9 local path
10
11 config_get path ${section} path
12 case ${path} in
13 "pci0000:01/0000:01:00.0")
14 board=$(board_name)
15
16 case "$board" in
17 tplink,archer-c7-v1|\
18 tplink,archer-c7-v2)
19 path="pci0000:00/0000:00:00.0"
20 WIFI_PATH_CHANGED=1
21 ;;
22 *)
23 return 0
24 ;;
25 esac
26 ;;
27 "platform/ahb/ahb:apb/18100000.wmac"|\
28 "platform/ar933x_wmac"|\
29 "platform/ar934x_wmac"|\
30 "platform/qca953x_wmac"|\
31 "platform/qca955x_wmac"|\
32 "platform/qca956x_wmac")
33 path="platform/ahb/18100000.wmac"
34 WIFI_PATH_CHANGED=1
35 ;;
36 *)
37 return 0
38 ;;
39 esac
40
41 uci set wireless.${section}.path=${path}
42 }
43
44 [ "${ACTION}" = "add" ] && {
45 [ ! -e /etc/config/wireless ] && return 0
46
47 config_load wireless
48 config_foreach migrate_wifi_path wifi-device
49
50 [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
51 }