ar71xx: PowerCloud CAP324 OpenWrt configuration
[openwrt/staging/mkresin.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 cap324)
356 ucidef_set_interface_lan "eth0" "dhcp"
357 ;;
358
359 arduino-yun | \
360 dir-505-a1)
361 ucidef_set_interface_lan "eth1"
362 ;;
363
364 alfa-ap96 |\
365 alfa-nx |\
366 ap83 |\
367 gl-ar150 |\
368 gl-domino |\
369 gl-inet |\
370 jwap003 |\
371 pb42 |\
372 pb44 |\
373 routerstation|\
374 tl-wr710n |\
375 tl-wr720n-v3|\
376 wpe72)
377 ucidef_set_interfaces_lan_wan "eth1" "eth0"
378 ;;
379
380 gl-ar300)
381 ucidef_set_interfaces_lan_wan "eth1" "eth0"
382 ucidef_add_switch "switch0" \
383 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
384 ;;
385
386 wpj344)
387 ucidef_add_switch "switch0" \
388 "0@eth0" "3:lan" "2:wan"
389 ;;
390
391 wpj531)
392 ucidef_set_interfaces_lan_wan "eth0" "eth1"
393 ;;
394
395 wpj558)
396 ucidef_add_switch "switch0" \
397 "5:lan" "1:wan" "6@eth0"
398 ;;
399
400 ap121 |\
401 ap121-mini |\
402 ap96 |\
403 airrouter |\
404 dir-600-a1 |\
405 dir-615-c1 |\
406 dir-615-e1 |\
407 dir-615-e4 |\
408 hiwifi-hc6361 |\
409 ja76pf |\
410 mc-mac1200r|\
411 minibox-v1 |\
412 mynet-n600 |\
413 oolite |\
414 qihoo-c301 |\
415 rb-750 |\
416 rb-751 |\
417 tew-632brp |\
418 tew-712br |\
419 tew-732br |\
420 tl-mr3220 |\
421 tl-mr3220-v2 |\
422 tl-mr3420 |\
423 tl-wdr3320-v2 |\
424 tl-wdr3500 |\
425 tl-wr741nd |\
426 tl-wr741nd-v4 |\
427 tl-wr841n-v7 |\
428 tl-wr841n-v9 |\
429 whr-g301n |\
430 whr-hp-g300n |\
431 whr-hp-gn |\
432 wzr-hp-ag300h)
433 ucidef_set_interfaces_lan_wan "eth0" "eth1"
434 ucidef_add_switch "switch0" \
435 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
436 ;;
437
438 wzr-hp-g450h)
439 ucidef_add_switch "switch0" \
440 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
441 ;;
442
443 ew-dorin)
444 ucidef_add_switch "switch0" \
445 "0@eth0" "1:lan" "2:lan" "3:wan"
446 ;;
447
448 ew-dorin-router)
449 ucidef_set_interfaces_lan_wan "eth0" "eth1"
450 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
451 ;;
452
453 wndr3700)
454 ucidef_set_interfaces_lan_wan "eth0" "eth1"
455 ucidef_add_switch "switch0" \
456 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
457
458 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
459 ucidef_add_switch_attr "switch0" "blinkrate" 2
460
461 # Port 1 controls the GREEN configuration of LEDs for
462 # the switch and the section does not correspond to a real
463 # switch port.
464 #
465 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
466 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
467 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
468 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
469 # 14: Link (master); 15: separate register
470 ucidef_add_switch_port_attr "switch0" 1 led 6
471
472 # Port 2 controls the ORANGE configuration of LEDs for
473 # the switch and the section does not correspond to a real
474 # switch port.
475 #
476 # See the key above for switch port 1 for the meaning of the
477 # 'led' setting below.
478 ucidef_add_switch_port_attr "switch0" 2 led 9
479
480 # Port 5 controls the configuration of the WAN LED and the
481 # section does not correspond to a real switch port.
482 #
483 # To toggle the use of green or orange LEDs for the WAN port,
484 # see the LED setting for wndr3700:green:wan in /etc/config/system.
485 #
486 # See the key above for switch port 1 for the meaning of the
487 # 'led' setting below.
488 ucidef_add_switch_port_attr "switch0" 5 led 2
489 ;;
490
491 *)
492 ucidef_set_interfaces_lan_wan "eth0" "eth1"
493 ;;
494 esac
495
496 board_config_flush
497
498 exit 0