generic: ar8216: use mdiobus_write in ar8236_hw_init
[openwrt.git] / target / linux / ramips / base-files / lib / ramips.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2010 OpenWrt.org
4 #
5
6 ramips_get_mac_binary()
7 {
8 local mtdname="$1"
9 local seek="$2"
10 local part
11
12 . /lib/functions.sh
13
14 part=$(find_mtd_part "$mtdname")
15 if [ -z "$part" ]; then
16 echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
17 return
18 fi
19
20 dd bs=1 skip=$seek count=6 if=$part 2>/dev/null | /usr/sbin/maccalc bin2mac
21 }
22
23 ramips_get_mac_nvram()
24 {
25 local mtdname="$1"
26 local key="$2"
27 local part
28 local mac_dirty
29
30 . /lib/functions.sh
31
32 part=$(find_mtd_part "$mtdname")
33 if [ -z "$part" ]; then
34 echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
35 return
36 fi
37
38 mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
39 # "canonicalize" mac
40 /usr/sbin/maccalc add "$mac_dirty" 0
41 }
42
43 ramips_board_name() {
44 local machine
45 local name
46
47 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
48
49 case "$machine" in
50 *"Allnet ALL0256N")
51 name="all0256n"
52 ;;
53 *"Argus ATP-52B")
54 name="argus-atp52b"
55 ;;
56 *"Aztech HW550-3G")
57 name="hw550-3g"
58 ;;
59 *"DIR-300 B1")
60 name="dir-300-b1"
61 ;;
62 *"DIR-600 B1")
63 name="dir-600-b1"
64 ;;
65 *"DIR-600 B2")
66 name="dir-600-b2"
67 ;;
68 *"ESR-9753")
69 name="esr-9753"
70 ;;
71 *"F5D8235 v1")
72 name="f5d8235-v1"
73 ;;
74 *"F5D8235 v2")
75 name="f5d8235-v2"
76 ;;
77 *"La Fonera 2.0N")
78 name="fonera20n"
79 ;;
80 *"MoFi Network MOFI3500-3GN")
81 name="mofi3500-3gn"
82 ;;
83 *"NBG-419N")
84 name="nbg-419n"
85 ;;
86 *"NexAira BC2")
87 name="bc2"
88 ;;
89 *"NW718")
90 name="nw718"
91 ;;
92 *"Omnima MiniEMBWiFi")
93 name="omni-emb"
94 ;;
95 *"PWH2004")
96 name="pwh2004"
97 ;;
98 *"RT-G32 B1")
99 name="rt-g32-b1"
100 ;;
101 *"RT-N10+")
102 name="rt-n10-plus"
103 ;;
104 *"RT-N15")
105 name="rt-n15"
106 ;;
107 *"RT-N56U")
108 name="rt-n56u"
109 ;;
110 *"Skyline SL-R7205"*)
111 name="sl-r7205"
112 ;;
113 *"Sparklan WCR-150GN")
114 name="wcr-150gn"
115 ;;
116 *"V22RW-2X2")
117 name="v22rw-2x2"
118 ;;
119 *"W502U")
120 name="w502u"
121 ;;
122 *"WHR-G300N")
123 name="whr-g300n"
124 ;;
125 *"Sitecom WL-341 v3")
126 name="wl341v3"
127 ;;
128 *"Sitecom WL-351 v1 002")
129 name="wl-351"
130 ;;
131 *"Ralink V11ST-FE")
132 name="v11st-fe"
133 ;;
134 *"WLI-TX4-AG300N")
135 name="wli-tx4-ag300n"
136 ;;
137 *"WZR-AGL300NH")
138 name="wzr-agl300nh"
139 ;;
140 *"WR512-3GN-like router")
141 name="wr512-3gn"
142 ;;
143 *"AWB WR6202")
144 name="wr6202"
145 ;;
146 *"XDX RN502J")
147 name="xdxrn502j"
148 ;;
149 *)
150 name="generic"
151 ;;
152 esac
153
154 echo $name
155 }
This page took 0.048839 seconds and 5 git commands to generate.