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