lantiq: xrx200: rename nas0/ptm0 to dsl0
[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=""
22
23 board=$(board_name)
24
25 case "$board" in
26 ACMP252|GIGASX76X)
27 ucidef_add_switch "switch0" \
28 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
29 ;;
30
31 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 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 ARV4519PW|ARV7510PW22|ARV7518PW|ARV752DPW22|ARV8539PW22)
46 ucidef_add_switch "switch0" \
47 "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
48 ;;
49
50 ARV4520PW)
51 ucidef_add_switch "switch0" \
52 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
53 ;;
54
55 ARV7506PW11)
56 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
57 ucidef_add_switch "switch0" \
58 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
59 ;;
60
61 ARV7519PW)
62 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 1)
63 ucidef_add_switch "switch0" \
64 "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
65 ;;
66
67 ARV7519RW22)
68 wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 22)" 1)
69 ucidef_add_switch "switch0" \
70 "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0"
71 ;;
72
73 ASL56026)
74 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
75 wan_mac=$(mtd_get_mac_ascii uboot_env wanmac)
76 ucidef_add_switch "switch0"\
77 "2:lan" "3:lan" "6t@eth0"
78 ;;
79
80 BTHOMEHUBV2B)
81 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
82 wan_mac=$(macaddr_add "$lan_mac" 1)
83 ucidef_add_switch "switch0" \
84 "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0"
85 ;;
86
87 BTHOMEHUBV3A)
88 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
89 wan_mac=$(macaddr_add "$lan_mac" 1)
90 ucidef_set_interface_lan 'eth0'
91 ;;
92
93 BTHOMEHUBV5A)
94 lan_mac=$(mtd_get_mac_binary_ubi caldata 4364)
95 wan_mac=$(macaddr_add "$lan_mac" 1)
96 ucidef_add_switch "switch0" \
97 "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
98 ;;
99
100 DGN3500*)
101 ucidef_add_switch "switch0" \
102 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
103 ;;
104
105 DM200)
106 lan_mac=$(mtd_get_mac_binary ART 0)
107 wan_mac=$(macaddr_add "$lan_mac" 1)
108 ucidef_set_interface_lan 'eth0'
109 ;;
110
111 EASY80920NAND|EASY80920NOR)
112 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
113 wan_mac=$(macaddr_add "$lan_mac" 1)
114 ucidef_add_switch "switch0" \
115 "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
116 ;;
117
118 FRITZ3370)
119 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2439)" 1)
120 ;;
121
122 FRITZ7320)
123 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
124 ;;
125
126 FRITZ7360SL)
127 wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
128 ucidef_add_switch "switch0" \
129 "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
130 ;;
131
132 H201L)
133 ucidef_add_switch "switch0" \
134 "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
135 ;;
136
137 P2601HNFX)
138 ucidef_add_switch "switch0" \
139 "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0"
140 ;;
141
142 P2812HNUF*)
143 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
144 wan_mac=$(macaddr_add "$lan_mac" 1)
145 ucidef_add_switch "switch0" \
146 "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0"
147 ;;
148
149 TDW8970|TDW8980)
150 wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 61696)" 1)
151 ucidef_add_switch "switch0" \
152 "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
153 ;;
154
155 VG3503J)
156 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
157 wan_mac=$(macaddr_add "$lan_mac" 1)
158 ucidef_add_switch "switch0" \
159 "2:lan:1" "4:lan:2" "6t@eth0"
160 ;;
161
162 VR200v)
163 wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 61696)" 1)
164 ucidef_add_switch "switch0" \
165 "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
166 ;;
167
168 VGV7510KW22*)
169 wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
170 ucidef_add_switch "switch0" \
171 "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
172 ;;
173
174 VGV7519*)
175 wan_mac=$(mtd_get_mac_binary board_config 22)
176 ucidef_add_switch "switch0" \
177 "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
178 ;;
179
180 WBMR)
181 ucidef_add_switch "switch0" \
182 "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
183 ;;
184
185 WBMR300)
186 lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
187 wan_mac="$lan_mac"
188 ucidef_add_switch "switch0" \
189 "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
190 ;;
191
192 *)
193 ucidef_set_interface_lan 'eth0'
194 ;;
195
196 esac
197
198 ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
199 ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload"
200
201 if lantiq_is_vdsl_system; then
202 interface_wan="dsl0"
203 ucidef_add_vdsl_modem "$annex" "$tone" "$xfer_mode"
204 else
205 interface_wan="nas0"
206 ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
207 fi
208
209 ucidef_set_interface_wan "$interface_wan" "pppoe"
210
211 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
212 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
213
214 board_config_flush
215
216 exit 0
217