OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/local-symbols |
2 | +++ b/local-symbols |
||
3 | @@ -305,6 +305,7 @@ RT2X00_LIB_FIRMWARE= |
||
4 | RT2X00_LIB_CRYPTO= |
||
5 | RT2X00_LIB_LEDS= |
||
6 | RT2X00_LIB_DEBUGFS= |
||
7 | +RT2X00_LIB_EEPROM= |
||
8 | RT2X00_DEBUG= |
||
9 | WLAN_VENDOR_REALTEK= |
||
10 | RTL8180= |
||
11 | --- a/drivers/net/wireless/ralink/rt2x00/Kconfig |
||
12 | +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig |
||
13 | @@ -69,6 +69,7 @@ config RT2800PCI |
||
14 | select RT2X00_LIB_MMIO |
||
15 | select RT2X00_LIB_PCI |
||
16 | select RT2X00_LIB_FIRMWARE |
||
17 | + select RT2X00_LIB_EEPROM |
||
18 | select RT2X00_LIB_CRYPTO |
||
19 | depends on CRC_CCITT |
||
20 | depends on EEPROM_93CX6 |
||
21 | @@ -215,6 +216,7 @@ config RT2800SOC |
||
22 | select RT2X00_LIB_MMIO |
||
23 | select RT2X00_LIB_CRYPTO |
||
24 | select RT2X00_LIB_FIRMWARE |
||
25 | + select RT2X00_LIB_EEPROM |
||
26 | select RT2800_LIB |
||
27 | select RT2800_LIB_MMIO |
||
28 | ---help--- |
||
29 | @@ -265,6 +267,9 @@ config RT2X00_LIB_FIRMWARE |
||
30 | config RT2X00_LIB_CRYPTO |
||
31 | bool |
||
32 | |||
33 | +config RT2X00_LIB_EEPROM |
||
34 | + boolean |
||
35 | + |
||
36 | config RT2X00_LIB_LEDS |
||
37 | bool |
||
38 | default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n) |
||
39 | --- a/drivers/net/wireless/ralink/rt2x00/Makefile |
||
40 | +++ b/drivers/net/wireless/ralink/rt2x00/Makefile |
||
41 | @@ -8,6 +8,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) + |
||
42 | rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o |
||
43 | rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o |
||
44 | rt2x00lib-$(CPTCFG_RT2X00_LIB_LEDS) += rt2x00leds.o |
||
45 | +rt2x00lib-$(CPTCFG_RT2X00_LIB_EEPROM) += rt2x00eeprom.o |
||
46 | |||
47 | obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o |
||
48 | obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o |
||
49 | --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h |
||
50 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h |
||
51 | @@ -48,6 +48,8 @@ struct rt2800_drv_data { |
||
52 | struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE]; |
||
53 | }; |
||
54 | |||
55 | +#include "rt2800.h" |
||
56 | + |
||
57 | struct rt2800_ops { |
||
58 | u32 (*register_read)(struct rt2x00_dev *rt2x00dev, |
||
59 | const unsigned int offset); |
||
60 | @@ -145,6 +147,15 @@ static inline int rt2800_read_eeprom(str |
||
61 | { |
||
62 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
||
63 | |||
64 | + if (rt2x00dev->eeprom_file) { |
||
65 | + memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, |
||
66 | + EEPROM_SIZE); |
||
67 | + return 0; |
||
68 | + } |
||
69 | + |
||
70 | + if (!rt2800ops->read_eeprom) |
||
71 | + return -EINVAL; |
||
72 | + |
||
73 | return rt2800ops->read_eeprom(rt2x00dev); |
||
74 | } |
||
75 | |||
76 | --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c |
||
77 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c |
||
78 | @@ -102,19 +102,6 @@ static int rt2800soc_set_device_state(st |
||
79 | return retval; |
||
80 | } |
||
81 | |||
82 | -static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev) |
||
83 | -{ |
||
84 | - void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); |
||
85 | - |
||
86 | - if (!base_addr) |
||
87 | - return -ENOMEM; |
||
88 | - |
||
89 | - memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); |
||
90 | - |
||
91 | - iounmap(base_addr); |
||
92 | - return 0; |
||
93 | -} |
||
94 | - |
||
95 | /* Firmware functions */ |
||
96 | static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
||
97 | { |
||
98 | @@ -178,7 +165,6 @@ static const struct rt2800_ops rt2800soc |
||
99 | .register_multiread = rt2x00mmio_register_multiread, |
||
100 | .register_multiwrite = rt2x00mmio_register_multiwrite, |
||
101 | .regbusy_read = rt2x00mmio_regbusy_read, |
||
102 | - .read_eeprom = rt2800soc_read_eeprom, |
||
103 | .hwcrypt_disabled = rt2800soc_hwcrypt_disabled, |
||
104 | .drv_write_firmware = rt2800soc_write_firmware, |
||
105 | .drv_init_registers = rt2800mmio_init_registers, |
||
106 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h |
||
107 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h |
||
108 | @@ -703,6 +703,7 @@ enum rt2x00_capability_flags { |
||
109 | REQUIRE_HT_TX_DESC, |
||
110 | REQUIRE_PS_AUTOWAKE, |
||
111 | REQUIRE_DELAYED_RFKILL, |
||
112 | + REQUIRE_EEPROM_FILE, |
||
113 | |||
114 | /* |
||
115 | * Capabilities |
||
116 | @@ -978,6 +979,11 @@ struct rt2x00_dev { |
||
117 | const struct firmware *fw; |
||
118 | |||
119 | /* |
||
120 | + * EEPROM image. |
||
121 | + */ |
||
122 | + const struct firmware *eeprom_file; |
||
123 | + |
||
124 | + /* |
||
125 | * FIFO for storing tx status reports between isr and tasklet. |
||
126 | */ |
||
127 | DECLARE_KFIFO_PTR(txstatus_fifo, u32); |
||
128 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c |
||
129 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c |
||
130 | @@ -1423,6 +1423,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de |
||
131 | INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); |
||
132 | INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); |
||
133 | |||
134 | + retval = rt2x00lib_load_eeprom_file(rt2x00dev); |
||
135 | + if (retval) |
||
136 | + goto exit; |
||
137 | + |
||
138 | /* |
||
139 | * Let the driver probe the device to detect the capabilities. |
||
140 | */ |
||
141 | @@ -1566,6 +1570,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ |
||
142 | * Free the driver data. |
||
143 | */ |
||
144 | kfree(rt2x00dev->drv_data); |
||
145 | + |
||
146 | + /* |
||
147 | + * Free EEPROM image. |
||
148 | + */ |
||
149 | + rt2x00lib_free_eeprom_file(rt2x00dev); |
||
150 | } |
||
151 | EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev); |
||
152 | |||
153 | --- /dev/null |
||
154 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c |
||
155 | @@ -0,0 +1,106 @@ |
||
156 | +/* |
||
157 | + Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> |
||
158 | + Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com> |
||
159 | + <http://rt2x00.serialmonkey.com> |
||
160 | + |
||
161 | + This program is free software; you can redistribute it and/or modify |
||
162 | + it under the terms of the GNU General Public License as published by |
||
163 | + the Free Software Foundation; either version 2 of the License, or |
||
164 | + (at your option) any later version. |
||
165 | + |
||
166 | + This program is distributed in the hope that it will be useful, |
||
167 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
168 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
169 | + GNU General Public License for more details. |
||
170 | + |
||
171 | + You should have received a copy of the GNU General Public License |
||
172 | + along with this program; if not, write to the |
||
173 | + Free Software Foundation, Inc., |
||
174 | + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
175 | + */ |
||
176 | + |
||
177 | +/* |
||
178 | + Module: rt2x00lib |
||
179 | + Abstract: rt2x00 eeprom file loading routines. |
||
180 | + */ |
||
181 | + |
||
182 | +#include <linux/kernel.h> |
||
183 | +#include <linux/module.h> |
||
184 | + |
||
185 | +#include "rt2x00.h" |
||
186 | +#include "rt2x00lib.h" |
||
187 | + |
||
188 | +static const char * |
||
189 | +rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) |
||
190 | +{ |
||
191 | + struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data; |
||
192 | + |
||
193 | + if (pdata && pdata->eeprom_file_name) |
||
194 | + return pdata->eeprom_file_name; |
||
195 | + |
||
196 | + return NULL |
||
197 | +} |
||
198 | + |
||
199 | +static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev) |
||
200 | +{ |
||
201 | + const struct firmware *ee; |
||
202 | + const char *ee_name; |
||
203 | + int retval; |
||
204 | + |
||
205 | + ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev); |
||
206 | + if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) { |
||
207 | + rt2x00_err(rt2x00dev, "Required EEPROM name is missing."); |
||
208 | + return -EINVAL; |
||
209 | + } |
||
210 | + |
||
211 | + if (!ee_name) |
||
212 | + return 0; |
||
213 | + |
||
214 | + rt2x00_info(rt2x00dev, "Loading EEPROM data from '%s'.\n", ee_name); |
||
215 | + |
||
216 | + retval = request_firmware(&ee, ee_name, rt2x00dev->dev); |
||
217 | + if (retval) { |
||
218 | + rt2x00_err(rt2x00dev, "Failed to request EEPROM.\n"); |
||
219 | + return retval; |
||
220 | + } |
||
221 | + |
||
222 | + if (!ee || !ee->size || !ee->data) { |
||
223 | + rt2x00_err(rt2x00dev, "Failed to read EEPROM file.\n"); |
||
224 | + retval = -ENOENT; |
||
225 | + goto err_exit; |
||
226 | + } |
||
227 | + |
||
228 | + if (ee->size != rt2x00dev->ops->eeprom_size) { |
||
229 | + rt2x00_err(rt2x00dev, |
||
230 | + "EEPROM file size is invalid, it should be %d bytes\n", |
||
231 | + rt2x00dev->ops->eeprom_size); |
||
232 | + retval = -EINVAL; |
||
233 | + goto err_release_ee; |
||
234 | + } |
||
235 | + |
||
236 | + rt2x00dev->eeprom_file = ee; |
||
237 | + return 0; |
||
238 | + |
||
239 | +err_release_ee: |
||
240 | + release_firmware(ee); |
||
241 | +err_exit: |
||
242 | + return retval; |
||
243 | +} |
||
244 | + |
||
245 | +int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev) |
||
246 | +{ |
||
247 | + int retval; |
||
248 | + |
||
249 | + retval = rt2x00lib_request_eeprom_file(rt2x00dev); |
||
250 | + if (retval) |
||
251 | + return retval; |
||
252 | + |
||
253 | + return 0; |
||
254 | +} |
||
255 | + |
||
256 | +void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev) |
||
257 | +{ |
||
258 | + if (rt2x00dev->eeprom_file && rt2x00dev->eeprom_file->size) |
||
259 | + release_firmware(rt2x00dev->eeprom_file); |
||
260 | + rt2x00dev->eeprom_file = NULL; |
||
261 | +} |
||
262 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h |
||
263 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h |
||
264 | @@ -297,6 +297,22 @@ static inline void rt2x00lib_free_firmwa |
||
265 | #endif /* CPTCFG_RT2X00_LIB_FIRMWARE */ |
||
266 | |||
267 | /* |
||
268 | + * EEPROM file handlers. |
||
269 | + */ |
||
270 | +#ifdef CPTCFG_RT2X00_LIB_EEPROM |
||
271 | +int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev); |
||
272 | +void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev); |
||
273 | +#else |
||
274 | +static inline int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev) |
||
275 | +{ |
||
276 | + return 0; |
||
277 | +} |
||
278 | +static inline void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev) |
||
279 | +{ |
||
280 | +} |
||
281 | +#endif /* CPTCFG_RT2X00_LIB_EEPROM */ |
||
282 | + |
||
283 | +/* |
||
284 | * Debugfs handlers. |
||
285 | */ |
||
286 | #ifdef CPTCFG_RT2X00_LIB_DEBUGFS |
||
287 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c |
||
288 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c |
||
289 | @@ -97,6 +97,7 @@ int rt2x00soc_probe(struct platform_devi |
||
290 | if (IS_ERR(rt2x00dev->clk)) |
||
291 | rt2x00dev->clk = NULL; |
||
292 | |||
293 | + set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags); |
||
294 | rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); |
||
295 | |||
296 | retval = rt2x00soc_alloc_reg(rt2x00dev); |