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