ramips: Add support of D-link DIR-620D1
[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 dir-300-b1 | \
34 dir-600-b1 | \
35 dir-600-b2 | \
36 dir-615-d)
37 rt2x00_eeprom_extract "devdata" 16384 272
38 ;;
39
40 dap-1350)
41 rt2x00_eeprom_extract "devdata" 0 272
42 ;;
43
44 rt-n10-plus | \
45 rt-g32-b1)
46 rt2x00_eeprom_extract "devconf" 0 272
47 ;;
48
49 f5d8235-v1 | \
50 f5d8235-v2)
51 rt2x00_eeprom_extract "u-boot" 262144 272
52 ;;
53
54 3g-6200n | \
55 3g-6200nl | \
56 3g300m | \
57 air3gii | \
58 all0239-3g | \
59 all0256n | \
60 all5002 | \
61 argus-atp52b | \
62 bc2 | \
63 br6425 | \
64 broadway | \
65 br6524n | \
66 carambola | \
67 d105 | \
68 dir-615-h1 | \
69 dir-620-a1 | \
70 dir-620-d1 | \
71 esr-9753 | \
72 fonera20n | \
73 rt-n13u | \
74 freestation5 | \
75 hw550-3g | \
76 mofi3500-3gn | \
77 pwh2004 | \
78 nbg-419n | \
79 nw718 | \
80 omni-emb | \
81 omni-emb-hpm | \
82 psr-680w | \
83 rt-n15 | \
84 rt-n56u | \
85 sl-r7205 | \
86 v11st-fe | \
87 v22rw-2x2 | \
88 w306r-v20 | \
89 w150m | \
90 w502u | \
91 wcr-150gn | \
92 whr-g300n | \
93 wl-330n | \
94 wl-330n3g | \
95 wl-351 | \
96 wli-tx4-ag300n | \
97 wnce2001 | \
98 wr512-3gn | \
99 wr6202 | \
100 mzk-w300nh2 | \
101 ur-326n4g | \
102 ur-336un | \
103 xdxrn502j)
104 rt2x00_eeprom_extract "factory" 0 272
105 ;;
106
107 wl341v3)
108 rt2x00_eeprom_extract "board-nvram" 64880 272
109 ;;
110
111 *)
112 rt2x00_eeprom_die "board $board is not supported yet"
113 ;;
114 esac
115 ;;
116
117 "rt2x00pci_1_0.eeprom")
118 case $board in
119 rt-n56u)
120 rt2x00_eeprom_extract "factory" 32768 272
121 ;;
122 esac
123 ;;
124 esac