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