ar71xx: wpa8630: change board name to tl-wpa8630
[openwrt/staging/wigyori.git] / target / linux / ar71xx / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults.sh
8 . /lib/ar71xx.sh
9
10 ar71xx_setup_interfaces()
11 {
12 local board="$1"
13
14 case "$board" in
15 airgatewaypro)
16 ucidef_add_switch "switch0" \
17 "0@eth0" "4:lan" "5:wan"
18 ;;
19 airrouter|\
20 ap121|\
21 ap121-mini|\
22 ap96|\
23 dir-600-a1|\
24 dir-615-c1|\
25 dir-615-e1|\
26 dir-615-e4|\
27 hiwifi-hc6361|\
28 ja76pf|\
29 mc-mac1200r|\
30 minibox-v1|\
31 mynet-n600|\
32 oolite|\
33 qihoo-c301|\
34 rb-750|\
35 rb-751|\
36 som9331|\
37 tew-632brp|\
38 tew-712br|\
39 tew-732br|\
40 tl-mr3220|\
41 tl-mr3220-v2|\
42 tl-mr3420|\
43 tl-wdr3320-v2|\
44 tl-wdr3500|\
45 tl-wr741nd|\
46 tl-wr741nd-v4|\
47 tl-wr841n-v11|\
48 tl-wr841n-v7|\
49 tl-wr841n-v9|\
50 tl-wr842n-v3|\
51 whr-g301n|\
52 whr-hp-g300n|\
53 whr-hp-gn|\
54 wzr-hp-ag300h|\
55 zbt-we1526)
56 ucidef_set_interfaces_lan_wan "eth0" "eth1"
57 ucidef_add_switch "switch0" \
58 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
59 ;;
60 alfa-ap120c|\
61 all0305|\
62 antminer-s1|\
63 antminer-s3|\
64 antrouter-r1|\
65 aw-nr580|\
66 bullet-m|\
67 c-55|\
68 cap4200ag|\
69 eap120|\
70 eap300v2|\
71 eap7660d|\
72 el-mini|\
73 loco-m-xw|\
74 mr12|\
75 mr16|\
76 mr1750|\
77 mr1750v2|\
78 mr18|\
79 mr600|\
80 mr600v2|\
81 mr900|\
82 mr900v2|\
83 mynet-rext|\
84 rb-411|\
85 rb-911g-2hpnd|\
86 rb-911g-5hpacd|\
87 rb-911g-5hpnd|\
88 rb-912uag-2hpnd|\
89 rb-912uag-5hpnd|\
90 rb-sxt2n|\
91 rb-sxt5n|\
92 rocket-m-xw|\
93 tl-mr10u|\
94 tl-mr11u|\
95 tl-mr12u|\
96 tl-mr13u|\
97 tl-mr3020|\
98 tl-mr3040|\
99 tl-mr3040-v2|\
100 tl-wa701nd-v2|\
101 tl-wa7210n-v2|\
102 tl-wa750re|\
103 tl-wa801nd-v2|\
104 tl-wa830re-v2|\
105 tl-wa850re|\
106 tl-wa901nd|\
107 tl-wa901nd-v2|\
108 tl-wa901nd-v3|\
109 tl-wa901nd-v4|\
110 tl-wr703n|\
111 tl-wr802n-v1|\
112 tube2h|\
113 unifiac-lite|\
114 wndap360|\
115 wp543)
116 ucidef_set_interface_lan "eth0"
117 ;;
118 alfa-ap96|\
119 alfa-nx|\
120 ap83|\
121 gl-ar150|\
122 gl-ar300m|\
123 gl-domino|\
124 gl-inet|\
125 gl-mifi|\
126 jwap003|\
127 pb42|\
128 pb44|\
129 rb-951ui-2hnd|\
130 routerstation|\
131 tl-wr710n|\
132 tl-wr720n-v3|\
133 tl-wr810n|\
134 wpe72|\
135 wrtnode2q)
136 ucidef_set_interfaces_lan_wan "eth1" "eth0"
137 ;;
138 all0258n|\
139 all0315n|\
140 dlan-hotspot|\
141 dlan-pro-500-wp|\
142 dr344|\
143 ja76pf2|\
144 rocket-m-ti|\
145 ubnt-unifi-outdoor)
146 ucidef_set_interface_lan "eth0 eth1"
147 ;;
148 ap113|\
149 pb92|\
150 wzr-hp-g300nh2)
151 ucidef_add_switch "switch0" \
152 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
153 ;;
154 ap132|\
155 ap136|\
156 ap152|\
157 rb-750gl|\
158 rb-751g|\
159 rb-951g-2hnd|\
160 wlr8100|\
161 wzr-hp-g450h)
162 ucidef_add_switch "switch0" \
163 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
164 ;;
165 ap135-020|\
166 ap136-020|\
167 tew-823dru|\
168 tl-wr1043nd-v2|\
169 wzr-450hp2)
170 ucidef_set_interfaces_lan_wan "eth1" "eth0"
171 ucidef_add_switch "switch0" \
172 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
173 ;;
174 ap136-010|\
175 ap147-010|\
176 nbg6616|\
177 nbg6716)
178 ucidef_set_interfaces_lan_wan "eth0" "eth1"
179 ucidef_add_switch "switch0" \
180 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
181 ;;
182 ap143|\
183 rb-433|\
184 rb-433u)
185 ucidef_set_interfaces_lan_wan "eth1" "eth0"
186 ucidef_add_switch "switch0" \
187 "1:lan" "2:lan" "5@eth1"
188 ;;
189 archer-c5|\
190 archer-c7|\
191 tl-wdr4900-v2)
192 ucidef_set_interfaces_lan_wan "eth1" "eth0"
193 ucidef_add_switch "switch0" \
194 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
195 ;;
196 arduino-yun|\
197 dir-505-a1|\
198 tl-wa801nd-v3)
199 ucidef_set_interface_lan "eth1"
200 ;;
201 bsb)
202 ucidef_set_interfaces_lan_wan "eth1" "eth0"
203 ucidef_add_switch "switch0" \
204 "0@eth1" "1:lan" "3:lan"
205 ;;
206 c-60)
207 ucidef_add_switch "switch0" \
208 "0@eth0" "3:wan" "4:lan"
209 ;;
210 cap324)
211 ucidef_set_interface_lan "eth0" "dhcp"
212 ;;
213 cpe210|\
214 cpe510)
215 ucidef_add_switch "switch0" \
216 "0@eth0" "5:lan" "4:wan"
217 ;;
218 cr3000)
219 ucidef_set_interfaces_lan_wan "eth0" "eth1"
220 ucidef_add_switch "switch0" \
221 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
222 ;;
223 cr5000|\
224 dgl-5500-a1|\
225 dhp-1565-a1|\
226 dir-825-c1|\
227 dir-835-a1|\
228 esr900|\
229 mynet-n750|\
230 wndr3700v4|\
231 wndr4300)
232 ucidef_add_switch "switch0" \
233 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
234 ;;
235 dap-2695-a1)
236 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
237 ;;
238 db120|\
239 rb-2011l|\
240 rb-2011uas|\
241 rb-2011uas-2hnd|\
242 rb-2011uias|\
243 rb-2011uias-2hnd)
244 case "$board" in
245 rb-2011uas*|\
246 rb-2011uias|\
247 rb-2011uias-2hnd)
248 ucidef_add_switch "switch0" \
249 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
250 ;;
251 *)
252 ucidef_add_switch "switch0" \
253 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
254 ;;
255 esac
256
257 ucidef_add_switch "switch1" \
258 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
259 ;;
260 dir-615-i1|\
261 omy-g1|\
262 r6100|\
263 smart-300|\
264 tl-mr3420-v2|\
265 tl-wdr6500-v2|\
266 tl-wr841n-v8|\
267 tl-wr842n-v2|\
268 tl-wr941nd-v5|\
269 tl-wr941nd-v6|\
270 wnr1000-v2|\
271 wnr2000-v3|\
272 wnr2000-v4|\
273 wnr2200|\
274 wnr612-v2|\
275 wpn824n)
276 ucidef_set_interfaces_lan_wan "eth1" "eth0"
277 ucidef_add_switch "switch0" \
278 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
279 ;;
280 dir-825-b1|\
281 nbg460n_550n_550nh|\
282 tew-673gru|\
283 wzr-hp-g300nh)
284 ucidef_set_interfaces_lan_wan "eth0" "eth1"
285 ucidef_add_switch "switch0" \
286 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
287 ;;
288 dlan-pro-1200-ac)
289 ucidef_set_interface_lan "eth0"
290 ucidef_add_switch "switch0" \
291 "0@eth0" "2:lan" "3:lan" "4:lan"
292 ucidef_add_switch_attr "switch0" "enable" "false"
293 ;;
294 el-m150)
295 ucidef_set_interfaces_lan_wan "eth1" "eth0"
296 ucidef_add_switch "switch0" \
297 "0:lan" "1:lan" "3@eth1"
298 ;;
299 dir-869-a1|\
300 epg5000|\
301 esr1750)
302 ucidef_add_switch "switch0" \
303 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
304 ;;
305 ew-dorin)
306 ucidef_add_switch "switch0" \
307 "0@eth0" "1:lan" "2:lan" "3:wan"
308 ;;
309 ew-dorin-router)
310 ucidef_set_interfaces_lan_wan "eth0" "eth1"
311 ucidef_add_switch "switch0" \
312 "0@eth0" "2:lan" "3:lan"
313 ;;
314 dw33d|\
315 f9k1115v2)
316 ucidef_set_interfaces_lan_wan "eth1" "eth0"
317 ucidef_add_switch "switch0" \
318 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
319 ;;
320 gl-ar300)
321 ucidef_set_interfaces_lan_wan "eth1" "eth0"
322 ucidef_add_switch "switch0" \
323 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
324 ;;
325 jwap230)
326 ucidef_set_interfaces_lan_wan "eth0" "eth1"
327 ucidef_add_switch "switch0" \
328 "0@eth0" "1:lan" "5:wan" "6@eth1"
329 ;;
330 nanostation-m-xw)
331 ucidef_add_switch "switch0" \
332 "0@eth0" "5:lan" "1:wan"
333 ;;
334 onion-omega)
335 ucidef_set_interface_lan "wlan0"
336 ;;
337 rb-435g)
338 ucidef_set_interfaces_lan_wan "eth1" "eth0"
339 ucidef_add_switch "switch0" \
340 "0@eth1" "1:lan" "2:lan"
341 ;;
342 rb-450)
343 ucidef_set_interfaces_lan_wan "eth1" "eth0"
344 ucidef_add_switch "switch0" \
345 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
346 ;;
347 rb-450g|\
348 routerstation-pro)
349 ucidef_set_interfaces_lan_wan "eth1" "eth0"
350 ucidef_add_switch "switch0" \
351 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
352 ;;
353 rb-493g)
354 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
355 ucidef_add_switch "switch0" \
356 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
357 ucidef_add_switch "switch1" \
358 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
359 ;;
360 tellstick-znet-lite)
361 ucidef_set_interface_wan "eth0"
362 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
363 ;;
364 tl-wdr4300|\
365 tl-wr1041n-v2)
366 ucidef_add_switch "switch0" \
367 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
368 ;;
369 tl-wpa8630)
370 ucidef_add_switch "switch0" \
371 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
372 ;;
373 tl-wr1043nd)
374 ucidef_add_switch "switch0" \
375 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
376 ;;
377 tl-wr2543n)
378 ucidef_add_switch "switch0" \
379 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
380 ;;
381 tl-wr841n-v1|\
382 tl-wr941nd)
383 ucidef_set_interface_raw "eth" "eth0"
384 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
385 ;;
386 uap-pro|\
387 wpj342)
388 ucidef_add_switch "switch0" \
389 "0@eth0" "1:lan" "2:wan"
390 ;;
391 unifiac-pro)
392 ucidef_add_switch "switch0" \
393 "0@eth0" "2:lan" "3:wan"
394 ;;
395 wndr3700)
396 ucidef_set_interfaces_lan_wan "eth0" "eth1"
397 ucidef_add_switch "switch0" \
398 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
399
400 ucidef_add_switch_attr "switch0" "blinkrate" 2
401 ucidef_add_switch_port_attr "switch0" 1 led 6
402 ucidef_add_switch_port_attr "switch0" 2 led 9
403 ucidef_add_switch_port_attr "switch0" 5 led 2
404 ;;
405 wpj344)
406 ucidef_add_switch "switch0" \
407 "0@eth0" "3:lan" "2:wan"
408 ;;
409 wpj558)
410 ucidef_add_switch "switch0" \
411 "5:lan" "1:wan" "6@eth0"
412 ;;
413 wrt160nl)
414 ucidef_set_interfaces_lan_wan "eth0" "eth1"
415 ucidef_add_switch "switch0" \
416 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
417 ;;
418 wzr-hp-g450h)
419 ucidef_add_switch "switch0" \
420 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
421 ;;
422 z1)
423 ucidef_set_interfaces_lan_wan "eth0" "eth1"
424 ucidef_add_switch "switch0" \
425 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
426 ;;
427 *)
428 ucidef_set_interfaces_lan_wan "eth0" "eth1"
429 ;;
430 esac
431 }
432
433 ar71xx_setup_macs()
434 {
435 local board="$1"
436 local lan_mac=""
437 local wan_mac=""
438
439 case $board in
440 dgl-5500-a1|\
441 dir-825-c1)
442 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
443 ;;
444 dhp-1565-a1|\
445 dir-835-a1|\
446 wndr3700v4|\
447 wndr4300)
448 lan_mac=$(mtd_get_mac_binary caldata 0)
449 wan_mac=$(mtd_get_mac_binary caldata 6)
450 ;;
451 esr900)
452 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
453 ;;
454 dir-869-a1|\
455 mynet-n750)
456 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
457 ;;
458 esac
459
460 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
461 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
462 }
463
464 board_config_update
465 board=$(ar71xx_board_name)
466 ar71xx_setup_interfaces $board
467 ar71xx_setup_macs $board
468 board_config_flush
469
470 exit 0