ath79: convert ath10k pre-calibration data to NVMEM (ASCII MAC)
[openwrt/staging/dangole.git] / target / linux / ath79 / generic / base-files / etc / hotplug.d / firmware / 11-ath10k-caldata
1 #!/bin/sh
2
3 [ -e /lib/firmware/$FIRMWARE ] && exit 0
4
5 . /lib/functions/caldata.sh
6
7 board=$(board_name)
8
9 case "$FIRMWARE" in
10 "ath10k/cal-pci-0000:00:00.0.bin")
11 case $board in
12 allnet,all-wap02860ac|\
13 araknis,an-500-ap-i-ac|\
14 araknis,an-700-ap-i-ac|\
15 comfast,cf-e380ac-v2|\
16 engenius,enstationac-v1|\
17 glinet,gl-x750|\
18 watchguard,ap300)
19 caldata_extract "art" 0x5000 0x844
20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 2)
21 ;;
22 asus,pl-ac56|\
23 asus,rp-ac66|\
24 comfast,cf-wr650ac-v1|\
25 comfast,cf-wr650ac-v2|\
26 devolo,dlan-pro-1200plus-ac|\
27 devolo,magic-2-wifi|\
28 joyit,jt-or750i|\
29 qxwlan,e1700ac-v2-8m|\
30 qxwlan,e1700ac-v2-16m|\
31 qxwlan,e600gac-v2-8m|\
32 qxwlan,e600gac-v2-16m|\
33 sophos,ap15|\
34 sophos,ap55|\
35 sophos,ap55c|\
36 sophos,ap100|\
37 sophos,ap100c|\
38 ubnt,bullet-ac|\
39 ubnt,uk-ultra|\
40 ubnt,unifiac-lite|\
41 ubnt,unifiac-lr|\
42 ubnt,unifiac-mesh|\
43 ubnt,unifiac-mesh-pro|\
44 ubnt,lap-120|\
45 ubnt,litebeam-ac-gen2|\
46 ubnt,nanobeam-ac|\
47 ubnt,nanobeam-ac-gen2|\
48 ubnt,nanobeam-ac-xc|\
49 ubnt,nanostation-ac|\
50 ubnt,nanostation-ac-loco|\
51 ubnt,powerbeam-5ac-500|\
52 ubnt,powerbeam-5ac-gen2|\
53 ubnt,rocket-5ac-lite|\
54 ubnt,unifiac-pro|\
55 yuncore,a770|\
56 yuncore,xd3200)
57 caldata_extract "art" 0x5000 0x844
58 ;;
59 avm,fritz1750e|\
60 avm,fritzdvbc)
61 caldata_extract "urlader" 0x198a 0x844
62 ;;
63 devolo,dvl1200e|\
64 devolo,dvl1200i|\
65 devolo,dvl1750c|\
66 devolo,dvl1750e|\
67 devolo,dvl1750i|\
68 devolo,dvl1750x)
69 caldata_extract "art" 0x5000 0x844
70 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) -1)
71 ;;
72 engenius,ecb1200|\
73 engenius,ecb1750)
74 caldata_extract "art" 0x5000 0x844
75 ath10k_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr)
76 ;;
77 engenius,ews511ap)
78 caldata_extract "art" 0x5000 0x844
79 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) 1)
80 ;;
81 extreme-networks,ws-ap3805i)
82 caldata_extract "art" 0x5000 0x844
83 ath10k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR0)
84 ;;
85 glinet,gl-ar750)
86 caldata_extract "art" 0x5000 0x844
87 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 1)
88 ;;
89 iodata,wn-ac1167dgr|\
90 iodata,wn-ac1600dgr2|\
91 sitecom,wlr-7100|\
92 zyxel,nbg6616)
93 caldata_extract "art" 0x5000 0x844
94 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1)
95 ;;
96 nec,wg800hp)
97 caldata_extract "art" 0x5000 0x844
98 ath10k_patch_mac $(mtd_get_mac_text board_data 0x880)
99 ;;
100 ocedo,koala|\
101 ocedo,ursus)
102 caldata_extract "art" 0x5000 0x844
103 ath10k_patch_mac $(mtd_get_mac_binary art 0xc)
104 ;;
105 openmesh,a40|\
106 openmesh,a60|\
107 openmesh,mr1750-v1|\
108 openmesh,mr1750-v2|\
109 openmesh,om5p-ac-v2)
110 caldata_extract "ART" 0x5000 0x844
111 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) 16)
112 ;;
113 qihoo,c301)
114 caldata_extract "radiocfg" 0x5000 0x844
115 ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
116 ;;
117 tplink,archer-a7-v5|\
118 tplink,archer-c2-v3|\
119 tplink,archer-c7-v4|\
120 tplink,archer-c7-v5|\
121 tplink,archer-c25-v1|\
122 tplink,tl-wr902ac-v1)
123 caldata_extract "art" 0x5000 0x844
124 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1)
125 ;;
126 tplink,archer-c5-v1|\
127 tplink,tl-wdr7500-v3)
128 caldata_extract "art" 0x5000 0x844
129 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x1fc00) -1)
130 ;;
131 tplink,archer-d50-v1)
132 caldata_extract "art" 0x5000 0x844
133 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary romfile 0xf100) 2)
134 ;;
135 tplink,archer-d7-v1|\
136 tplink,archer-d7b-v1)
137 caldata_extract "art" 0x5000 0x844
138 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary romfs 0xf100) 2)
139 ;;
140 tplink,re350k-v1)
141 caldata_extract "art" 0x5000 0x844
142 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 2)
143 ;;
144 tplink,re355-v1|\
145 tplink,re450-v1)
146 caldata_extract "art" 0x5000 0x844
147 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
148 ;;
149 tplink,re450-v2|\
150 tplink,re450-v3|\
151 tplink,re455-v1)
152 caldata_extract "art" 0x5000 0x844
153 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 1)
154 ;;
155 tplink,tl-wpa8630-v1)
156 caldata_extract "art" 0x5000 0x844
157 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x0fc00) 1)
158 ;;
159 esac
160 ;;
161 "ath10k/cal-pci-0000:01:00.0.bin")
162 case $board in
163 openmesh,om5p-ac-v1)
164 caldata_extract "ART" 0x5000 0x844
165 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
166 ;;
167 sitecom,wlr-8100)
168 caldata_extract "art" 0x5000 0x844
169 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1)
170 ;;
171 esac
172 ;;
173 "ath10k/pre-cal-pci-0000:00:00.0.bin")
174 case $board in
175 dlink,dir-842-c1|\
176 dlink,dir-842-c2|\
177 dlink,dir-842-c3)
178 caldata_extract "art" 0x5000 0x2f20
179 caldata_valid "202f" || caldata_extract "reserved" 0x15000 0x2f20
180 ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
181 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
182 /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
183 ;;
184 esac
185 ;;
186 *)
187 exit 1
188 ;;
189 esac