ipq-wifi: add BDF for Aruba AP-303
[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 linksys,ea8300)
35 caldata_extract "ART" 0x9000 0x2f20
36 # OEM assigns 4 sequential MACs
37 ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
38 ;;
39 openmesh,a62)
40 caldata_extract "0:ART" 0x9000 0x2f20
41 ;;
42 esac
43 ;;
44 "ath10k/pre-cal-ahb-a000000.wifi.bin")
45 case "$board" in
46 8dev,jalapeno |\
47 alfa-network,ap120c-ac |\
48 cilab,meshpoint-one |\
49 glinet,gl-b1300 |\
50 linksys,ea6350v3 |\
51 qcom,ap-dk01.1-c1)
52 caldata_extract "ART" 0x1000 0x2f20
53 ;;
54 asus,map-ac2200)
55 caldata_extract_ubi "Factory" 0x1000 0x2f20
56 ;;
57 asus,rt-ac58u)
58 CI_UBIPART=UBI_DEV
59 caldata_extract_ubi "Factory" 0x1000 0x2f20
60 ;;
61 avm,fritzbox-4040)
62 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
63 ;;
64 avm,fritzbox-7530 |\
65 avm,fritzrepeater-1200 |\
66 avm,fritzrepeater-3000)
67 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
68 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
69 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
70 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
71 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
72 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
73 ;;
74 compex,wpj419 |\
75 compex,wpj428 |\
76 engenius,eap1300 |\
77 openmesh,a42 |\
78 openmesh,a62 |\
79 qxwlan,e2600ac-c1 |\
80 qxwlan,e2600ac-c2 |\
81 unielec,u4019-32m)
82 caldata_extract "0:ART" 0x1000 0x2f20
83 ;;
84 engenius,ens620ext)
85 caldata_extract "ART" 0x1000 0x2f20
86 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2)
87 ;;
88 linksys,ea8300)
89 caldata_extract "ART" 0x1000 0x2f20
90 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
91 ;;
92 meraki,mr33)
93 caldata_extract_ubi "ART" 0x1000 0x2f20
94 caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20
95 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2)
96 ;;
97 netgear,ex6100v2 |\
98 netgear,ex6150v2)
99 caldata_extract "ART" 0x1000 0x2f20
100 ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0)
101 ;;
102 zyxel,nbg6617 |\
103 zyxel,wre6606)
104 caldata_extract "ART" 0x1000 0x2f20
105 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
106 ;;
107 esac
108 ;;
109 "ath10k/pre-cal-ahb-a800000.wifi.bin")
110 case "$board" in
111 8dev,jalapeno |\
112 alfa-network,ap120c-ac |\
113 cilab,meshpoint-one |\
114 glinet,gl-b1300 |\
115 linksys,ea6350v3 |\
116 qcom,ap-dk01.1-c1)
117 caldata_extract "ART" 0x5000 0x2f20
118 ;;
119 asus,map-ac2200)
120 caldata_extract_ubi "Factory" 0x5000 0x2f20
121 ;;
122 asus,rt-ac58u)
123 CI_UBIPART=UBI_DEV
124 caldata_extract_ubi "Factory" 0x5000 0x2f20
125 ;;
126 avm,fritzbox-4040)
127 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
128 ;;
129 avm,fritzbox-7530 |\
130 avm,fritzrepeater-1200 |\
131 avm,fritzrepeater-3000)
132 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
133 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
134 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
135 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
136 /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
137 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
138 ;;
139 compex,wpj419 |\
140 compex,wpj428 |\
141 engenius,eap1300 |\
142 openmesh,a42 |\
143 openmesh,a62 |\
144 qxwlan,e2600ac-c1 |\
145 qxwlan,e2600ac-c2 |\
146 unielec,u4019-32m)
147 caldata_extract "0:ART" 0x5000 0x2f20
148 ;;
149 engenius,ens620ext)
150 caldata_extract "ART" 0x5000 0x2f20
151 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3)
152 ;;
153 linksys,ea8300)
154 caldata_extract "ART" 0x5000 0x2f20
155 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
156 ;;
157 meraki,mr33)
158 caldata_extract_ubi "ART" 0x5000 0x2f20
159 caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
160 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
161 ;;
162 netgear,ex6100v2 |\
163 netgear,ex6150v2)
164 caldata_extract "ART" 0x5000 0x2f20
165 ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc)
166 ;;
167 zyxel,nbg6617 |\
168 zyxel,wre6606)
169 caldata_extract "ART" 0x5000 0x2f20
170 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
171 ;;
172 esac
173 ;;
174 *)
175 exit 1
176 ;;
177 esac