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