ramips: rt305x: add support for Edimax 3G-6200N
[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 . /etc/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 "RT288X.eeprom" | \
32 "RT305X.eeprom" | \
33 "RT3883.eeprom")
34 case $board in
35 dir-300-b1 | \
36 dir-600-b1 | \
37 dir-600-b2)
38 rt2x00_eeprom_extract "devdata" 16384 272
39 ;;
40
41 rt-n10-plus | \
42 rt-g32-b1)
43 rt2x00_eeprom_extract "devconf" 0 272
44 ;;
45
46 f5d8235-v1 | \
47 f5d8235-v2)
48 rt2x00_eeprom_extract "u-boot" 262144 272
49 ;;
50
51 3g-6200n | \
52 all0256n | \
53 argus-atp52b | \
54 bc2 | \
55 esr-9753 | \
56 fonera20n | \
57 freestation5 | \
58 hw550-3g | \
59 mofi3500-3gn | \
60 pwh2004 | \
61 nbg-419n | \
62 nw718 | \
63 omni-emb | \
64 psr-680w | \
65 rt-n15 | \
66 rt-n56u | \
67 sl-r7205 | \
68 v11st-fe | \
69 v22rw-2x2 | \
70 w306r-v20 | \
71 w502u | \
72 wcr-150gn | \
73 whr-g300n | \
74 wl-330n | \
75 wl-330n3g | \
76 wl-351 | \
77 wli-tx4-ag300n | \
78 wr512-3gn | \
79 wr6202 | \
80 ur-336un | \
81 xdxrn502j)
82 rt2x00_eeprom_extract "factory" 0 272
83 ;;
84
85 wl341v3)
86 rt2x00_eeprom_extract "board-nvram" 64880 272
87 ;;
88
89 *)
90 rt2x00_eeprom_die "board $board is not supported yet"
91 ;;
92 esac
93 ;;
94
95 "rt2x00pci_1_0.eeprom")
96 case $board in
97 rt-n56u)
98 rt2x00_eeprom_extract "factory" 32768 272
99 ;;
100 esac
101 ;;
102 esac