efe631c99e7c2f0146b402ab894c878462877e80
[openwrt/staging/wigyori.git] / target / linux / lantiq / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/uci-defaults.sh
7 . /lib/functions/system.sh
8 . /lib/functions/lantiq.sh
9
10 board_config_update
11
12 vpi=1
13 vci=32
14 annex="a"
15 tone="av"
16 xfer_mode=""
17 encaps="llc"
18 payload="bridged"
19 lan_mac=""
20 wan_mac=""
21 interface_wan="dsl0"
22
23 board=$(board_name)
24
25 case "$board" in
26 audiocodes,mp-252)
27 ucidef_add_switch "switch0" \
28 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
29 ;;
30
31 allnet,all0333cj)
32 annex="b"
33 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
34 wan_mac=$(macaddr_add "$lan_mac" 1)
35 ucidef_set_interface_lan 'eth0'
36 ;;
37
38 arcadyan,arv4510pw)
39 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
40 wan_mac=$(macaddr_add "$lan_mac" 1)
41 ucidef_add_switch "switch0" \
42 "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0"
43 ;;
44
45 arcadyan,arv4519pw|arcadyan,arv7510pw22|arcadyan,arv7518pw)
46 ucidef_add_switch "switch0" \
47 "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
48 ;;
49
50 arcadyan,arv4520pw)
51 annex="b"
52 ucidef_add_switch "switch0" \
53 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
54 ;;
55
56 arcadyan,arv4525pw|arcadyan,arv452cqw|arcadyan,arv7525pw|arcadyan,arv752dpw)
57 annex="b"
58 ucidef_set_interface_lan 'eth0'
59 ;;
60
61 arcadyan,arv7506pw11)
62 annex="b"
63 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
64 ucidef_add_switch "switch0" \
65 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
66 ;;
67
68 arcadyan,arv7519pw)
69 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 1)
70 ucidef_add_switch "switch0" \
71 "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
72 ;;
73
74 arcadyan,arv7519rw22)
75 wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 22)" 1)
76 ucidef_add_switch "switch0" \
77 "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0"
78 ;;
79
80 arcadyan,arv752dpw22|arcadyan,arv8539pw22)
81 annex="b"
82 ucidef_add_switch "switch0" \
83 "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
84 ;;
85
86 alphanetworks,asl56026)
87 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
88 wan_mac=$(mtd_get_mac_ascii uboot_env wanmac)
89 ucidef_add_switch "switch0"\
90 "2:lan" "3:lan" "6t@eth0"
91 ;;
92
93 bt,homehub-v2b)
94 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
95 wan_mac=$(macaddr_add "$lan_mac" 1)
96 ucidef_add_switch "switch0" \
97 "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0"
98 ;;
99
100 bt,homehub-v3a)
101 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
102 wan_mac=$(macaddr_add "$lan_mac" 1)
103 ucidef_set_interface_lan 'eth0'
104 ;;
105
106 bt,homehub-v5a)
107 lan_mac=$(mtd_get_mac_binary_ubi caldata 4364)
108 wan_mac=$(macaddr_add "$lan_mac" 1)
109 ucidef_add_switch "switch0" \
110 "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
111 ;;
112
113 netgear,dgn1000b)
114 annex="b"
115 ucidef_set_interface_lan 'eth0'
116 ;;
117
118 netgear,dgn3500|netgear,dgn3500b)
119 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
120 wan_mac=$(macaddr_add "$lan_mac" 1)
121 ucidef_add_switch "switch0" \
122 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
123 ;;
124
125 netgear,dm200)
126 lan_mac=$(mtd_get_mac_binary ART 0)
127 wan_mac=$(macaddr_add "$lan_mac" 1)
128 ucidef_set_interface_lan 'eth0'
129 ;;
130
131 lantiq,easy80920-nand|lantiq,easy80920-nor)
132 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
133 wan_mac=$(macaddr_add "$lan_mac" 1)
134 ucidef_add_switch "switch0" \
135 "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
136 ;;
137
138 avm,fritz3370)
139 annex="b"
140 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2439)" 1)
141 ucidef_set_interface_lan 'eth0'
142 ;;
143
144 avm,fritz7320)
145 annex="b"
146 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
147 ucidef_set_interface_lan 'eth0'
148 ;;
149
150 avm,fritz7360sl)
151 annex="b"
152 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
153 ucidef_add_switch "switch0" \
154 "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
155 ;;
156
157 siemens,gigaset-sx76x)
158 annex="b"
159 ucidef_add_switch "switch0" \
160 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
161 ;;
162
163 zte,h201l)
164 annex="b"
165 ucidef_add_switch "switch0" \
166 "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
167 ;;
168
169 zyxel,p-2601hn)
170 ucidef_add_switch "switch0" \
171 "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0"
172 ;;
173
174 zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
175 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
176 wan_mac=$(macaddr_add "$lan_mac" 1)
177 ucidef_add_switch "switch0" \
178 "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0"
179 ;;
180
181 tplink,tdw8970|tplink,tdw8980)
182 wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 61696)" 1)
183 ucidef_add_switch "switch0" \
184 "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
185 ;;
186
187 arcadyan,vg3503j)
188 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
189 wan_mac=$(macaddr_add "$lan_mac" 1)
190 ucidef_add_switch "switch0" \
191 "2:lan:1" "4:lan:2" "6t@eth0"
192 ;;
193
194 tplink,vr200v)
195 wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 61696)" 1)
196 ucidef_add_switch "switch0" \
197 "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
198 ;;
199
200 arcadyan,vgv7510kw22-nor|arcadyan,vgv7510kw22-brn)
201 annex="b"
202 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
203 ucidef_add_switch "switch0" \
204 "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
205 ;;
206
207 arcadyan,vgv7519-nor|arcadyan,vgv7519-brn)
208 wan_mac=$(mtd_get_mac_binary board_config 22)
209 ucidef_add_switch "switch0" \
210 "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
211 ;;
212
213 buffalo,wbmr-hp-g300h)
214 ucidef_add_switch "switch0" \
215 "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
216 ;;
217
218 buffalo,wbmr-300hpd)
219 lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
220 wan_mac="$lan_mac"
221 ucidef_add_switch "switch0" \
222 "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
223 ;;
224
225 *)
226 ucidef_set_interface_lan 'eth0'
227 ;;
228
229 esac
230
231 ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
232 ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload"
233
234 if lantiq_is_vdsl_system; then
235 ucidef_add_vdsl_modem "$annex" "$tone" "$xfer_mode"
236 else
237 ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
238 fi
239
240 ucidef_set_interface_wan "$interface_wan" "pppoe"
241
242 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
243 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
244
245 board_config_flush
246
247 exit 0
248