ramips: squelch mdio debugging info on rt2880 ethernet
[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 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 awapn2403 | \
68 bc2 | \
69 br6425 | \
70 br-6475nd | \
71 broadway | \
72 br6524n | \
73 carambola | \
74 cy-swr1100 | \
75 d105 | \
76 dcs-930 | \
77 dir-300-b7 | \
78 dir-320-b1 | \
79 dir-615-h1 | \
80 dir-620-a1 | \
81 dir-620-d1 | \
82 dir-645 | \
83 esr-9753 | \
84 f7c027 | \
85 fonera20n | \
86 rt-n13u | \
87 freestation5 | \
88 hlk-rm04 | \
89 hw550-3g | \
90 mofi3500-3gn | \
91 mpr-a1 | \
92 mpr-a2 | \
93 pwh2004 | \
94 ncs601w | \
95 nbg-419n | \
96 nw718 | \
97 omni-emb | \
98 omni-emb-hpm | \
99 psr-680w | \
100 px4885 | \
101 rt-n15 | \
102 rt-n56u | \
103 rut5xx | \
104 sl-r7205 | \
105 v11st-fe | \
106 v22rw-2x2 | \
107 w306r-v20 | \
108 w150m | \
109 w502u | \
110 wcr-150gn | \
111 whr-g300n | \
112 whr-300hp2 | \
113 whr-600d | \
114 whr-1166d | \
115 wl-330n | \
116 wl-330n3g | \
117 wl-351 | \
118 wli-tx4-ag300n | \
119 wmr300 | \
120 wnce2001 | \
121 wr512-3gn | \
122 wr6202 | \
123 wr8305rt | \
124 wrtnode | \
125 mzk-w300nh2 | \
126 ur-326n4g | \
127 ur-336un | \
128 xdxrn502j | \
129 hg255d)
130 rt2x00_eeprom_extract "factory" 0 512
131 ;;
132
133 wl341v3)
134 rt2x00_eeprom_extract "board-nvram" 64880 512
135 ;;
136
137 *)
138 rt2x00_eeprom_die "board $board is not supported yet"
139 ;;
140 esac
141 ;;
142
143 "rt2x00pci_1_0.eeprom")
144 case $board in
145 cy-swr1100)
146 rt2x00_eeprom_extract "factory" 8192 512
147 ;;
148 rt-n56u | whr-600d | whr-1166d)
149 rt2x00_eeprom_extract "factory" 32768 512
150 ;;
151 esac
152 ;;
153 esac