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