ath79: add support for Qxwlan E558 v2
[openwrt/openwrt.git] / target / linux / ath79 / generic / base-files / etc / board.d / 02_network
1 #!/bin/sh
2
3 . /lib/functions/system.sh
4 . /lib/functions/uci-defaults.sh
5 . /lib/functions/k2t.sh
6
7 ath79_setup_interfaces()
8 {
9 local board="$1"
10
11 case "$board" in
12 adtran,bsap1800-v2|\
13 adtran,bsap1840|\
14 allnet,all-wap02860ac|\
15 alfa-network,ap121f|\
16 arduino,yun|\
17 aruba,ap-105|\
18 avm,fritz1750e|\
19 avm,fritz300e|\
20 avm,fritzdvbc|\
21 comfast,cf-wr752ac-v1|\
22 comfast,cf-e130n-v2|\
23 devolo,dvl1200i|\
24 devolo,dvl1750c|\
25 devolo,dvl1750i|\
26 devolo,dvl1750x|\
27 dlink,dap-1330-a1|\
28 dlink,dap-1365-a1|\
29 dlink,dir-505|\
30 engenius,ecb1750|\
31 enterasys,ws-ap3705i|\
32 glinet,gl-ar300m-lite|\
33 hak5,wifi-pineapple-nano|\
34 meraki,mr16|\
35 netgear,ex6400|\
36 netgear,ex7300|\
37 ocedo,koala|\
38 ocedo,raccoon|\
39 pcs,cap324|\
40 pisen,ts-d084|\
41 pisen,wmb001n|\
42 pisen,wmm003n|\
43 siemens,ws-ap3610|\
44 tplink,cpe210-v2|\
45 tplink,cpe210-v3|\
46 tplink,cpe510-v2|\
47 tplink,cpe510-v3|\
48 tplink,cpe610-v1|\
49 tplink,cpe610-v2|\
50 tplink,re350k-v1|\
51 tplink,re355-v1|\
52 tplink,re450-v1|\
53 tplink,re450-v2|\
54 tplink,re450-v3|\
55 tplink,tl-wr902ac-v1|\
56 ubnt,bullet-m-ar7240|\
57 ubnt,bullet-m-ar7241|\
58 ubnt,bullet-m-xw|\
59 ubnt,lap-120|\
60 ubnt,litebeam-ac-gen2|\
61 ubnt,nanobeam-ac|\
62 ubnt,nanobridge-m|\
63 ubnt,nanostation-ac-loco|\
64 ubnt,nanostation-loco-m|\
65 ubnt,nanostation-loco-m-xw|\
66 ubnt,picostation-m|\
67 ubnt,powerbeam-5ac-500|\
68 ubnt,powerbeam-5ac-gen2|\
69 ubnt,powerbridge-m|\
70 ubnt,rocket-m|\
71 ubnt,unifiac-lite|\
72 ubnt,unifiac-lr|\
73 ubnt,unifiac-mesh|\
74 ubnt,unifi|\
75 wd,mynet-wifi-rangeextender|\
76 winchannel,wb2000)
77 ucidef_set_interface_lan "eth0"
78 ;;
79 alfa-network,ap121fe)
80 ucidef_set_interface_lan "eth0 usb0"
81 ;;
82 alfa-network,n2q|\
83 alfa-network,n5q|\
84 devolo,dvl1200e|\
85 devolo,dvl1750e|\
86 ocedo,ursus)
87 ucidef_set_interface_lan "eth0 eth1"
88 ;;
89 avm,fritz4020|\
90 pcs,cr3000|\
91 tplink,archer-c58-v1|\
92 tplink,archer-c59-v1|\
93 tplink,archer-c59-v2)
94 ucidef_set_interface_wan "eth1"
95 ucidef_add_switch "switch0" \
96 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
97 ;;
98 buffalo,bhr-4grv|\
99 buffalo,wzr-hp-g450h)
100 ucidef_add_switch "switch0" \
101 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
102 ;;
103 buffalo,bhr-4grv2|\
104 trendnet,tew-823dru)
105 ucidef_add_switch "switch0" \
106 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
107 ;;
108 buffalo,wzr-600dhp|\
109 buffalo,wzr-hp-ag300h|\
110 tplink,archer-c25-v1|\
111 tplink,archer-c60-v1|\
112 tplink,archer-c60-v2|\
113 tplink,archer-c60-v3|\
114 tplink,tl-wdr3500-v1|\
115 tplink,tl-wr842n-v1|\
116 tplink,tl-wr842n-v3|\
117 ubnt,airrouter)
118 ucidef_set_interface_wan "eth1"
119 ucidef_add_switch "switch0" \
120 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
121 ;;
122 buffalo,wzr-hp-g302h-a1a0)
123 ucidef_add_switch "switch0" \
124 "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"
125 ;;
126 comfast,cf-e110n-v2|\
127 comfast,cf-e120a-v3|\
128 comfast,cf-e314n-v2|\
129 compex,wpj531-16m|\
130 tplink,cpe210-v1|\
131 tplink,cpe220-v2|\
132 tplink,cpe220-v3|\
133 tplink,cpe510-v1|\
134 tplink,wbs210-v1|\
135 tplink,wbs210-v2|\
136 tplink,wbs510-v1|\
137 tplink,wbs510-v2|\
138 ubnt,nanostation-m|\
139 ubnt,routerstation)
140 ucidef_set_interfaces_lan_wan "eth1" "eth0"
141 ;;
142 comfast,cf-e560ac)
143 ucidef_set_interface_wan "eth1"
144 ucidef_add_switch "switch0" \
145 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
146 ;;
147 comfast,cf-wr650ac-v1|\
148 comfast,cf-wr650ac-v2|\
149 zyxel,nbg6616)
150 ucidef_add_switch "switch0" \
151 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
152 ;;
153 compex,wpj344-16m|\
154 compex,wpj563)
155 ucidef_add_switch "switch0" \
156 "0@eth0" "3:lan" "2:wan"
157 ;;
158 devolo,magic-2-wifi)
159 ucidef_add_switch "switch0" \
160 "0@eth0" "2:wan" "3:lan" "4:lan"
161 ;;
162 dlink,dap-2695-a1)
163 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
164 ;;
165 dlink,dch-g020-a1)
166 ucidef_add_switch "switch0" \
167 "0@eth0" "1:lan:2" "2:lan:1"
168 ;;
169 dlink,dir-825-b1)
170 ucidef_set_interface_wan "eth1"
171 ucidef_add_switch "switch0" \
172 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
173 ;;
174 dlink,dir-825-c1|\
175 dlink,dir-835-a1|\
176 dlink,dir-842-c1|\
177 dlink,dir-842-c2|\
178 dlink,dir-842-c3|\
179 dlink,dir-859-a1|\
180 engenius,epg5000|\
181 tplink,archer-c2-v3|\
182 tplink,tl-wr1043nd-v4|\
183 tplink,tl-wr1043n-v5)
184 ucidef_add_switch "switch0" \
185 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
186 ;;
187 elecom,wrc-1750ghbk2-i|\
188 elecom,wrc-300ghbk2-i|\
189 sitecom,wlr-8100)
190 ucidef_add_switch "switch0" \
191 "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
192 ;;
193 embeddedwireless,dorin)
194 ucidef_add_switch "switch0" \
195 "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
196 ;;
197 engenius,enh202-v1)
198 ucidef_set_interface_wan "eth0"
199 ucidef_add_switch "switch0" \
200 "0@eth1" "4:lan:1"
201 ;;
202 engenius,ens202ext-v1)
203 ucidef_set_interface_wan "eth1"
204 ucidef_add_switch "switch0" \
205 "0@eth0" "1:lan"
206 ;;
207 engenius,ews511ap)
208 ucidef_set_interface_lan "eth0 eth1" "dhcp"
209 ;;
210 etactica,eg200)
211 ucidef_set_interface_lan "eth0" "dhcp"
212 ;;
213 glinet,gl-ar750)
214 ucidef_set_interface_wan "eth1"
215 ucidef_add_switch "switch0" \
216 "0@eth0" "1:lan" "2:lan"
217 ;;
218 iodata,etg3-r|\
219 iodata,wn-ac1167dgr|\
220 iodata,wn-ac1600dgr|\
221 iodata,wn-ac1600dgr2|\
222 iodata,wn-ag300dgr|\
223 pcs,cr5000|\
224 sitecom,wlr-7100|\
225 wd,mynet-n750)
226 ucidef_add_switch "switch0" \
227 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
228 ;;
229 librerouter,librerouter-v1)
230 ucidef_add_switch "switch0" \
231 "0@eth0" "5:wan" "6@eth1" "4:lan"
232 ;;
233 mercury,mw4530r-v1|\
234 tplink,archer-a7-v5|\
235 tplink,archer-c6-v2|\
236 tplink,archer-c6-v2-us|\
237 tplink,archer-c7-v4|\
238 tplink,archer-c7-v5|\
239 tplink,tl-wdr3600-v1|\
240 tplink,tl-wdr4300-v1|\
241 tplink,tl-wdr4300-v1-il|\
242 tplink,tl-wdr4310-v1)
243 ucidef_add_switch "switch0" \
244 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
245 ;;
246 nec,wg1200cr|\
247 qxwlan,e750g-v8-8m|\
248 qxwlan,e750g-v8-16m|\
249 ubnt,nanostation-ac|\
250 yuncore,a782|\
251 yuncore,xd4200)
252 ucidef_add_switch "switch0" \
253 "0@eth0" "2:lan" "3:wan"
254 ;;
255 nec,wg800hp)
256 ucidef_add_switch "switch0" \
257 "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan"
258 ;;
259 netgear,wndr3700|\
260 netgear,wndr3700-v2|\
261 netgear,wndr3800|\
262 netgear,wndr3800ch|\
263 netgear,wndrmac-v1|\
264 netgear,wndrmac-v2)
265 ucidef_set_interface_wan "eth1"
266 ucidef_add_switch "switch0" \
267 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
268 ucidef_add_switch_attr "switch0" "blinkrate" 2
269 ucidef_add_switch_port_attr "switch0" 1 led 6
270 ucidef_add_switch_port_attr "switch0" 2 led 9
271 ucidef_add_switch_port_attr "switch0" 5 led 2
272 ;;
273 netgear,wnr2200-8m|\
274 netgear,wnr2200-16m)
275 ucidef_set_interface_wan "eth0"
276 ucidef_add_switch "switch0" \
277 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
278 ;;
279 phicomm,k2t)
280 ucidef_add_switch "switch0" \
281 "0@eth0" "3:lan:1" "5:lan:2" "4:wan"
282 ;;
283 qihoo,c301)
284 ucidef_set_interface_wan "eth1"
285 ucidef_add_switch "switch0" \
286 "0@eth0" "2:lan" "3:lan"
287 ;;
288 qxwlan,e558-v2-8m|\
289 qxwlan,e558-v2-16m)
290 ucidef_add_switch "switch0" \
291 "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
292 ;;
293 rosinson,wr818)
294 ucidef_add_switch "switch0" \
295 "0@eth0" "1:lan" "2:lan" "3:wan"
296 ;;
297 teltonika,rut955|\
298 teltonika,rut955-h7v3c0)
299 ucidef_set_interface_wan "eth1"
300 ucidef_add_switch "switch0" \
301 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
302 ;;
303 tplink,archer-c5-v1|\
304 tplink,archer-c7-v1|\
305 tplink,archer-c7-v2|\
306 tplink,tl-wdr4900-v2)
307 ucidef_add_switch "switch0" \
308 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
309 ;;
310 tplink,archer-d50-v1)
311 ucidef_add_switch "switch0" \
312 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
313 ;;
314 tplink,archer-d7-v1|\
315 tplink,archer-d7b-v1)
316 ucidef_add_switch "switch0" \
317 "0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan:5"
318 ;;
319 tplink,eap225-wall-v2)
320 ucidef_add_switch "switch0" \
321 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
322 ;;
323 tplink,eap245-v3)
324 ucidef_add_switch "switch0" \
325 "0@eth0" "2:lan:1" "5:lan:2"
326 ;;
327 tplink,tl-mr6400-v1)
328 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "usb0"
329 ucidef_add_switch "switch0" \
330 "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2"
331 ;;
332 tplink,tl-wpa8630-v1|\
333 tplink,tl-wpa8630p-v2-int|\
334 tplink,tl-wpa8630p-v2.0-eu|\
335 tplink,tl-wpa8630p-v2.1-eu)
336 # port 5 (internal) is the power-line port
337 ucidef_add_switch "switch0" \
338 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
339 ;;
340 tplink,tl-wr842n-v2)
341 ucidef_set_interface_wan "eth1"
342 ucidef_add_switch "switch0" \
343 "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
344 ;;
345 tplink,tl-wr1043nd-v1)
346 ucidef_add_switch "switch0" \
347 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
348 ;;
349 tplink,tl-wr1043nd-v2|\
350 tplink,tl-wr1043nd-v3|\
351 tplink,tl-wr1045nd-v2)
352 ucidef_add_switch "switch0" \
353 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
354 ;;
355 tplink,tl-wr2543-v1)
356 ucidef_add_switch "switch0" \
357 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
358 ;;
359 ubnt,aircube-isp)
360 ucidef_set_interface_wan "eth1"
361 ucidef_add_switch "switch0" \
362 "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2"
363 ;;
364 ubnt,edgeswitch-5xp)
365 ucidef_set_interface_wan "eth1"
366 ucidef_add_switch "switch0" \
367 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
368 ;;
369 ubnt,edgeswitch-8xp)
370 ucidef_set_interface_wan "eth1"
371 ucidef_add_switch "switch0" \
372 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:lan:5" "5:lan:6" "6:lan:7" "7:lan:8" "8@eth0"
373 ;;
374 ubnt,routerstation-pro)
375 ucidef_set_interface_wan "eth0"
376 ucidef_add_switch "switch0" \
377 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
378 ;;
379 ubnt,nanostation-m-xw)
380 ucidef_add_switch "switch0" \
381 "0@eth0" "5:lan" "1:wan"
382 ;;
383 ubnt,unifiac-mesh-pro|\
384 ubnt,unifiac-pro)
385 ucidef_add_switch "switch0" \
386 "0@eth0" "2:lan:1" "3:lan:2"
387 ;;
388 ubnt,unifi-ap-pro)
389 ucidef_add_switch "switch0" \
390 "0@eth0" "1:lan" "2:lan"
391 ;;
392 zbtlink,zbt-wd323|\
393 xiaomi,mi-router-4q)
394 ucidef_set_interface_wan "eth1"
395 ucidef_add_switch "switch0" \
396 "0@eth0" "3:lan:1" "4:lan:2"
397 ;;
398 *)
399 ucidef_set_interfaces_lan_wan "eth0" "eth1"
400 ;;
401 esac
402 }
403
404 ath79_setup_macs()
405 {
406 local board="$1"
407
408 case "$board" in
409 adtran,bsap1800-v2|\
410 adtran,bsap1840)
411 lan_mac=$(mtd_get_mac_binary "Board data" 2)
412 label_mac=$lan_mac
413 ;;
414 alfa-network,ap121f|\
415 alfa-network,ap121fe|\
416 alfa-network,n2q|\
417 alfa-network,r36a|\
418 engenius,ens202ext-v1)
419 label_mac=$(mtd_get_mac_binary art 0x1002)
420 ;;
421 arduino,yun)
422 base_mac=$(mtd_get_mac_binary art 0x1002)
423 lan_mac=$(macaddr_setbit $base_mac 29)
424 [ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29)
425 ;;
426 avm,fritz1750e|\
427 avm,fritz450e|\
428 avm,fritzdvbc)
429 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
430 ;;
431 avm,fritz300e)
432 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
433 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
434 ;;
435 avm,fritz4020)
436 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
437 wan_mac=$(fritz_tffs -n macb -i $(find_mtd_part "tffs (1)"))
438 ;;
439 compex,wpj344-16m|\
440 compex,wpj563)
441 wan_mac=$(mtd_get_mac_binary u-boot 0x2e018)
442 ;;
443 devolo,magic-2-wifi)
444 label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3)
445 ;;
446 dlink,dap-1330-a1|\
447 dlink,dap-1365-a1|\
448 dlink,dch-g020-a1)
449 lan_mac=$(mtd_get_mac_text "mp" 0x1)
450 label_mac=$lan_mac
451 ;;
452 dlink,dap-2695-a1)
453 label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac")
454 ;;
455 dlink,dir-825-b1)
456 lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
457 wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
458 ;;
459 dlink,dir-505)
460 lan_mac=$(mtd_get_mac_text "mac" 0x4)
461 ;;
462 dlink,dir-825-c1|\
463 dlink,dir-835-a1)
464 lan_mac=$(mtd_get_mac_text "mac" 0x4)
465 wan_mac=$(mtd_get_mac_text "mac" 0x18)
466 ;;
467 dlink,dir-842-c1|\
468 dlink,dir-842-c2|\
469 dlink,dir-842-c3|\
470 nec,wg1200cr)
471 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
472 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
473 label_mac=$lan_mac
474 ;;
475 dlink,dir-859-a1|\
476 qihoo,c301|\
477 wd,mynet-n750)
478 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
479 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
480 ;;
481 elecom,wrc-1750ghbk2-i|\
482 elecom,wrc-300ghbk2-i)
483 wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" -2)
484 ;;
485 engenius,ecb1750)
486 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
487 label_mac=$(mtd_get_mac_ascii u-boot-env athaddr)
488 ;;
489 engenius,enh202-v1|\
490 ubnt,airrouter|\
491 ubnt,bullet-m-ar7240|\
492 ubnt,bullet-m-ar7241|\
493 ubnt,nanobridge-m|\
494 ubnt,nanostation-loco-m|\
495 ubnt,nanostation-m|\
496 ubnt,picostation-m|\
497 ubnt,powerbridge-m|\
498 ubnt,rocket-m|\
499 ubnt,unifi)
500 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
501 ;;
502 engenius,epg5000)
503 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
504 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
505 ;;
506 engenius,ews511ap)
507 lan_mac=$(mtd_get_mac_text "u-boot-env" 0xe9)
508 eth1_mac=$(macaddr_add "$lan_mac" 1)
509 ucidef_set_interface "eth0" ifname "eth0" protocol "none" macaddr "$lan_mac"
510 ucidef_set_interface "eth1" ifname "eth1" protocol "none" macaddr "$eth1_mac"
511 ;;
512 enterasys,ws-ap3705i)
513 label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr)
514 ;;
515 hak5,lan-turtle|\
516 hak5,packet-squirrel)
517 label_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
518 ;;
519 iodata,etg3-r)
520 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
521 wan_mac=$(macaddr_add "$lan_mac" -1)
522 label_mac=$wan_mac
523 ;;
524 iodata,wn-ac1167dgr|\
525 iodata,wn-ac1600dgr|\
526 iodata,wn-ac1600dgr2|\
527 iodata,wn-ag300dgr)
528 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
529 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
530 label_mac=$wan_mac
531 ;;
532 jjplus,ja76pf2)
533 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
534 lan_mac=$(macaddr_add "$wan_mac" 1)
535 ;;
536 mercury,mw4530r-v1|\
537 tplink,tl-wdr3600-v1|\
538 tplink,tl-wdr4300-v1|\
539 tplink,tl-wdr4300-v1-il)
540 base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
541 wan_mac=$(macaddr_add "$base_mac" 1)
542 ;;
543 nec,wg800hp)
544 lan_mac=$(mtd_get_mac_text board_data 0x280)
545 wan_mac=$(mtd_get_mac_text board_data 0x480)
546 label_mac=$wan_mac
547 ;;
548 netgear,wndr3700|\
549 netgear,wndr3700-v2|\
550 netgear,wndr3800|\
551 netgear,wndrmac-v1|\
552 netgear,wndrmac-v2)
553 lan_mac=$(macaddr_setbit_la "$(mtd_get_mac_binary art 0x0)")
554 ;;
555 phicomm,k2t)
556 lan_mac=$(k2t_get_mac "lan_mac")
557 wan_mac=$(k2t_get_mac "wan_mac")
558 ;;
559 rosinson,wr818)
560 wan_mac=$(mtd_get_mac_binary factory 0x0)
561 lan_mac=$(macaddr_setbit_la "$wan_mac")
562 ;;
563 sitecom,wlr-7100|\
564 sitecom,wlr-8100)
565 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
566 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
567 label_mac=$lan_mac
568 ;;
569 tplink,archer-a7-v5|\
570 tplink,archer-c7-v4|\
571 tplink,archer-c7-v5|\
572 tplink,tl-wr1043nd-v4|\
573 tplink,tl-wr1043n-v5)
574 base_mac=$(mtd_get_mac_binary info 0x8)
575 wan_mac=$(macaddr_add "$base_mac" 1)
576 ;;
577 trendnet,tew-823dru)
578 lan_mac=$(mtd_get_mac_text mac 0x4)
579 wan_mac=$(mtd_get_mac_text mac 0x18)
580 label_mac=$wan_mac
581 ;;
582 ubnt,litebeam-ac-gen2|\
583 ubnt,powerbeam-5ac-500|\
584 ubnt,powerbeam-5ac-gen2)
585 label_mac=$(mtd_get_mac_binary art 0x5006)
586 ;;
587 ubnt,routerstation|\
588 ubnt,routerstation-pro)
589 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa)
590 lan_mac=$(macaddr_add "$wan_mac" 1)
591 ;;
592 wd,mynet-wifi-rangeextender)
593 lan_mac=$(nvram get et0macaddr)
594 ;;
595 zyxel,nbg6616)
596 label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
597 ;;
598 esac
599
600 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
601 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
602 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
603 }
604
605 board_config_update
606 board=$(board_name)
607 ath79_setup_interfaces $board
608 ath79_setup_macs $board
609 board_config_flush
610
611 exit 0