ramips: use phytpt trigger for mt76 wireless
[openwrt/openwrt.git] / target / linux / ramips / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 PART_NAME=firmware
6
7 platform_check_image() {
8 local board=$(board_name)
9 local magic="$(get_magic_long "$1")"
10
11 [ "$#" -gt 1 ] && return 1
12
13 case "$board" in
14 3g150b|\
15 3g300m|\
16 a5-v11|\
17 ai-br100|\
18 air3gii|\
19 alfa-network,ac1200rm|\
20 alfa-network,awusfree1|\
21 all0239-3g|\
22 all0256n-4M|\
23 all0256n-8M|\
24 all5002|\
25 all5003|\
26 mediatek,ap-mt7621a-v60|\
27 ar725w|\
28 asl26555-8M|\
29 asl26555-16M|\
30 awapn2403|\
31 awm002-evb-4M|\
32 awm002-evb-8M|\
33 bc2|\
34 bocco|\
35 broadway|\
36 c108|\
37 carambola|\
38 cf-wr800n|\
39 cs-qr10|\
40 d105|\
41 d240|\
42 dap-1350|\
43 db-wrt01|\
44 dcs-930|\
45 dcs-930l-b1|\
46 dir-300-b1|\
47 dir-300-b7|\
48 dir-320-b1|\
49 dir-600-b1|\
50 dir-615-d|\
51 dir-615-h1|\
52 dir-620-a1|\
53 dir-620-d1|\
54 dir-810l|\
55 duzun-dm06|\
56 e1700|\
57 esr-9753|\
58 ew1200|\
59 ex2700|\
60 ex3700|\
61 f7c027|\
62 firewrt|\
63 fonera20n|\
64 freestation5|\
65 gnubee,gb-pc1|\
66 gnubee,gb-pc2|\
67 gl-mt300a|\
68 gl-mt300n|\
69 gl-mt750|\
70 gl-mt300n-v2|\
71 hc5*61|\
72 hc5661a|\
73 hg255d|\
74 hlk-rm04|\
75 hpm|\
76 ht-tm02|\
77 hw550-3g|\
78 ip2202|\
79 jhr-n805r|\
80 jhr-n825r|\
81 jhr-n926r|\
82 k2p|\
83 kn|\
84 kn_rc|\
85 kn_rf|\
86 kng_rc|\
87 linkits7688|\
88 m2m|\
89 m3|\
90 m4-4M|\
91 m4-8M|\
92 mac1200rv2|\
93 microwrt|\
94 miniembplug|\
95 miniembwifi|\
96 miwifi-mini|\
97 miwifi-nano|\
98 mlw221|\
99 mlwg2|\
100 mofi3500-3gn|\
101 mpr-a1|\
102 mpr-a2|\
103 mr-102n|\
104 mt7628|\
105 mzk-750dhp|\
106 mzk-dp150n|\
107 mzk-ex300np|\
108 mzk-ex750np|\
109 mzk-w300nh2|\
110 mzk-wdpr|\
111 nbg-419n|\
112 nbg-419n2|\
113 newifi-d1|\
114 d-team,newifi-d2|\
115 nixcore-x1-8M|\
116 nixcore-x1-16M|\
117 nw718|\
118 omega2|\
119 omega2p|\
120 oy-0001|\
121 pbr-d1|\
122 pbr-m1|\
123 psg1208|\
124 psg1218a|\
125 psg1218b|\
126 psr-680w|\
127 px-4885-4M|\
128 px-4885-8M|\
129 rb750gr3|\
130 re6500|\
131 rp-n53|\
132 rt5350f-olinuxino|\
133 rt5350f-olinuxino-evb|\
134 rt-ac51u|\
135 rt-g32-b1|\
136 rt-n10-plus|\
137 rt-n12p|\
138 rt-n13u|\
139 rt-n14u|\
140 rt-n15|\
141 rt-n56u|\
142 rut5xx|\
143 sap-g3200u3|\
144 sk-wb8|\
145 sl-r7205|\
146 tama,w06|\
147 tew-638apb-v2|\
148 tew-691gr|\
149 tew-692gr|\
150 tew-714tru|\
151 timecloud|\
152 tiny-ac|\
153 u25awf-h1|\
154 u7621-06-256M-16M|\
155 u7628-01-128M-16M|\
156 ur-326n4g|\
157 ur-336un|\
158 v22rw-2x2|\
159 vonets,var11n-300|\
160 vocore-8M|\
161 vocore-16M|\
162 vocore2|\
163 vocore2lite|\
164 vr500|\
165 w150m|\
166 w2914nsv2|\
167 w306r-v20|\
168 w502u|\
169 ravpower,wd03|\
170 wf-2881|\
171 whr-1166d|\
172 whr-300hp2|\
173 whr-600d|\
174 whr-g300n|\
175 widora,neo-16m|\
176 widora,neo-32m|\
177 mqmaker,witi-256m|\
178 mqmaker,witi-512m|\
179 wizfi630a|\
180 wl-330n|\
181 wl-330n3g|\
182 wl-341v3|\
183 wl-351|\
184 wl-wn575a3|\
185 wli-tx4-ag300n|\
186 wlr-6000|\
187 wmdr-143n|\
188 wmr-300|\
189 wn3000rpv3|\
190 wnce2001|\
191 wndr3700v5|\
192 wr512-3gn-4M|\
193 wr512-3gn-8M|\
194 wr6202|\
195 wrh-300cr|\
196 wrtnode|\
197 wrtnode2r |\
198 wrtnode2p |\
199 wsr-600|\
200 wt1520-4M|\
201 wt1520-8M|\
202 wt3020-4M|\
203 wt3020-8M|\
204 wzr-agl300nh|\
205 x5|\
206 x8|\
207 y1|\
208 y1s|\
209 youhua,wr1200js|\
210 we1026-5g-16m|\
211 zbt-ape522ii|\
212 zbt-cpe102|\
213 zbt-wa05|\
214 zbtlink,zbt-we1226|\
215 zbt-we1326|\
216 zbt-we2026|\
217 zbtlink,zbt-we3526|\
218 zbt-we826-16M|\
219 zbt-we826-32M|\
220 zbt-wg2626|\
221 zbt-wg3526-16M|\
222 zbt-wg3526-32M|\
223 zbt-wr8305rt|\
224 zorlik,zl5900v2|\
225 zte-q7|\
226 youku-yk1)
227 [ "$magic" != "27051956" ] && {
228 echo "Invalid image type."
229 return 1
230 }
231 return 0
232 ;;
233 3g-6200n|\
234 3g-6200nl|\
235 br-6475nd)
236 [ "$magic" != "43535953" ] && {
237 echo "Invalid image type."
238 return 1
239 }
240 return 0
241 ;;
242
243 ar670w)
244 [ "$magic" != "6d000080" ] && {
245 echo "Invalid image type."
246 return 1
247 }
248 return 0
249 ;;
250 c20i|\
251 c50|\
252 mr200|\
253 tplink,c20-v1|\
254 tplink,c20-v4|\
255 tplink,c50-v3|\
256 tplink,tl-mr3420-v5|\
257 tplink,tl-wr902ac-v3|\
258 tl-wr840n-v4|\
259 tl-wr840n-v5|\
260 tl-wr841n-v13)
261 [ "$magic" != "03000000" ] && {
262 echo "Invalid image type."
263 return 1
264 }
265 return 0
266 ;;
267 cy-swr1100|\
268 dch-m225|\
269 dir-610-a1|\
270 dir-645|\
271 dir-860l-b1)
272 [ "$magic" != "5ea3a417" ] && {
273 echo "Invalid image type."
274 return 1
275 }
276 return 0
277 ;;
278 dlink,dwr-116-a1|\
279 dlink,dwr-921-c1|\
280 dwr-512-b)
281 [ "$magic" != "0404242b" ] && {
282 echo "Invalid image type."
283 return 1
284 }
285 return 0
286 ;;
287 hc5962|\
288 mir3g|\
289 r6220|\
290 ubnt-erx|\
291 ubnt-erx-sfp)
292 nand_do_platform_check "$board" "$1"
293 return $?;
294 ;;
295 re350-v1)
296 [ "$magic" != "01000000" ] && {
297 echo "Invalid image type."
298 return 1
299 }
300 return 0
301 ;;
302 wcr-1166ds|\
303 wsr-1166)
304 [ "$magic" != "48445230" ] && {
305 echo "Invalid image type."
306 return 1
307 }
308 return 0
309 ;;
310 esac
311
312 echo "Sysupgrade is not yet supported on $board."
313 return 1
314 }
315
316 platform_nand_pre_upgrade() {
317 local board=$(board_name)
318
319 case "$board" in
320 ubnt-erx|\
321 ubnt-erx-sfp)
322 platform_upgrade_ubnt_erx "$ARGV"
323 ;;
324 esac
325 }
326
327 platform_do_upgrade() {
328 local board=$(board_name)
329
330 case "$board" in
331 hc5962|\
332 mir3g|\
333 r6220|\
334 ubnt-erx|\
335 ubnt-erx-sfp)
336 nand_do_upgrade "$ARGV"
337 ;;
338 *)
339 default_do_upgrade "$ARGV"
340 ;;
341 esac
342 }
343
344 blink_led() {
345 . /etc/diag.sh; set_state upgrade
346 }
347
348 append sysupgrade_pre_upgrade blink_led