ar71xx: add support for Cisco's MR18
[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 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 tl-wr1043nd-v2 |\
47 wzr-450hp2)
48         ucidef_set_interfaces_lan_wan "eth1" "eth0"
49         ucidef_add_switch "switch0" \
50                 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
51         ;;
52
53 archer-c5 |\
54 archer-c7 |\
55 tl-wdr4900-v2)
56         ucidef_set_interfaces_lan_wan "eth1" "eth0"
57         ucidef_add_switch "switch0" \
58                 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
59         ;;
60
61 bsb)
62         ucidef_set_interfaces_lan_wan "eth1" "eth0"
63         ucidef_add_switch "switch0" \
64                 "0@eth1" "1:lan" "3:lan"  # XXX: confirm cpu port!
65         ucidef_set_interface_wlan
66         ;;
67
68 cpe510)
69         ucidef_add_switch "switch0" \
70                 "0@eth0" "5:lan" "4:wan"
71         ;;
72
73 airgatewaypro)
74         ucidef_add_switch "switch0" \
75                 "0@eth0" "4:lan" "5:wan"
76         ;;
77
78 db120 |\
79 rb-2011l | \
80 rb-2011uas |\
81 rb-2011uias |\
82 rb-2011uas-2hnd|\
83 rb-2011uias-2hnd)
84         case "$board" in
85         rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
86                 ucidef_add_switch "switch0" \
87                         "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
88         ;;
89         *)
90                 ucidef_add_switch "switch0" \
91                         "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
92         ;;
93         esac
94
95         ucidef_add_switch "switch1" \
96                 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
97         ;;
98
99 dir-825-b1|\
100 tew-673gru)
101         ucidef_set_interfaces_lan_wan "eth0" "eth1"
102         ucidef_add_switch "switch0" \
103                 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
104         ;;
105
106 f9k1115v2)
107         ucidef_set_interfaces_lan_wan "eth1" "eth0"
108         ucidef_add_switch "switch0" \
109                 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
110                 "0@eth0" "1:wan"  # XXX: confirm cpu ports!
111         ;;
112
113 nbg460n_550n_550nh)
114         ucidef_set_interfaces_lan_wan "eth0" "eth1"
115         ucidef_add_switch "switch0" \
116                 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
117         ;;
118
119 nbg6616 |\
120 nbg6716)
121         ucidef_set_interfaces_lan_wan "eth0" "eth1"
122         ucidef_add_switch "switch0" \
123                 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
124                 "5:wan" "6@eth1"
125         ;;
126
127 ap143 |\
128 rb-433 |\
129 rb-433u)
130         ucidef_set_interfaces_lan_wan "eth1" "eth0"
131         ucidef_add_switch "switch0" \
132                 "1:lan" "2:lan" "5@eth1"
133         ;;
134
135 rb-435g)
136         ucidef_set_interfaces_lan_wan "eth1" "eth0"
137         ucidef_add_switch "switch0" \
138                 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
139         ;;
140
141 rb-450)
142         ucidef_set_interfaces_lan_wan "eth1" "eth0"
143         ucidef_add_switch "switch0" \
144                 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
145         ;;
146
147 rb-450g |\
148 routerstation-pro)
149         ucidef_set_interfaces_lan_wan "eth1" "eth0"
150         ucidef_add_switch "switch0" \
151                 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
152         ;;
153
154 ap136 |\
155 rb-750gl |\
156 rb-751g |\
157 rb-951g-2hnd |\
158 wzr-hp-g450h)
159         ucidef_add_switch "switch0" \
160                 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
161         ;;
162
163 rb-951ui-2hnd)
164         ucidef_set_interfaces_lan_wan "eth1" "eth0"
165         ;;
166
167 rb-493g)
168         ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
169         ucidef_add_switch "switch0" \
170                 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
171         ucidef_add_switch "switch1" \
172                 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
173         ;;
174
175 wzr-hp-g300nh2 |\
176 pb92 |\
177 ap113)
178         ucidef_add_switch "switch0" \
179                 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
180         ;;
181
182 el-m150)
183         ucidef_set_interfaces_lan_wan "eth1" "eth0"
184         ucidef_add_switch "switch0" \
185                 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
186         ;;
187
188 tl-wdr4300|\
189 tl-wr1041n-v2)
190         ucidef_add_switch "switch0" \
191                 "0@eth0" "1:wan" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
192         ;;
193
194 tl-wr1043nd)
195         ucidef_add_switch "switch0" \
196                 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
197         ;;
198
199 tl-wr2543n)
200         ucidef_add_switch "switch0" \
201                 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
202         ;;
203
204 tl-wr841n-v1|\
205 tl-wr941nd)
206         ucidef_set_interface_raw "eth" "eth0"
207         ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
208         ;;
209
210 dir-615-i1 |\
211 r6100 |\
212 smart-300 |\
213 tl-mr3420-v2 |\
214 tl-wr841n-v8 |\
215 tl-wr842n-v2 |\
216 tl-wr941nd-v5 |\
217 tl-wr941nd-v6 |\
218 tl-wdr6500-v2 |\
219 wnr2000-v3 |\
220 wnr2000-v4 |\
221 wnr2200 |\
222 wnr612-v2 |\
223 wnr1000-v2)
224         ucidef_set_interfaces_lan_wan "eth1" "eth0"
225         ucidef_add_switch "switch0" \
226                 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
227         ;;
228
229 uap-pro)
230         ucidef_add_switch "switch0" \
231                 "0@eth0" "1:lan" "2:wan"
232         ;;
233
234 nanostation-m-xw)
235         ucidef_add_switch "switch0" \
236                 "0@eth0" "5:lan" "1:wan"
237         ;;
238
239 wrt160nl)
240         ucidef_set_interfaces_lan_wan "eth0" "eth1"
241         ucidef_add_switch "switch0" \
242                 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
243         ;;
244
245 wzr-hp-g300nh)
246         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
247         ucidef_add_switch "switch0" \
248                 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
249         ;;
250
251 dgl-5500-a1 |\
252 dir-825-c1)
253         local mac
254         ucidef_add_switch "switch0" \
255                 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
256         mac=$(mtd_get_mac_ascii nvram "wan_mac")
257         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
258         ;;
259
260 mynet-n750)
261         local mac
262         ucidef_add_switch "switch0" \
263                 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
264         mac=$(mtd_get_mac_ascii devdata "wanmac")
265         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
266         ;;
267
268 onion-omega)
269         ucidef_set_interface_lan "wlan0"
270         ;;
271
272 dhp-1565-a1 |\
273 dir-835-a1 |\
274 wndr3700v4 | \
275 wndr4300)
276         ucidef_add_switch "switch0" \
277                 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
278         mac_lan=$(mtd_get_mac_binary caldata 0)
279         [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
280         mac_wan=$(mtd_get_mac_binary caldata 6)
281         [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
282         ;;
283
284 esr900)
285         local mac
286         ucidef_add_switch "switch0" \
287                 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
288         mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
289         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
290         ;;
291
292 dlan-hotspot |\
293 dlan-pro-500-wp)
294         ucidef_set_interface_lan "eth0 eth1"
295         ;;
296
297 dlan-pro-1200-ac)
298         ucidef_set_interface_lan "eth0"
299         ucidef_add_switch "switch0"
300         ucidef_add_switch_attr "switch0" "reset" "false"
301         ucidef_add_switch_ports "switch0" \
302                 "0@eth0" "2:lan" "3:lan" "4:lan"
303         ;;
304
305 all0305 |\
306 antminer-s1 |\
307 antminer-s3 |\
308 aw-nr580 |\
309 bullet-m |\
310 cap4200ag |\
311 eap300v2 |\
312 eap7660d |\
313 el-mini |\
314 loco-m-xw |\
315 mr1750 |\
316 mr18 |\
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