ralink: DIR-300 B7 and DIR-320/NRU B1 on Ralink RT5350
[openwrt/openwrt.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-300-b7 | \
72 dir-320-b1 | \
73 dir-610-a1 | \
74 dir-615-h1 | \
75 dir-620-a1 | \
76 dir-620-d1 | \
77 esr-9753 | \
78 f7c027 | \
79 fonera20n | \
80 rt-n13u | \
81 freestation5 | \
82 hw550-3g | \
83 mofi3500-3gn | \
84 mpr-a1 | \
85 mpr-a2 | \
86 pwh2004 | \
87 nbg-419n | \
88 nw718 | \
89 omni-emb | \
90 omni-emb-hpm | \
91 psr-680w | \
92 rt-n15 | \
93 rt-n56u | \
94 sl-r7205 | \
95 v11st-fe | \
96 v22rw-2x2 | \
97 w306r-v20 | \
98 w150m | \
99 w502u | \
100 wcr-150gn | \
101 whr-g300n | \
102 wl-330n | \
103 wl-330n3g | \
104 wl-351 | \
105 wli-tx4-ag300n | \
106 wnce2001 | \
107 wr512-3gn | \
108 wr6202 | \
109 mzk-w300nh2 | \
110 ur-326n4g | \
111 ur-336un | \
112 xdxrn502j | \
113 hg255d)
114 rt2x00_eeprom_extract "factory" 0 512
115 ;;
116
117 wl341v3)
118 rt2x00_eeprom_extract "board-nvram" 64880 512
119 ;;
120
121 *)
122 rt2x00_eeprom_die "board $board is not supported yet"
123 ;;
124 esac
125 ;;
126
127 "rt2x00pci_1_0.eeprom")
128 case $board in
129 rt-n56u)
130 rt2x00_eeprom_extract "factory" 32768 512
131 ;;
132 esac
133 ;;
134 esac