d5784db750df019cb7f536b3e7429cd568200e71
[openwrt.git] / target / linux / brcm63xx / base-files / lib / brcm63xx.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2007 OpenWrt.org
4 #
5 #
6
7 board_name=""
8 status_led=""
9 status_led2=""
10 sys_mtd_part=""
11 brcm63xx_has_reset_button=""
12 ifname=""
13
14 brcm63xx_detect() {
15         board_name=$(awk 'BEGIN{FS="[ \t:/]+"} /system type/ {print $4}' /proc/cpuinfo)
16
17         if [ "$board_name" = "96358VW" ] && [ -n "$(swconfig dev eth1 help 2>/dev/null)" ]; then
18                 board_name="DVAG3810BN"
19         fi
20
21         case "$board_name" in
22         963281TAN)
23                 status_led="963281TAN::power"
24                 ifname=eth0
25                 ;;
26         963281T_TEF)
27                 brcm63xx_has_reset_button="true"
28                 status_led="A4001N1:green:power"
29                 ifname=eth0
30                 ;;
31         96328avng)
32                 status_led="96328avng::power"
33                 ifname=eth0
34                 ;;
35         96328A-1241N)
36                 brcm63xx_has_reset_button="true"
37                 status_led="AR-5381u:green:power"
38                 ifname=eth0
39                 ;;
40         96328A-1441N1)
41                 brcm63xx_has_reset_button="true"
42                 status_led="AR-5387un:green:power"
43                 ifname=eth0
44                 ;;
45         96348GW)
46                 status_led="96348GW:green:power"
47                 brcm63xx_has_reset_button="true"
48                 ifname=eth1
49                 ;;
50         96348GW-11)
51                 status_led="96348GW-11:green:power"
52                 brcm63xx_has_reset_button="true"
53                 ifname=eth1
54                 ;;
55         96358-502V)
56                 status_led="spw303v:green:power+adsl"
57                 brcm63xx_has_reset_button="true"
58                 ifname=eth0
59                 ;;
60         96368M-1341N)
61                 brcm63xx_has_reset_button="true"
62                 status_led="VR-3025un:green:power"
63                 ifname="eth0"
64                 ;;
65         96368M-1541N)
66                 brcm63xx_has_reset_button="true"
67                 status_led="VR-3025u:green:power"
68                 ifname="eth0"
69                 ;;
70         96369R-1231N)
71                 brcm63xx_has_reset_button="true"
72                 status_led="WAP-5813n:green:power"
73                 ifname="eth0"
74                 ;;
75         AR1004G)
76                 status_led="AR1004G:green:power"
77                 brcm63xx_has_reset_button="true"
78                 ;;
79         AW4139 |\
80         AW4339U)
81                 status_led="dsl-274xb:green:power"
82                 brcm63xx_has_reset_button="true"
83                 ifname=eth0
84                 ;;
85         CPVA642)
86                 status_led="CPVA642:green:power:"
87                 brcm63xx_has_reset_button="true"
88                 ifname=eth0
89                 ;;
90         CT536_CT5621)
91                 status_led="CT536_CT5621:green:power"
92                 brcm63xx_has_reset_button="true"
93                 ifname=eth0
94                 ;;
95         CVG834G_E15R3921)
96                 status_led="CVG834G:green:power"
97                 ifname=eth0
98                 ;;
99         D-4P-W)
100                 status_led="D-4P-W:green:power"
101                 brcm63xx_has_reset_button="true"
102                 ifname=eth0
103                 ;;
104         "F@ST2504n")
105                 status_led="fast2504n:green:ok"
106                 brcm63xx_has_reset_button="true"
107                 ifname=eth0
108                 ;;
109         'F@ST2704V2')
110                 status_led="F@ST2704V2:green:power"
111                 brcm63xx_has_reset_button="true"
112                 ifname=eth0
113                 ;;
114         GW6000)
115                 brcm63xx_has_reset_button="true"
116                 ifname=eth1
117                 ;;
118         GW6200)
119                 status_led="GW6200:green:line1"
120                 status_led2="GW6200:green:tel"
121                 brcm63xx_has_reset_button="true"
122                 ifname=eth1
123                 ;;
124         HW553)
125                 status_led="HW553:blue:power"
126                 brcm63xx_has_reset_button="true"
127                 ifname=eth0
128                 ;;
129         HW556*)
130                 status_led="HW556:red:power"
131                 brcm63xx_has_reset_button="true"
132                 ifname=eth0
133                 ;;
134         HW6358GW_B)
135                 status_led="HW520:green:net"
136                 brcm63xx_has_reset_button="true"
137                 ifname="eth0"
138                 ;;
139         NB6)
140                 brcm63xx_has_reset_button="true"
141                 ifname=eth0
142                 ;;
143         P870HW-51a_v2)
144                 brcm63xx_has_reset_button="true"
145                 status_led="P870HW-51a:green:power"
146                 ifname="eth0"
147                 ;;
148         RTA770BW)
149                 brcm63xx_has_reset_button="true"
150                 status_led="RTA770BW:green:diag"
151                 ifname=eth0
152                 ;;
153         RTA770W)
154                 brcm63xx_has_reset_button="true"
155                 status_led="RTA770W:green:diag"
156                 ifname=eth0
157                 ;;
158         SPW500V)
159                 status_led="SPW500V:green:power"
160                 brcm63xx_has_reset_button="true"
161                 ifname=eth0
162                 ;;
163         V2110)
164                 status_led="V2110:power:green"
165                 brcm63xx_has_reset_button="true"
166                 ifname=eth0
167                 ;;
168         *)
169                 ;;
170         esac
171 }
172
173 brcm63xx_detect