ath79: rename tl-archer-c7 to archer-c7
[openwrt/openwrt.git] / target / linux / ath79 / 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 avm,fritz300e|\
13 ocedo,raccoon|\
14 pcs,cap324|\
15 tplink,re450-v2|\
16 tplink,tl-mr10u|\
17 tplink,tl-mr3020-v1|\
18 tplink,tl-wr703n|\
19 ubnt,unifiac-lite|\
20 ubnt,unifiac-mesh|\
21 ubnt,unifi)
22 ucidef_set_interface_lan "eth0"
23 ;;
24 buffalo,wzr-hp-g450h)
25 ucidef_add_switch "switch0" \
26 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
27 ;;
28 embeddedwireless,dorin)
29 ucidef_add_switch "switch0" \
30 "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
31 ;;
32 etactica,eg200)
33 ucidef_set_interface_lan "eth0" "dhcp"
34 ;;
35 glinet,ar150|\
36 glinet,ar300m)
37 ucidef_set_interfaces_lan_wan "eth1" "eth0"
38 ;;
39 netgear,wndr3800)
40 ucidef_set_interfaces_lan_wan "eth0" "eth1"
41 ucidef_add_switch "switch0" \
42 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
43 ucidef_add_switch_attr "switch0" "blinkrate" 2
44 ucidef_add_switch_port_attr "switch0" 1 led 6
45 ucidef_add_switch_port_attr "switch0" 2 led 9
46 ucidef_add_switch_port_attr "switch0" 5 led 2
47 ;;
48 netgear,wnr612-v2|\
49 on,n150r)
50 ucidef_set_interface_wan "eth0"
51 ucidef_add_switch "switch0" \
52 "0@eth1" "1:lan" "2:lan" "3:lan:3" "4:lan:4"
53 ;;
54 pcs,cr3000)
55 ucidef_add_switch "switch0" \
56 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
57 ucidef_set_interface_wan "eth0"
58 ;;
59 pcs,cr5000)
60 ucidef_add_switch "switch0" \
61 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
62 ;;
63 phicomm,k2t)
64 ucidef_add_switch "switch0" \
65 "0@eth0" "3:lan:1" "5:lan:2" "4:wan"
66 ;;
67 tplink,archer-c7-v2)
68 ucidef_add_switch "switch0" \
69 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
70 ;;
71 tplink,tl-mr3220-v1|\
72 tplink,tl-mr3420-v1|\
73 tplink,tl-wr841-v7)
74 ucidef_set_interface_wan "eth0"
75 ucidef_add_switch "switch0" \
76 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
77 ;;
78 tplink,tl-wdr3600|\
79 tplink,tl-wdr4300)
80 ucidef_add_switch "switch0" \
81 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
82 ;;
83 tplink,tl-wr1043nd-v1)
84 ucidef_add_switch "switch0" \
85 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
86 ;;
87 tplink,tl-wr1043nd-v2|\
88 tplink,tl-wr1043nd-v3)
89 ucidef_add_switch "switch0" \
90 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
91 ;;
92 tplink,tl-wr1043nd-v4)
93 ucidef_add_switch "switch0" \
94 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
95 ;;
96 tplink,tl-wr2543-v1)
97 ucidef_add_switch "switch0" \
98 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
99 ;;
100 tplink,tl-wr740n-v2)
101 ucidef_set_interface_wan "eth0"
102 ucidef_add_switch "switch0" \
103 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
104 ;;
105 tplink,tl-wr740nd-v4|\
106 tplink,tl-wr741nd-v4)
107 ucidef_set_interface_wan "eth0"
108 ucidef_add_switch "switch0" \
109 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
110 ;;
111 tplink,tl-wr841n-v9)
112 ucidef_set_interface_wan "eth0"
113 ucidef_add_switch "switch0" \
114 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
115 ;;
116 ubnt,unifiac-mesh-pro|\
117 ubnt,unifiac-pro)
118 ucidef_add_switch "switch0" \
119 "0@eth0" "2:lan" "3:wan"
120 ;;
121 *)
122 ucidef_set_interfaces_lan_wan "eth0" "eth1"
123 ;;
124 esac
125 }
126
127 ath79_setup_macs()
128 {
129 local board="$1"
130
131 case "$board" in
132 avm,fritz300e)
133 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
134 ;;
135 phicomm,k2t)
136 lan_mac=$(k2t_get_mac "lan_mac")
137 wan_mac=$(k2t_get_mac "wan_mac")
138 ;;
139 tplink,tl-wr1043nd-v4)
140 base_mac=$(mtd_get_mac_binary product-info 8)
141 wan_mac=$(macaddr_add "$base_mac" 1)
142 ;;
143 esac
144
145 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
146 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
147 }
148
149 board_config_update
150 board=$(board_name)
151 ath79_setup_interfaces $board
152 ath79_setup_macs $board
153 board_config_flush
154
155 exit 0