diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index 11e55180cbaf..aad794adf52c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -26,6 +26,12 @@ | |||
26 | #ifndef RT2X00USB_H | 26 | #ifndef RT2X00USB_H |
27 | #define RT2X00USB_H | 27 | #define RT2X00USB_H |
28 | 28 | ||
29 | #define to_usb_device_intf(d) \ | ||
30 | ({ \ | ||
31 | struct usb_interface *intf = to_usb_interface(d); \ | ||
32 | interface_to_usbdev(intf); \ | ||
33 | }) | ||
34 | |||
29 | /* | 35 | /* |
30 | * This variable should be used with the | 36 | * This variable should be used with the |
31 | * usb_driver structure initialization. | 37 | * usb_driver structure initialization. |
@@ -47,6 +53,20 @@ | |||
47 | #define REGISTER_TIMEOUT 500 | 53 | #define REGISTER_TIMEOUT 500 |
48 | #define REGISTER_TIMEOUT_FIRMWARE 1000 | 54 | #define REGISTER_TIMEOUT_FIRMWARE 1000 |
49 | 55 | ||
56 | /** | ||
57 | * REGISTER_TIMEOUT16 - Determine the timeout for 16bit register access | ||
58 | * @__datalen: Data length | ||
59 | */ | ||
60 | #define REGISTER_TIMEOUT16(__datalen) \ | ||
61 | ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) ) | ||
62 | |||
63 | /** | ||
64 | * REGISTER_TIMEOUT32 - Determine the timeout for 32bit register access | ||
65 | * @__datalen: Data length | ||
66 | */ | ||
67 | #define REGISTER_TIMEOUT32(__datalen) \ | ||
68 | ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) ) | ||
69 | |||
50 | /* | 70 | /* |
51 | * Cache size | 71 | * Cache size |
52 | */ | 72 | */ |
@@ -185,13 +205,12 @@ static inline int rt2x00usb_vendor_request_sw(struct rt2x00_dev *rt2x00dev, | |||
185 | * kmalloc for correct handling inside the kernel USB layer. | 205 | * kmalloc for correct handling inside the kernel USB layer. |
186 | */ | 206 | */ |
187 | static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, | 207 | static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, |
188 | __le16 *eeprom, const u16 lenght) | 208 | __le16 *eeprom, const u16 length) |
189 | { | 209 | { |
190 | int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16)); | ||
191 | |||
192 | return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, | 210 | return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, |
193 | USB_VENDOR_REQUEST_IN, 0, 0, | 211 | USB_VENDOR_REQUEST_IN, 0, 0, |
194 | eeprom, lenght, timeout); | 212 | eeprom, length, |
213 | REGISTER_TIMEOUT16(length)); | ||
195 | } | 214 | } |
196 | 215 | ||
197 | /* | 216 | /* |
@@ -199,55 +218,53 @@ static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, | |||
199 | */ | 218 | */ |
200 | void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev); | 219 | void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev); |
201 | 220 | ||
202 | /* | ||
203 | * TX data handlers. | ||
204 | */ | ||
205 | int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | ||
206 | struct data_queue *queue, struct sk_buff *skb, | ||
207 | struct ieee80211_tx_control *control); | ||
208 | |||
209 | /** | 221 | /** |
210 | * struct queue_entry_priv_usb_rx: Per RX entry USB specific information | 222 | * rt2x00usb_write_tx_data - Initialize URB for TX operation |
223 | * @entry: The entry where the frame is located | ||
211 | * | 224 | * |
212 | * @urb: Urb structure used for device communication. | 225 | * This function will initialize the URB and skb descriptor |
226 | * to prepare the entry for the actual TX operation. | ||
213 | */ | 227 | */ |
214 | struct queue_entry_priv_usb_rx { | 228 | int rt2x00usb_write_tx_data(struct queue_entry *entry); |
215 | struct urb *urb; | ||
216 | }; | ||
217 | 229 | ||
218 | /** | 230 | /** |
219 | * struct queue_entry_priv_usb_tx: Per TX entry USB specific information | 231 | * struct queue_entry_priv_usb: Per entry USB specific information |
220 | * | 232 | * |
221 | * @urb: Urb structure used for device communication. | 233 | * @urb: Urb structure used for device communication. |
222 | * @control: mac80211 control structure used to transmit data. | ||
223 | */ | 234 | */ |
224 | struct queue_entry_priv_usb_tx { | 235 | struct queue_entry_priv_usb { |
225 | struct urb *urb; | 236 | struct urb *urb; |
226 | |||
227 | struct ieee80211_tx_control control; | ||
228 | }; | 237 | }; |
229 | 238 | ||
230 | /** | 239 | /** |
231 | * struct queue_entry_priv_usb_tx: Per TX entry USB specific information | 240 | * struct queue_entry_priv_usb_bcn: Per TX entry USB specific information |
232 | * | 241 | * |
233 | * The first section should match &struct queue_entry_priv_usb_tx exactly. | 242 | * The first section should match &struct queue_entry_priv_usb exactly. |
234 | * rt2500usb can use this structure to send a guardian byte when working | 243 | * rt2500usb can use this structure to send a guardian byte when working |
235 | * with beacons. | 244 | * with beacons. |
236 | * | 245 | * |
237 | * @urb: Urb structure used for device communication. | 246 | * @urb: Urb structure used for device communication. |
238 | * @control: mac80211 control structure used to transmit data. | ||
239 | * @guardian_data: Set to 0, used for sending the guardian data. | 247 | * @guardian_data: Set to 0, used for sending the guardian data. |
240 | * @guardian_urb: Urb structure used to send the guardian data. | 248 | * @guardian_urb: Urb structure used to send the guardian data. |
241 | */ | 249 | */ |
242 | struct queue_entry_priv_usb_bcn { | 250 | struct queue_entry_priv_usb_bcn { |
243 | struct urb *urb; | 251 | struct urb *urb; |
244 | 252 | ||
245 | struct ieee80211_tx_control control; | ||
246 | |||
247 | unsigned int guardian_data; | 253 | unsigned int guardian_data; |
248 | struct urb *guardian_urb; | 254 | struct urb *guardian_urb; |
249 | }; | 255 | }; |
250 | 256 | ||
257 | /** | ||
258 | * rt2x00usb_kick_tx_queue - Kick data queue | ||
259 | * @rt2x00dev: Pointer to &struct rt2x00_dev | ||
260 | * @qid: Data queue to kick | ||
261 | * | ||
262 | * This will walk through all entries of the queue and push all pending | ||
263 | * frames to the hardware as a single burst. | ||
264 | */ | ||
265 | void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
266 | const enum data_queue_qid qid); | ||
267 | |||
251 | /* | 268 | /* |
252 | * Device initialization handlers. | 269 | * Device initialization handlers. |
253 | */ | 270 | */ |