ipq40xx: add support for GL.iNet GL-AP1300
[openwrt/openwrt.git] / target / linux / ipq40xx / 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:01:00.0.bin")
11 case "$board" in
12 meraki,mr33)
13 caldata_extract_ubi "ART" 0x9000 0x844
14 caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844
15 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1)
16 ;;
17 esac
18 ;;
19 "ath10k/pre-cal-pci-0000:01:00.0.bin")
20 case "$board" in
21 asus,map-ac2200)
22 caldata_extract_ubi "Factory" 0x9000 0x2f20
23 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
24 /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
25 ;;
26 avm,fritzrepeater-3000)
27 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
28 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
29 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
30 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
31 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
32 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
33 ;;
34 buffalo,wtr-m2133hp)
35 caldata_extract "ART" 0x9000 0x2f20
36 ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x32)
37 ;;
38 engenius,eap2200 |\
39 openmesh,a62 |\
40 plasmacloud,pa2200)
41 caldata_extract "0:ART" 0x9000 0x2f20
42 ;;
43 linksys,ea8300 |\
44 linksys,mr8300)
45 caldata_extract "ART" 0x9000 0x2f20
46 # OEM assigns 4 sequential MACs
47 ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
48 ;;
49 esac
50 ;;
51 "ath10k/pre-cal-ahb-a000000.wifi.bin")
52 case "$board" in
53 8dev,habanero-dvk |\
54 8dev,jalapeno |\
55 alfa-network,ap120c-ac |\
56 cilab,meshpoint-one |\
57 ezviz,cs-w3-wd1200g-eup |\
58 glinet,gl-ap1300 |\
59 glinet,gl-b1300 |\
60 glinet,gl-s1300 |\
61 linksys,ea6350v3 |\
62 mobipromo,cm520-79f |\
63 qcom,ap-dk01.1-c1)
64 caldata_extract "ART" 0x1000 0x2f20
65 ;;
66 aruba,ap-303 |\
67 aruba,ap-303h |\
68 aruba,ap-365)
69 caldata_extract "ART" 0x1000 0x2f20
70 ath10k_patch_mac $(mtd_get_mac_binary mfginfo 0x1D)
71 ;;
72 asus,map-ac2200)
73 caldata_extract_ubi "Factory" 0x1000 0x2f20
74 ;;
75 asus,rt-ac58u)
76 CI_UBIPART=UBI_DEV
77 caldata_extract_ubi "Factory" 0x1000 0x2f20
78 ;;
79 avm,fritzbox-4040)
80 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
81 ;;
82 avm,fritzbox-7530 |\
83 avm,fritzrepeater-1200 |\
84 avm,fritzrepeater-3000)
85 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
86 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
87 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
88 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
89 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
90 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
91 ;;
92 buffalo,wtr-m2133hp)
93 caldata_extract "ART" 0x1000 0x2f20
94 ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x26)
95 ;;
96 cellc,rtl30vw |\
97 compex,wpj419 |\
98 compex,wpj428 |\
99 edgecore,ecw5211 |\
100 edgecore,oap100 |\
101 engenius,eap1300 |\
102 engenius,eap2200 |\
103 luma,wrtq-329acn|\
104 openmesh,a42 |\
105 openmesh,a62 |\
106 plasmacloud,pa1200 |\
107 plasmacloud,pa2200 |\
108 qxwlan,e2600ac-c1 |\
109 qxwlan,e2600ac-c2 |\
110 unielec,u4019-32m)
111 caldata_extract "0:ART" 0x1000 0x2f20
112 ;;
113 devolo,magic-2-wifi-next)
114 caldata_extract "ART" 0x1000 0x2f20
115 ath10k_patch_mac $(mtd_get_mac_ascii APPSBLENV WiFiMacAddress0)
116 ;;
117 dlink,dap-2610)
118 caldata_extract "ART" 0x1000 0x2f20
119 ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac)
120 ;;
121 engenius,emd1)
122 caldata_extract "0:ART" 0x1000 0x2f20
123 ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr)
124 ;;
125 engenius,emr3500)
126 caldata_extract "0:ART" 0x1000 0x2f20
127 ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
128 ;;
129 engenius,ens620ext)
130 caldata_extract "ART" 0x1000 0x2f20
131 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2)
132 ;;
133 linksys,ea8300 |\
134 linksys,mr8300)
135 caldata_extract "ART" 0x1000 0x2f20
136 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
137 ;;
138 meraki,mr33)
139 caldata_extract_ubi "ART" 0x1000 0x2f20
140 caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20
141 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2)
142 ;;
143 netgear,ex6100v2 |\
144 netgear,ex6150v2)
145 caldata_extract "ART" 0x1000 0x2f20
146 ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0)
147 ;;
148 zyxel,nbg6617 |\
149 zyxel,wre6606)
150 caldata_extract "ART" 0x1000 0x2f20
151 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
152 ;;
153 esac
154 ;;
155 "ath10k/pre-cal-ahb-a800000.wifi.bin")
156 case "$board" in
157 8dev,habanero-dvk |\
158 8dev,jalapeno |\
159 alfa-network,ap120c-ac |\
160 cilab,meshpoint-one |\
161 ezviz,cs-w3-wd1200g-eup |\
162 glinet,gl-ap1300 |\
163 glinet,gl-b1300 |\
164 glinet,gl-s1300 |\
165 linksys,ea6350v3 |\
166 mobipromo,cm520-79f |\
167 qcom,ap-dk01.1-c1)
168 caldata_extract "ART" 0x5000 0x2f20
169 ;;
170 aruba,ap-303 |\
171 aruba,ap-303h |\
172 aruba,ap-365)
173 caldata_extract "ART" 0x5000 0x2f20
174 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mfginfo 0x1D) +1)
175 ;;
176 asus,map-ac2200)
177 caldata_extract_ubi "Factory" 0x5000 0x2f20
178 ;;
179 asus,rt-ac58u)
180 CI_UBIPART=UBI_DEV
181 caldata_extract_ubi "Factory" 0x5000 0x2f20
182 ;;
183 avm,fritzbox-4040)
184 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
185 ;;
186 avm,fritzbox-7530 |\
187 avm,fritzrepeater-1200 |\
188 avm,fritzrepeater-3000)
189 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
190 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
191 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
192 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
193 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
194 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
195 ;;
196 buffalo,wtr-m2133hp)
197 caldata_extract "ART" 0x5000 0x2f20
198 ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x2c)
199 ;;
200 cellc,rtl30vw |\
201 compex,wpj419 |\
202 compex,wpj428 |\
203 edgecore,ecw5211 |\
204 edgecore,oap100 |\
205 engenius,eap1300 |\
206 engenius,eap2200 |\
207 luma,wrtq-329acn|\
208 openmesh,a42 |\
209 openmesh,a62 |\
210 plasmacloud,pa1200 |\
211 plasmacloud,pa2200 |\
212 qxwlan,e2600ac-c1 |\
213 qxwlan,e2600ac-c2 |\
214 unielec,u4019-32m)
215 caldata_extract "0:ART" 0x5000 0x2f20
216 ;;
217 devolo,magic-2-wifi-next)
218 caldata_extract "ART" 0x5000 0x2f20
219 ath10k_patch_mac $(mtd_get_mac_ascii APPSBLENV WiFiMacAddress1)
220 ;;
221 dlink,dap-2610)
222 caldata_extract "ART" 0x5000 0x2f20
223 ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
224 ;;
225 engenius,emd1)
226 caldata_extract "0:ART" 0x5000 0x2f20
227 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr) +1)
228 ;;
229 engenius,emr3500)
230 caldata_extract "0:ART" 0x5000 0x2f20
231 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1)
232 ;;
233 engenius,ens620ext)
234 caldata_extract "ART" 0x5000 0x2f20
235 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3)
236 ;;
237 linksys,ea8300 |\
238 linksys,mr8300)
239 caldata_extract "ART" 0x5000 0x2f20
240 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
241 ;;
242 meraki,mr33)
243 caldata_extract_ubi "ART" 0x5000 0x2f20
244 caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
245 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
246 ;;
247 netgear,ex6100v2 |\
248 netgear,ex6150v2)
249 caldata_extract "ART" 0x5000 0x2f20
250 ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc)
251 ;;
252 zyxel,nbg6617 |\
253 zyxel,wre6606)
254 caldata_extract "ART" 0x5000 0x2f20
255 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
256 ;;
257 esac
258 ;;
259 *)
260 exit 1
261 ;;
262 esac