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