ramips: Add userspace support for the Edimax BR-6475nD
[openwrt/staging/rmilecki.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 FW="/lib/firmware/$FIRMWARE"
25 [ -e "$FW" ] && exit 0
26
27 . /lib/ramips.sh
28
29 board=$(ramips_board_name)
30
31 case "$FIRMWARE" in
32 "soc_wmac.eeprom")
33 case $board in
34 asl26555 | \
35 dir-300-b1 | \
36 dir-600-b1 | \
37 dir-600-b2 | \
38 dir-610-a1 | \
39 dir-615-d)
40 rt2x00_eeprom_extract "devdata" 16384 512
41 ;;
42
43 dap-1350)
44 rt2x00_eeprom_extract "devdata" 0 512
45 ;;
46
47 rt-n10-plus | \
48 rt-g32-b1)
49 rt2x00_eeprom_extract "devconf" 0 512
50 ;;
51
52 f5d8235-v1 | \
53 f5d8235-v2)
54 rt2x00_eeprom_extract "u-boot" 262144 512
55 ;;
56
57 3g-6200n | \
58 3g-6200nl | \
59 3g300m | \
60 air3gii | \
61 all0239-3g | \
62 all0256n | \
63 all5002 | \
64 all5003 | \
65 argus-atp52b | \
66 awm002-evb | \
67 bc2 | \
68 br6425 | \
69 br-6475nd | \
70 broadway | \
71 br6524n | \
72 carambola | \
73 d105 | \
74 dcs-930 | \
75 dir-300-b7 | \
76 dir-320-b1 | \
77 dir-615-h1 | \
78 dir-620-a1 | \
79 dir-620-d1 | \
80 esr-9753 | \
81 f7c027 | \
82 fonera20n | \
83 rt-n13u | \
84 freestation5 | \
85 hlk-rm04 | \
86 hw550-3g | \
87 mofi3500-3gn | \
88 mpr-a1 | \
89 mpr-a2 | \
90 pwh2004 | \
91 nbg-419n | \
92 nw718 | \
93 omni-emb | \
94 omni-emb-hpm | \
95 psr-680w | \
96 rt-n15 | \
97 rt-n56u | \
98 sl-r7205 | \
99 v11st-fe | \
100 v22rw-2x2 | \
101 w306r-v20 | \
102 w150m | \
103 w502u | \
104 wcr-150gn | \
105 whr-g300n | \
106 whr-300hp2 | \
107 whr-600d | \
108 wl-330n | \
109 wl-330n3g | \
110 wl-351 | \
111 wli-tx4-ag300n | \
112 wmr300 | \
113 wnce2001 | \
114 wr512-3gn | \
115 wr6202 | \
116 mzk-w300nh2 | \
117 ur-326n4g | \
118 ur-336un | \
119 xdxrn502j | \
120 hg255d)
121 rt2x00_eeprom_extract "factory" 0 512
122 ;;
123
124 wl341v3)
125 rt2x00_eeprom_extract "board-nvram" 64880 512
126 ;;
127
128 *)
129 rt2x00_eeprom_die "board $board is not supported yet"
130 ;;
131 esac
132 ;;
133
134 "rt2x00pci_1_0.eeprom")
135 case $board in
136 rt-n56u | whr-600d)
137 rt2x00_eeprom_extract "factory" 32768 512
138 ;;
139 esac
140 ;;
141 esac