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