diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index 4104f0e8fa48..2bd4ac855f52 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -231,6 +231,142 @@ static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, | |||
231 | REGISTER_TIMEOUT16(length)); | 231 | REGISTER_TIMEOUT16(length)); |
232 | } | 232 | } |
233 | 233 | ||
234 | /** | ||
235 | * rt2x00usb_regbusy_read - Read 32bit register word | ||
236 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
237 | * @offset: Register offset | ||
238 | * @value: Pointer to where register contents should be stored | ||
239 | * | ||
240 | * This function is a simple wrapper for 32bit register access | ||
241 | * through rt2x00usb_vendor_request_buff(). | ||
242 | */ | ||
243 | static inline void rt2x00usb_register_read(struct rt2x00_dev *rt2x00dev, | ||
244 | const unsigned int offset, | ||
245 | u32 *value) | ||
246 | { | ||
247 | __le32 reg; | ||
248 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, | ||
249 | USB_VENDOR_REQUEST_IN, offset, | ||
250 | ®, sizeof(reg), REGISTER_TIMEOUT); | ||
251 | *value = le32_to_cpu(reg); | ||
252 | } | ||
253 | |||
254 | /** | ||
255 | * rt2x00usb_register_read_lock - Read 32bit register word | ||
256 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
257 | * @offset: Register offset | ||
258 | * @value: Pointer to where register contents should be stored | ||
259 | * | ||
260 | * This function is a simple wrapper for 32bit register access | ||
261 | * through rt2x00usb_vendor_req_buff_lock(). | ||
262 | */ | ||
263 | static inline void rt2x00usb_register_read_lock(struct rt2x00_dev *rt2x00dev, | ||
264 | const unsigned int offset, | ||
265 | u32 *value) | ||
266 | { | ||
267 | __le32 reg; | ||
268 | rt2x00usb_vendor_req_buff_lock(rt2x00dev, USB_MULTI_READ, | ||
269 | USB_VENDOR_REQUEST_IN, offset, | ||
270 | ®, sizeof(reg), REGISTER_TIMEOUT); | ||
271 | *value = le32_to_cpu(reg); | ||
272 | } | ||
273 | |||
274 | /** | ||
275 | * rt2x00usb_register_multiread - Read 32bit register words | ||
276 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
277 | * @offset: Register offset | ||
278 | * @value: Pointer to where register contents should be stored | ||
279 | * @length: Length of the data | ||
280 | * | ||
281 | * This function is a simple wrapper for 32bit register access | ||
282 | * through rt2x00usb_vendor_request_buff(). | ||
283 | */ | ||
284 | static inline void rt2x00usb_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
285 | const unsigned int offset, | ||
286 | void *value, const u32 length) | ||
287 | { | ||
288 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, | ||
289 | USB_VENDOR_REQUEST_IN, offset, | ||
290 | value, length, | ||
291 | REGISTER_TIMEOUT32(length)); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * rt2x00usb_register_write - Write 32bit register word | ||
296 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
297 | * @offset: Register offset | ||
298 | * @value: Data which should be written | ||
299 | * | ||
300 | * This function is a simple wrapper for 32bit register access | ||
301 | * through rt2x00usb_vendor_request_buff(). | ||
302 | */ | ||
303 | static inline void rt2x00usb_register_write(struct rt2x00_dev *rt2x00dev, | ||
304 | const unsigned int offset, | ||
305 | u32 value) | ||
306 | { | ||
307 | __le32 reg = cpu_to_le32(value); | ||
308 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, | ||
309 | USB_VENDOR_REQUEST_OUT, offset, | ||
310 | ®, sizeof(reg), REGISTER_TIMEOUT); | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * rt2x00usb_register_write_lock - Write 32bit register word | ||
315 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
316 | * @offset: Register offset | ||
317 | * @value: Data which should be written | ||
318 | * | ||
319 | * This function is a simple wrapper for 32bit register access | ||
320 | * through rt2x00usb_vendor_req_buff_lock(). | ||
321 | */ | ||
322 | static inline void rt2x00usb_register_write_lock(struct rt2x00_dev *rt2x00dev, | ||
323 | const unsigned int offset, | ||
324 | u32 value) | ||
325 | { | ||
326 | __le32 reg = cpu_to_le32(value); | ||
327 | rt2x00usb_vendor_req_buff_lock(rt2x00dev, USB_MULTI_WRITE, | ||
328 | USB_VENDOR_REQUEST_OUT, offset, | ||
329 | ®, sizeof(reg), REGISTER_TIMEOUT); | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * rt2x00usb_register_multiwrite - Write 32bit register words | ||
334 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
335 | * @offset: Register offset | ||
336 | * @value: Data which should be written | ||
337 | * @length: Length of the data | ||
338 | * | ||
339 | * This function is a simple wrapper for 32bit register access | ||
340 | * through rt2x00usb_vendor_request_buff(). | ||
341 | */ | ||
342 | static inline void rt2x00usb_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
343 | const unsigned int offset, | ||
344 | void *value, const u32 length) | ||
345 | { | ||
346 | rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, | ||
347 | USB_VENDOR_REQUEST_OUT, offset, | ||
348 | value, length, | ||
349 | REGISTER_TIMEOUT32(length)); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * rt2x00usb_regbusy_read - Read from register with busy check | ||
354 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
355 | * @offset: Register offset | ||
356 | * @field: Field to check if register is busy | ||
357 | * @reg: Pointer to where register contents should be stored | ||
358 | * | ||
359 | * This function will read the given register, and checks if the | ||
360 | * register is busy. If it is, it will sleep for a couple of | ||
361 | * microseconds before reading the register again. If the register | ||
362 | * is not read after a certain timeout, this function will return | ||
363 | * FALSE. | ||
364 | */ | ||
365 | int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
366 | const unsigned int offset, | ||
367 | struct rt2x00_field32 field, | ||
368 | u32 *reg); | ||
369 | |||
234 | /* | 370 | /* |
235 | * Radio handlers | 371 | * Radio handlers |
236 | */ | 372 | */ |