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