8 ath10kcal_from_file() {
13 dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
14 ath10kcal_die "failed to extract calibration data from $source"
23 mtd=$(find_mtd_chardev $part)
25 ath10kcal_die "no mtd device found for partition $part"
27 # Check that the calibration data size in header equals the desired size
28 cal_size=$(dd if=$mtd bs=2 count=1 skip=$(( $offset / 2 )) conv=swab 2>/dev/null | hexdump -ve '1/2 "%d"')
30 [ "$count" = "$cal_size" ] || \
31 ath10kcal_die "no calibration data found in $part"
33 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
34 ath10kcal_die "failed to extract calibration data from $mtd"
37 ath10kcal_patch_mac() {
40 [ -z "$mac" ] && return
42 macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
45 [ -e /lib/firmware/$FIRMWARE ] && exit 0
48 . /lib/functions/system.sh
53 "ath10k/cal-pci-0000:00:00.0.bin")
60 ath10kcal_extract "ART" 20480 2116
61 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
65 ath10kcal_extract "art" 20480 2116
66 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
70 ath10kcal_extract "art" 20480 2116
71 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
84 ath10kcal_extract "art" 20480 2116
87 ath10kcal_extract "radiocfg" 20480 2116
88 ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
92 ath10kcal_extract "radiocfg" 20480 2116
93 ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
96 ath10kcal_extract "art" 20480 2116
97 ath10kcal_patch_mac $(mtd_get_mac_binary art 18)
101 ath10kcal_extract "caldata" 20480 2116
102 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
107 ath10kcal_extract "art" 20480 2116
108 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
111 ath10kcal_extract "art" 20480 2116
112 ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 12) +0)
115 ath10kcal_extract "art" 20480 2116
116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
119 ath10kcal_extract "caldata" 20480 2116
120 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2)
124 ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116
129 ath10kcal_extract "art" 20480 2116
130 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
134 ath10kcal_extract "EEPROM" 20480 2116
137 ath10kcal_extract "ART" 20480 2116
141 "ath10k/cal-pci-0000:01:00.0.bin")
145 ath10kcal_extract "art" 20480 2116
146 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
150 ath10kcal_extract "RFdata" 20480 2116
151 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
154 ath10kcal_extract "ART" 20480 2116
155 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
159 rb-962uigs-5hact2hnt)
160 ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116
163 ath10kcal_extract "art" 20480 2116
164 ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
168 "ath10k/pre-cal-pci-0000:00:00.0.bin")
176 ath10kcal_extract "art" 20480 12064
177 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
178 /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
181 ath10kcal_extract "art" 20480 12064
182 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
183 /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
184 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
187 ath10kcal_extract "art" 20480 12064