b7d23da53da6b13ac2df4ffe9148eb203cad0218
[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-rev2-hynix|\
139 avm,fritz3370-rev2-micron)
140 annex="b"
141 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
142 wan_mac=$(macaddr_add "$lan_mac" 3)
143 ucidef_add_switch "switch0" \
144 "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
145 ;;
146
147 avm,fritz7312|\
148 avm,fritz7320)
149 annex="b"
150 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
151 ucidef_set_interface_lan 'eth0'
152 ;;
153
154 avm,fritz7360sl)
155 annex="b"
156 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
157 ucidef_add_switch "switch0" \
158 "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
159 ;;
160
161 avm,fritz7412)
162 tffsdev=$(find_mtd_chardev "nand-tffs")
163 annex="b"
164 lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
165 wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)
166 ucidef_set_interface_lan 'eth0'
167 ;;
168
169 siemens,gigaset-sx76x)
170 annex="b"
171 ucidef_add_switch "switch0" \
172 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
173 ;;
174
175 zte,h201l)
176 annex="b"
177 ucidef_add_switch "switch0" \
178 "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
179 ;;
180
181 zyxel,p-2601hn)
182 ucidef_add_switch "switch0" \
183 "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0"
184 ;;
185
186 zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
187 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
188 wan_mac=$(macaddr_add "$lan_mac" 1)
189 ucidef_add_switch "switch0" \
190 "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0"
191 ;;
192
193 tplink,tdw8970|tplink,tdw8980)
194 wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 61696)" 1)
195 ucidef_add_switch "switch0" \
196 "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
197 ;;
198
199 arcadyan,vg3503j)
200 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
201 wan_mac=$(macaddr_add "$lan_mac" 1)
202 ucidef_add_switch "switch0" \
203 "2:lan:2" "4:lan:1" "6t@eth0"
204 ;;
205
206 tplink,vr200|tplink,vr200v)
207 wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 61696)" 1)
208 ucidef_add_switch "switch0" \
209 "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
210 ;;
211
212 arcadyan,vgv7510kw22-nor|arcadyan,vgv7510kw22-brn)
213 annex="b"
214 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
215 ucidef_add_switch "switch0" \
216 "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
217 ;;
218
219 arcadyan,vgv7519-nor|arcadyan,vgv7519-brn)
220 wan_mac=$(mtd_get_mac_binary board_config 22)
221 ucidef_add_switch "switch0" \
222 "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
223 ;;
224
225 buffalo,wbmr-hp-g300h)
226 ucidef_add_switch "switch0" \
227 "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
228 ;;
229
230 buffalo,wbmr-300hpd)
231 lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
232 wan_mac="$lan_mac"
233 ucidef_add_switch "switch0" \
234 "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
235 ;;
236
237 *)
238 ucidef_set_interface_lan 'eth0'
239 ;;
240
241 esac
242
243 ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
244 ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload" "dsl"
245
246 if lantiq_is_vdsl_system; then
247 ucidef_add_vdsl_modem "$annex" "$tone" "$xfer_mode"
248 else
249 ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
250 fi
251
252 ucidef_set_interface_wan "$interface_wan" "pppoe"
253
254 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
255 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
256
257 board_config_flush
258
259 exit 0
260