ar71xx: board.d: add missing include (#21296)
[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-new.sh
8 . /lib/ar71xx.sh
9
10 board_config_update
11
12 ucidef_set_interface_loopback
13
14 board=$(ar71xx_board_name)
15
16
17 case "$board" in
18 all0315n |\
19 all0258n |\
20 ja76pf2|\
21 rocket-m-ti |\
22 ubnt-unifi-outdoor)
23 ucidef_set_interface_lan "eth0 eth1"
24 ;;
25
26 ap132 |\
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 ap136-010 |\
39 ap147-010)
40 ucidef_set_interfaces_lan_wan "eth0" "eth1"
41 ucidef_add_switch "switch0" \
42 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
43 ;;
44
45 ap136-020 |\
46 ap135-020 |\
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:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
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 mr600 |\
318 mr600v2 |\
319 mr900 |\
320 mr900v2 |\
321 rb-411 |\
322 rb-911g-2hpnd |\
323 rb-911g-5hpacd |\
324 rb-911g-5hpnd |\
325 rb-912uag-2hpnd |\
326 rb-912uag-5hpnd |\
327 rb-sxt2n |\
328 rb-sxt5n |\
329 rocket-m-xw |\
330 tl-mr10u |\
331 tl-mr11u |\
332 tl-mr12u |\
333 tl-mr13u |\
334 tl-mr3020 |\
335 tl-mr3040 |\
336 tl-mr3040-v2 |\
337 tl-wa701nd-v2 |\
338 tl-wa7210n-v2 |\
339 tl-wa750re |\
340 tl-wa850re |\
341 tl-wa830re-v2 |\
342 tl-wa801nd-v2 |\
343 tl-wa901nd |\
344 tl-wa901nd-v2 |\
345 tl-wa901nd-v3 |\
346 tl-wr703n |\
347 tube2h |\
348 wndap360 |\
349 mynet-rext |\
350 wp543)
351 ucidef_set_interface_lan "eth0"
352 ;;
353
354 arduino-yun | \
355 dir-505-a1)
356 ucidef_set_interface_lan "eth1"
357 ;;
358
359 alfa-ap96 |\
360 alfa-nx |\
361 ap83 |\
362 gl-ar150 |\
363 gl-domino |\
364 gl-inet |\
365 jwap003 |\
366 pb42 |\
367 pb44 |\
368 routerstation|\
369 tl-wr710n |\
370 tl-wr720n-v3|\
371 wpe72)
372 ucidef_set_interfaces_lan_wan "eth1" "eth0"
373 ;;
374
375 gl-ar300)
376 ucidef_set_interfaces_lan_wan "eth1" "eth0"
377 ucidef_add_switch "switch0" \
378 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
379 ;;
380
381 wpj344)
382 ucidef_add_switch "switch0" \
383 "0@eth0" "3:lan" "2:wan"
384 ;;
385
386 wpj531)
387 ucidef_set_interfaces_lan_wan "eth0" "eth1"
388 ;;
389
390 wpj558)
391 ucidef_add_switch "switch0" \
392 "5:lan" "1:wan" "6@eth0"
393 ;;
394
395 ap121 |\
396 ap121-mini |\
397 ap96 |\
398 airrouter |\
399 dir-600-a1 |\
400 dir-615-c1 |\
401 dir-615-e1 |\
402 dir-615-e4 |\
403 hiwifi-hc6361 |\
404 ja76pf |\
405 mc-mac1200r|\
406 minibox-v1 |\
407 mynet-n600 |\
408 oolite |\
409 qihoo-c301 |\
410 rb-750 |\
411 rb-751 |\
412 tew-632brp |\
413 tew-712br |\
414 tew-732br |\
415 tl-mr3220 |\
416 tl-mr3220-v2 |\
417 tl-mr3420 |\
418 tl-wdr3320-v2 |\
419 tl-wdr3500 |\
420 tl-wr741nd |\
421 tl-wr741nd-v4 |\
422 tl-wr841n-v7 |\
423 tl-wr841n-v9 |\
424 whr-g301n |\
425 whr-hp-g300n |\
426 whr-hp-gn |\
427 wzr-hp-ag300h)
428 ucidef_set_interfaces_lan_wan "eth0" "eth1"
429 ucidef_add_switch "switch0" \
430 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
431 ;;
432
433 wzr-hp-g450h)
434 ucidef_add_switch "switch0" \
435 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
436 ;;
437
438 ew-dorin)
439 ucidef_add_switch "switch0" \
440 "0@eth0" "1:lan" "2:lan" "3:wan"
441 ;;
442
443 ew-dorin-router)
444 ucidef_set_interfaces_lan_wan "eth0" "eth1"
445 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
446 ;;
447
448 wndr3700)
449 ucidef_set_interfaces_lan_wan "eth0" "eth1"
450 ucidef_add_switch "switch0" \
451 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
452
453 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
454 ucidef_add_switch_attr "switch0" "blinkrate" 2
455
456 # Port 1 controls the GREEN configuration of LEDs for
457 # the switch and the section does not correspond to a real
458 # switch port.
459 #
460 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
461 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
462 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
463 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
464 # 14: Link (master); 15: separate register
465 ucidef_add_switch_port_attr "switch0" 1 led 6
466
467 # Port 2 controls the ORANGE configuration of LEDs for
468 # the switch and the section does not correspond to a real
469 # switch port.
470 #
471 # See the key above for switch port 1 for the meaning of the
472 # 'led' setting below.
473 ucidef_add_switch_port_attr "switch0" 2 led 9
474
475 # Port 5 controls the configuration of the WAN LED and the
476 # section does not correspond to a real switch port.
477 #
478 # To toggle the use of green or orange LEDs for the WAN port,
479 # see the LED setting for wndr3700:green:wan in /etc/config/system.
480 #
481 # See the key above for switch port 1 for the meaning of the
482 # 'led' setting below.
483 ucidef_add_switch_port_attr "switch0" 5 led 2
484 ;;
485
486 *)
487 ucidef_set_interfaces_lan_wan "eth0" "eth1"
488 ;;
489 esac
490
491 board_config_flush
492
493 exit 0