ramips: add userspace support for the Edimax BR-6425
[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         3g300m | \
56         air3gii | \
57         all0239-3g | \
58         all0256n | \
59         all5002 | \
60         argus-atp52b | \
61         bc2 | \
62         br6425 | \
63         broadway | \
64         br6524n | \
65         carambola | \
66         dir-615-h1 | \
67         dir-620-a1 | \
68         esr-9753 | \
69         fonera20n | \
70         rt-n13u | \
71         freestation5 | \
72         hw550-3g | \
73         mofi3500-3gn | \
74         pwh2004 | \
75         nbg-419n | \
76         nw718 | \
77         omni-emb | \
78         psr-680w | \
79         rt-n15 | \
80         rt-n56u | \
81         sl-r7205 | \
82         v11st-fe | \
83         v22rw-2x2 | \
84         w306r-v20 | \
85         w502u | \
86         wcr-150gn | \
87         whr-g300n | \
88         wl-330n | \
89         wl-330n3g | \
90         wl-351 | \
91         wli-tx4-ag300n | \
92         wr512-3gn | \
93         wr6202 | \
94         mzk-w300nh2 | \
95         ur-336un | \
96         xdxrn502j)
97                 rt2x00_eeprom_extract "factory" 0 272
98                 ;;
99
100         wl341v3)
101                 rt2x00_eeprom_extract "board-nvram" 64880 272
102                 ;;
103
104         *)
105                 rt2x00_eeprom_die "board $board is not supported yet"
106                 ;;
107         esac
108         ;;
109
110 "rt2x00pci_1_0.eeprom")
111         case $board in
112         rt-n56u)
113                 rt2x00_eeprom_extract "factory" 32768 272
114                 ;;
115         esac
116         ;;
117 esac