lantiq: add Buffalo WBMR-300HPD support
[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 encaps="llc"
16 payload="bridged"
17 lan_mac=""
18 wan_mac=""
19 interface_wan=""
20
21 board=$(lantiq_board_name)
22
23 case "$board" in
24 # adm6996
25 ARV4510PW)
26 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
27 wan_mac=$(macaddr_add "$lan_mac" 1)
28 ucidef_add_switch "switch0" \
29 "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
30 ;;
31
32 ARV4520PW)
33 ucidef_add_switch "switch0" \
34 "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
35 ;;
36
37 ACMP252|GIGASX76X)
38 ucidef_add_switch "switch0" \
39 "4:lan:1" "3:lan:2" "2:lan:3" "1:lan:4" "5t@eth0"
40 ;;
41
42 # ar8316
43 ARV4519PW|ARV7510PW22|ARV7518PW|ARV752DPW22|ARV8539PW22)
44 ucidef_add_switch "switch0" \
45 "0t@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
46 ;;
47
48 # rtl8306g
49 ARV7519PW)
50 lan_mac=$(mtd_get_mac_binary board_config 22)
51 wan_mac=$(macaddr_add "$lan_mac" 1)
52 ucidef_add_switch "switch0" \
53 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4t@eth0"
54 ;;
55
56 WBMR)
57 ucidef_add_switch "switch0" \
58 "0t@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
59 ;;
60
61 VG3503J)
62 ucidef_set_interface_lan 'eth0'
63 ;;
64
65 ARV4518PWR01*)
66 ucidef_set_interface_lan 'eth0'
67 ;;
68
69 DGN3500*)
70 eth0_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
71 nas0_mac=$(macaddr_add "$eth0_mac" 1)
72 ifconfig eth0 hw ether "$eth0_mac"
73 ifconfig wlan0 hw ether "$eth0_mac"
74 esi $(echo "$nas0_mac" | tr -d :)
75 ucidef_add_switch "switch0" \
76 "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
77 ;;
78
79 GR7000)
80 ucidef_set_interface_wan "eth0"
81 ;;
82
83 H201L)
84 ucidef_add_switch "switch0" \
85 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4t@eth0"
86 ;;
87
88 #rtl8306g
89 P2601HNFX)
90 ucidef_add_switch "switch0" \
91 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "5t@eth0"
92 ;;
93
94 P2812HNUF*)
95 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
96 wan_mac=$(macaddr_add "$lan_mac" 1)
97 ucidef_add_switch "switch0" \
98 "0:lan:1" "1:lan:2" "2:lan:3" "4:lan:4" "5:lan:5" "6t@eth0"
99 ;;
100
101 TDW8970|TDW8980)
102 lan_mac=$(mtd_get_mac_binary boardconfig 61696)
103 wan_mac=$(macaddr_add "$lan_mac" 1)
104 ucidef_add_switch "switch0" \
105 "0:lan:1" "2:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
106 ;;
107
108 VR200v)
109 lan_mac=$(mtd_get_mac_binary romfile 61696)
110 wan_mac=$(macaddr_add "$lan_mac" 1)
111 ucidef_add_switch "switch0" \
112 "0:lan:1" "2:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
113 ;;
114
115 ARV7519RW22)
116 lan_mac=$(mtd_get_mac_binary boardconfig 22)
117 wan_mac=$(macaddr_add "$lan_mac" 1)
118 ucidef_add_switch "switch0" \
119 "0:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:lan:5" "6t@eth0"
120 ;;
121
122 BTHOMEHUBV2B|BTHOMEHUBV3A)
123 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
124 wan_mac=$(macaddr_add "$lan_mac" 1)
125 ucidef_set_interface_lan 'eth0'
126 ;;
127
128 BTHOMEHUBV5A)
129 lan_mac=$(mtd_get_mac_binary caldata 4364)
130 wan_mac=$(macaddr_add "$lan_mac" 1)
131 ucidef_add_switch "switch0" \
132 "0:lan:1" "1:lan:2" "2:lan:3" "4:lan:4" "6t@eth0"
133 ;;
134
135 VGV7519)
136 lan_mac=$(mtd_get_mac_binary board_config 22)
137 wan_mac=$(macaddr_add "$lan_mac" 1)
138 ucidef_add_switch "switch0" \
139 "4:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "6t@eth0"
140 ;;
141
142 VGV7510KW22)
143 lan_mac=$(mtd_get_mac_binary board_config 22)
144 wan_mac=$(macaddr_add "$lan_mac" 1)
145 ucidef_add_switch "switch0" \
146 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
147 ;;
148
149 WBMR300)
150 lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
151 wan_mac="$lan_mac"
152 ucidef_add_switch "switch0" \
153 "2:lan:1" "3:lan:2" "5:lan:3" "4:wan:1" "6t@eth0"
154 ;;
155
156 esac
157
158 if [ -n "$(ls /lib/modules/`uname -r`/ltq_atm*)" ]; then
159 ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload"
160 fi
161
162 if grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo; then
163 interface_wan="ptm0"
164 ucidef_add_vdsl_modem "$annex" "av" "ptm"
165 else
166 interface_wan="nas0"
167 ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
168 fi
169
170 ucidef_set_interface_wan "$interface_wan" "pppoe"
171
172 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan "$lan_mac"
173 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan "$wan_mac"
174
175 board_config_flush
176
177 exit 0