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