lantiq: do not set default firmware file
[openwrt/svn-archive/archive.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 DGN3500*)
66 ucidef_add_switch "switch0" \
67 "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
68 ;;
69
70 GR7000)
71 ucidef_set_interface_wan "eth0"
72 ;;
73
74 H201L)
75 ucidef_add_switch "switch0" \
76 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4t@eth0"
77 ;;
78
79 #rtl8306g
80 P2601HNFX)
81 ucidef_add_switch "switch0" \
82 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "5t@eth0"
83 ;;
84
85 P2812HNUF*)
86 lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
87 wan_mac=$(macaddr_add "$lan_mac" 1)
88 ucidef_add_switch "switch0" \
89 "0:lan:1" "1:lan:2" "2:lan:3" "4:lan:4" "5:lan:5" "6t@eth0"
90 ;;
91
92 TDW8970|TDW8980)
93 lan_mac=$(mtd_get_mac_binary boardconfig 61696)
94 wan_mac=$(macaddr_add "$lan_mac" 1)
95 ucidef_add_switch "switch0" \
96 "0:lan:1" "2:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
97 ;;
98
99 VR200v)
100 lan_mac=$(mtd_get_mac_binary romfile 61696)
101 wan_mac=$(macaddr_add "$lan_mac" 1)
102 ucidef_add_switch "switch0" \
103 "0:lan:1" "2:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
104 ;;
105
106 ARV7519RW22)
107 lan_mac=$(mtd_get_mac_binary boardconfig 22)
108 wan_mac=$(macaddr_add "$lan_mac" 1)
109 ucidef_add_switch "switch0" \
110 "0:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:lan:5" "6t@eth0"
111 ;;
112
113 BTHOMEHUBV2B|BTHOMEHUBV3A)
114 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
115 wan_mac=$(macaddr_add "$lan_mac" 1)
116 ucidef_set_interface_lan 'eth0'
117 ;;
118
119 BTHOMEHUBV5A)
120 lan_mac=$(mtd_get_mac_binary caldata 4364)
121 wan_mac=$(macaddr_add "$lan_mac" 1)
122 ucidef_add_switch "switch0" \
123 "0:lan:1" "1:lan:2" "2:lan:3" "4:lan:4" "6t@eth0"
124 ;;
125
126 VGV7519)
127 lan_mac=$(mtd_get_mac_binary board_config 22)
128 wan_mac=$(macaddr_add "$lan_mac" 1)
129 ucidef_set_interface_lan 'eth0'
130 ;;
131
132 VGV7510KW22)
133 lan_mac=$(mtd_get_mac_binary board_config 22)
134 wan_mac=$(macaddr_add "$lan_mac" 1)
135 ucidef_add_switch "switch0" \
136 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
137 ;;
138
139 esac
140
141 if [ -n "$(ls /lib/modules/`uname -r`/ltq_atm*)" ]; then
142 ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload"
143 fi
144
145 if grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo; then
146 interface_wan="ptm0"
147 ucidef_add_vdsl_modem "$annex" "av" "ptm"
148 else
149 interface_wan="nas0"
150 ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
151 fi
152
153 ucidef_set_interface_wan "$interface_wan" "pppoe"
154
155 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan "$lan_mac"
156 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan "$wan_mac"
157
158 board_config_flush
159
160 exit 0