OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh |
2 | |||
3 | ath10kcal_die() { |
||
4 | echo "ath10cal: " "$*" |
||
5 | exit 1 |
||
6 | } |
||
7 | |||
8 | ath10kcal_from_file() { |
||
9 | local source=$1 |
||
10 | local offset=$2 |
||
11 | local count=$3 |
||
12 | |||
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" |
||
15 | } |
||
16 | |||
17 | ath10kcal_extract() { |
||
18 | local part=$1 |
||
19 | local offset=$2 |
||
20 | local count=$3 |
||
21 | local mtd cal_size |
||
22 | |||
23 | mtd=$(find_mtd_chardev $part) |
||
24 | [ -n "$mtd" ] || \ |
||
25 | ath10kcal_die "no mtd device found for partition $part" |
||
26 | |||
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"') |
||
29 | |||
30 | [ "$count" = "$cal_size" ] || \ |
||
31 | ath10kcal_die "no calibration data found in $part" |
||
32 | |||
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" |
||
35 | } |
||
36 | |||
37 | ath10kcal_patch_mac() { |
||
38 | local mac=$1 |
||
39 | |||
40 | [ -z "$mac" ] && return |
||
41 | |||
42 | macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6 |
||
43 | } |
||
44 | |||
45 | [ -e /lib/firmware/$FIRMWARE ] && exit 0 |
||
46 | |||
47 | . /lib/functions.sh |
||
48 | . /lib/functions/system.sh |
||
49 | |||
50 | board=$(board_name) |
||
51 | |||
52 | case "$FIRMWARE" in |
||
53 | "ath10k/cal-pci-0000:00:00.0.bin") |
||
54 | case $board in |
||
55 | a40|\ |
||
56 | a60|\ |
||
57 | mr1750|\ |
||
58 | mr1750v2|\ |
||
59 | om5p-acv2) |
||
60 | ath10kcal_extract "ART" 20480 2116 |
||
61 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) |
||
62 | ;; |
||
63 | archer-c25-v1|\ |
||
64 | tl-wdr6500-v2) |
||
65 | ath10kcal_extract "art" 20480 2116 |
||
66 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) |
||
67 | ;; |
||
68 | archer-c7-v4|\ |
||
69 | archer-c7-v5) |
||
70 | ath10kcal_extract "art" 20480 2116 |
||
71 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) |
||
72 | ;; |
||
73 | cf-e355ac-v1|\ |
||
74 | cf-e380ac-v1|\ |
||
75 | cf-e380ac-v2|\ |
||
76 | dlan-pro-1200-ac|\ |
||
77 | e1700ac-v2|\ |
||
78 | e600gac-v2|\ |
||
79 | oolite-v5.2|\ |
||
80 | oolite-v5.2-dev|\ |
||
81 | sr3200|\ |
||
82 | xd3200) |
||
83 | ath10kcal_extract "art" 20480 2116 |
||
84 | ;; |
||
85 | dap-2695-a1) |
||
86 | ath10kcal_extract "radiocfg" 20480 2116 |
||
87 | ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a) |
||
88 | ;; |
||
89 | dir-869-a1|\ |
||
90 | qihoo-c301) |
||
91 | ath10kcal_extract "radiocfg" 20480 2116 |
||
92 | ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) |
||
93 | ;; |
||
94 | dw33d) |
||
95 | ath10kcal_extract "art" 20480 2116 |
||
96 | ath10kcal_patch_mac $(mtd_get_mac_binary art 18) |
||
97 | ;; |
||
98 | epg5000|\ |
||
99 | esr1750) |
||
100 | ath10kcal_extract "caldata" 20480 2116 |
||
101 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) |
||
102 | ;; |
||
103 | gl-ar750|\ |
||
104 | tl-wpa8630) |
||
105 | ath10kcal_extract "art" 20480 2116 |
||
106 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) |
||
107 | ;; |
||
108 | koala) |
||
109 | ath10kcal_extract "art" 20480 2116 |
||
110 | ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 12) +0) |
||
111 | ;; |
||
112 | mc-mac1200r) |
||
113 | ath10kcal_extract "art" 20480 2116 |
||
114 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1) |
||
115 | ;; |
||
116 | r6100) |
||
117 | ath10kcal_extract "caldata" 20480 2116 |
||
118 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2) |
||
119 | ;; |
||
120 | rb-952ui-5ac2nd|\ |
||
121 | rb-wapg-5hact2hnd) |
||
122 | ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 |
||
123 | ;; |
||
124 | re355|\ |
||
125 | re450|\ |
||
126 | tl-wr902ac-v1) |
||
127 | ath10kcal_extract "art" 20480 2116 |
||
128 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) |
||
129 | ;; |
||
130 | unifiac-lite|\ |
||
131 | unifiac-pro) |
||
132 | ath10kcal_extract "EEPROM" 20480 2116 |
||
133 | ;; |
||
134 | wi2a-ac200i) |
||
135 | ath10kcal_extract "ART" 20480 2116 |
||
136 | ;; |
||
137 | esac |
||
138 | ;; |
||
139 | "ath10k/cal-pci-0000:01:00.0.bin") |
||
140 | case $board in |
||
141 | archer-c5|\ |
||
142 | archer-c7) |
||
143 | ath10kcal_extract "art" 20480 2116 |
||
144 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) |
||
145 | ;; |
||
146 | nbg6616|\ |
||
147 | nbg6716) |
||
148 | ath10kcal_extract "RFdata" 20480 2116 |
||
149 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) |
||
150 | ;; |
||
151 | om5p-ac) |
||
152 | ath10kcal_extract "ART" 20480 2116 |
||
153 | ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) |
||
154 | ;; |
||
155 | rb-911g-5hpacd|\ |
||
156 | rb-921gs-5hpacd-r2|\ |
||
157 | rb-962uigs-5hact2hnt) |
||
158 | ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 |
||
159 | ;; |
||
160 | wlr8100) |
||
161 | ath10kcal_extract "art" 20480 2116 |
||
162 | ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1) |
||
163 | ;; |
||
164 | esac |
||
165 | ;; |
||
166 | "ath10k/pre-cal-pci-0000:00:00.0.bin") |
||
167 | case $board in |
||
168 | archer-c58-v1|\ |
||
169 | archer-c59-v1|\ |
||
170 | archer-c60-v1|\ |
||
3 | office | 171 | archer-c60-v2|\ |
1 | office | 172 | cf-e355ac-v2|\ |
173 | cf-e375ac) |
||
174 | ath10kcal_extract "art" 20480 12064 |
||
175 | ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ |
||
176 | /lib/firmware/ath10k/QCA9888/hw2.0/board.bin |
||
177 | ;; |
||
178 | cf-e385ac) |
||
179 | ath10kcal_extract "art" 20480 12064 |
||
180 | ;; |
||
181 | esac |
||
182 | ;; |
||
183 | *) |
||
184 | exit 1 |
||
185 | ;; |
||
186 | esac |