ramips: Basic support for the AsiaRF RT5350 based AWM002 module and evaluation board.
[openwrt/svn-archive/archive.git] / target / linux / ramips / base-files / etc / hotplug.d / firmware / 10-rt2x00-eeprom
1 #!/bin/sh
2
3 rt2x00_eeprom_die() {
4 echo "rt2x00 eeprom: " "$*"
5 exit 1
6 }
7
8 rt2x00_eeprom_extract() {
9 local part=$1
10 local offset=$2
11 local count=$3
12 local mtd
13
14 . /lib/functions.sh
15
16 mtd=$(find_mtd_part $part)
17 [ -n "$mtd" ] || \
18 rt2x00_eeprom_die "no mtd device found for partition $part"
19
20 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
21 rt2x00_eeprom_die "failed to extract from $mtd"
22 }
23
24 [ -e /lib/firmware/$FIRMWARE ] && exit 0
25
26 . /lib/ramips.sh
27
28 board=$(ramips_board_name)
29
30 case "$FIRMWARE" in
31 "soc_wmac.eeprom")
32 case $board in
33 asl26555 | \
34 dir-300-b1 | \
35 dir-600-b1 | \
36 dir-600-b2 | \
37 dir-615-d)
38 rt2x00_eeprom_extract "devdata" 16384 512
39 ;;
40
41 dap-1350)
42 rt2x00_eeprom_extract "devdata" 0 512
43 ;;
44
45 rt-n10-plus | \
46 rt-g32-b1)
47 rt2x00_eeprom_extract "devconf" 0 512
48 ;;
49
50 f5d8235-v1 | \
51 f5d8235-v2)
52 rt2x00_eeprom_extract "u-boot" 262144 512
53 ;;
54
55 3g-6200n | \
56 3g-6200nl | \
57 3g300m | \
58 air3gii | \
59 all0239-3g | \
60 all0256n | \
61 all5002 | \
62 all5003 | \
63 argus-atp52b | \
64 awm002-evb | \
65 bc2 | \
66 br6425 | \
67 broadway | \
68 br6524n | \
69 carambola | \
70 d105 | \
71 dir-615-h1 | \
72 dir-620-a1 | \
73 dir-620-d1 | \
74 esr-9753 | \
75 f7c027 | \
76 fonera20n | \
77 rt-n13u | \
78 freestation5 | \
79 hw550-3g | \
80 mofi3500-3gn | \
81 mpr-a2 | \
82 pwh2004 | \
83 nbg-419n | \
84 nw718 | \
85 omni-emb | \
86 omni-emb-hpm | \
87 psr-680w | \
88 rt-n15 | \
89 rt-n56u | \
90 sl-r7205 | \
91 v11st-fe | \
92 v22rw-2x2 | \
93 w306r-v20 | \
94 w150m | \
95 w502u | \
96 wcr-150gn | \
97 whr-g300n | \
98 wl-330n | \
99 wl-330n3g | \
100 wl-351 | \
101 wli-tx4-ag300n | \
102 wnce2001 | \
103 wr512-3gn | \
104 wr6202 | \
105 mzk-w300nh2 | \
106 ur-326n4g | \
107 ur-336un | \
108 xdxrn502j | \
109 hg255d)
110 rt2x00_eeprom_extract "factory" 0 512
111 ;;
112
113 wl341v3)
114 rt2x00_eeprom_extract "board-nvram" 64880 512
115 ;;
116
117 *)
118 rt2x00_eeprom_die "board $board is not supported yet"
119 ;;
120 esac
121 ;;
122
123 "rt2x00pci_1_0.eeprom")
124 case $board in
125 rt-n56u)
126 rt2x00_eeprom_extract "factory" 32768 512
127 ;;
128 esac
129 ;;
130 esac