blob: b81d5098816a05540580fea5101d394c3a92b850 [file] [log] [blame]
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001/*
Ivo van Doorn96481b22010-08-06 20:47:57 +02002 Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
3 Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
Gertjan van Wingerde9c9a0d12009-11-08 16:39:55 +01004 Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
5 Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
6 Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
7 Copyright (C) 2009 Axel Kollhofer <rain_maker@root-forum.org>
Ivo van Doornd53d9e62009-04-26 15:47:48 +02008 <http://rt2x00.serialmonkey.com>
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the
22 Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25
26/*
27 Module: rt2800usb
28 Abstract: rt2800usb device specific routines.
29 Supported chipsets: RT2800U.
30 */
31
Ivo van Doornd53d9e62009-04-26 15:47:48 +020032#include <linux/delay.h>
33#include <linux/etherdevice.h>
34#include <linux/init.h>
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/usb.h>
38
39#include "rt2x00.h"
40#include "rt2x00usb.h"
Bartlomiej Zolnierkiewicz7ef5cc92009-11-04 18:35:32 +010041#include "rt2800lib.h"
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010042#include "rt2800.h"
Ivo van Doornd53d9e62009-04-26 15:47:48 +020043#include "rt2800usb.h"
44
45/*
46 * Allow hardware encryption to be disabled.
47 */
Rusty Russelleb939922011-12-19 14:08:01 +000048static bool modparam_nohwcrypt;
Ivo van Doornd53d9e62009-04-26 15:47:48 +020049module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
50MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
51
Gertjan van Wingerdead417a52012-09-03 03:25:51 +020052static bool rt2800usb_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
53{
54 return modparam_nohwcrypt;
55}
56
Ivo van Doornd53d9e62009-04-26 15:47:48 +020057/*
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010058 * Queue handlers.
59 */
60static void rt2800usb_start_queue(struct data_queue *queue)
61{
62 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
63 u32 reg;
64
65 switch (queue->qid) {
66 case QID_RX:
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020067 rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010068 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 1);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020069 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010070 break;
71 case QID_BEACON:
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020072 rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010073 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
74 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
75 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020076 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010077 break;
78 default:
79 break;
80 }
81}
82
83static void rt2800usb_stop_queue(struct data_queue *queue)
84{
85 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
86 u32 reg;
87
88 switch (queue->qid) {
89 case QID_RX:
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020090 rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010091 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020092 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010093 break;
94 case QID_BEACON:
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020095 rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +010096 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
97 rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
98 rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +020099 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
Ivo van Doorn5450b7e2010-12-13 12:34:22 +0100100 break;
101 default:
102 break;
103 }
Ivo van Doorn5450b7e2010-12-13 12:34:22 +0100104}
105
Johannes Stezenbachf0187a12011-04-18 15:30:36 +0200106/*
107 * test if there is an entry in any TX queue for which DMA is done
108 * but the TX status has not been returned yet
109 */
110static bool rt2800usb_txstatus_pending(struct rt2x00_dev *rt2x00dev)
111{
112 struct data_queue *queue;
113
114 tx_queue_for_each(rt2x00dev, queue) {
115 if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) !=
116 rt2x00queue_get_entry(queue, Q_INDEX_DONE))
117 return true;
118 }
119 return false;
120}
121
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100122static inline bool rt2800usb_entry_txstatus_timeout(struct queue_entry *entry)
123{
124 bool tout;
125
126 if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
127 return false;
128
129 tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(100));
130 if (unlikely(tout))
Joe Perchesec9c4982013-04-19 08:33:40 -0700131 rt2x00_warn(entry->queue->rt2x00dev,
132 "TX status timeout for entry %d in queue %d\n",
133 entry->entry_idx, entry->queue->qid);
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100134 return tout;
135
136}
137
138static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
139{
140 struct data_queue *queue;
141 struct queue_entry *entry;
142
143 tx_queue_for_each(rt2x00dev, queue) {
144 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
145 if (rt2800usb_entry_txstatus_timeout(entry))
146 return true;
147 }
148 return false;
149}
150
Ivo van Doorna073fde2011-04-30 17:14:23 +0200151static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
Johannes Stezenbach0e0d39e2011-04-18 15:29:12 +0200152 int urb_status, u32 tx_status)
153{
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100154 bool valid;
155
Johannes Stezenbach0e0d39e2011-04-18 15:29:12 +0200156 if (urb_status) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700157 rt2x00_warn(rt2x00dev, "TX status read failed %d\n",
158 urb_status);
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100159
160 goto stop_reading;
161 }
162
163 valid = rt2x00_get_field32(tx_status, TX_STA_FIFO_VALID);
164 if (valid) {
165 if (!kfifo_put(&rt2x00dev->txstatus_fifo, &tx_status))
Joe Perchesec9c4982013-04-19 08:33:40 -0700166 rt2x00_warn(rt2x00dev, "TX status FIFO overrun\n");
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100167
168 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
169
170 /* Reschedule urb to read TX status again instantly */
171 return true;
Stanislaw Gruszkab9fc1062012-03-19 09:39:45 +0100172 }
173
174 /* Check if there is any entry that timedout waiting on TX status */
175 if (rt2800usb_txstatus_timeout(rt2x00dev))
176 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
177
178 if (rt2800usb_txstatus_pending(rt2x00dev)) {
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100179 /* Read register after 250 us */
180 hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
181 HRTIMER_MODE_REL);
Ivo van Doorna073fde2011-04-30 17:14:23 +0200182 return false;
Johannes Stezenbach0e0d39e2011-04-18 15:29:12 +0200183 }
184
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100185stop_reading:
186 clear_bit(TX_STATUS_READING, &rt2x00dev->flags);
187 /*
188 * There is small race window above, between txstatus pending check and
189 * clear_bit someone could do rt2x00usb_interrupt_txdone, so recheck
190 * here again if status reading is needed.
191 */
192 if (rt2800usb_txstatus_pending(rt2x00dev) &&
Stanislaw Gruszka4e808a32012-03-19 15:59:41 +0100193 !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100194 return true;
195 else
196 return false;
197}
Ivo van Doorna073fde2011-04-30 17:14:23 +0200198
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100199static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
200{
201
202 if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
203 return;
204
205 /* Read TX_STA_FIFO register after 500 us */
206 hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),
207 HRTIMER_MODE_REL);
Johannes Stezenbach0e0d39e2011-04-18 15:29:12 +0200208}
209
210static void rt2800usb_tx_dma_done(struct queue_entry *entry)
211{
212 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
213
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100214 rt2800usb_async_read_tx_status(rt2x00dev);
Johannes Stezenbach0e0d39e2011-04-18 15:29:12 +0200215}
216
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100217static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer)
Johannes Stezenbachf0187a12011-04-18 15:30:36 +0200218{
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100219 struct rt2x00_dev *rt2x00dev =
220 container_of(timer, struct rt2x00_dev, txstatus_timer);
Johannes Stezenbachf0187a12011-04-18 15:30:36 +0200221
222 rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO,
223 rt2800usb_tx_sta_fifo_read_completed);
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100224
225 return HRTIMER_NORESTART;
Johannes Stezenbachf0187a12011-04-18 15:30:36 +0200226}
227
Ivo van Doorn5450b7e2010-12-13 12:34:22 +0100228/*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200229 * Firmware functions
230 */
231static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
232{
233 return FIRMWARE_RT2870;
234}
235
Ivo van Doornf31c9a82010-07-11 12:30:37 +0200236static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200237 const u8 *data, const size_t len)
238{
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200239 int status;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200240 u32 offset;
241 u32 length;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200242
243 /*
244 * Check which section of the firmware we need.
245 */
Gertjan van Wingerde49e721e2010-02-13 20:55:49 +0100246 if (rt2x00_rt(rt2x00dev, RT2860) ||
247 rt2x00_rt(rt2x00dev, RT2872) ||
248 rt2x00_rt(rt2x00dev, RT3070)) {
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200249 offset = 0;
250 length = 4096;
251 } else {
252 offset = 4096;
253 length = 4096;
254 }
255
256 /*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200257 * Write firmware to device.
258 */
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200259 rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
260 data + offset, length);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200261
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200262 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
263 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200264
265 /*
266 * Send firmware request to device to load firmware,
267 * we need to specify a long timeout time.
268 */
269 status = rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE,
270 0, USB_MODE_FIRMWARE,
271 REGISTER_TIMEOUT_FIRMWARE);
272 if (status < 0) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700273 rt2x00_err(rt2x00dev, "Failed to write Firmware to device\n");
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200274 return status;
275 }
276
Ivo van Doorn15e46922009-04-28 20:14:58 +0200277 msleep(10);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200278 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
Ivo van Doorn15e46922009-04-28 20:14:58 +0200279
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200280 return 0;
281}
282
283/*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200284 * Device state switch handlers.
285 */
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200286static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
287{
288 u32 reg;
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200289
290 /*
291 * Wait until BBP and RF are ready.
292 */
Ivo van Doorn5ffddc42010-08-30 21:13:08 +0200293 if (rt2800_wait_csr_ready(rt2x00dev))
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200294 return -EBUSY;
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200295
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200296 rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
297 rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200298
Stanislaw Gruszka2a48e8a2012-01-24 14:09:08 +0100299 reg = 0;
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200300 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
301 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200302 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200303
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200304 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200305
306 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
307 USB_MODE_RESET, REGISTER_TIMEOUT);
308
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200309 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
Gertjan van Wingerdee3a896b2010-06-03 10:52:04 +0200310
311 return 0;
312}
313
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200314static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
315{
316 u32 reg;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200317
Ivo van Doornb9a07ae2010-08-23 19:55:22 +0200318 if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev)))
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200319 return -EIO;
320
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200321 rt2x00usb_register_read(rt2x00dev, USB_DMA_CFG, &reg);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200322 rt2x00_set_field32(&reg, USB_DMA_CFG_PHY_CLEAR, 0);
Benoit PAPILLAULT9c8427d2009-12-04 23:47:05 +0100323 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_EN, 0);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200324 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128);
Ivo van Doorn15e46922009-04-28 20:14:58 +0200325 /*
326 * Total room for RX frames in kilobytes, PBF might still exceed
327 * this limit so reduce the number to prevent errors.
328 */
329 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_LIMIT,
Gabor Juhos3a28c8a2013-05-01 17:17:32 +0200330 ((rt2x00dev->rx->limit * DATA_FRAME_SIZE)
Helmut Schaaefd2f272010-11-04 20:37:22 +0100331 / 1024) - 3);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200332 rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_EN, 1);
333 rt2x00_set_field32(&reg, USB_DMA_CFG_TX_BULK_EN, 1);
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200334 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200335
Ivo van Doornb9a07ae2010-08-23 19:55:22 +0200336 return rt2800_enable_radio(rt2x00dev);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200337}
338
339static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev)
340{
Ivo van Doornb9a07ae2010-08-23 19:55:22 +0200341 rt2800_disable_radio(rt2x00dev);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200342 rt2x00usb_disable_radio(rt2x00dev);
343}
344
345static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev,
346 enum dev_state state)
347{
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200348 if (state == STATE_AWAKE)
Ivo van Doorn303c7d62010-11-04 20:40:46 +0100349 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 2);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200350 else
Ivo van Doorn303c7d62010-11-04 20:40:46 +0100351 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0xff, 2);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200352
353 return 0;
354}
355
356static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
357 enum dev_state state)
358{
359 int retval = 0;
360
361 switch (state) {
362 case STATE_RADIO_ON:
363 /*
364 * Before the radio can be enabled, the device first has
365 * to be woken up. After that it needs a bit of time
Luis Correia49513482009-07-17 21:39:19 +0200366 * to be fully awake and then the radio can be enabled.
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200367 */
368 rt2800usb_set_state(rt2x00dev, STATE_AWAKE);
369 msleep(1);
370 retval = rt2800usb_enable_radio(rt2x00dev);
371 break;
372 case STATE_RADIO_OFF:
373 /*
Luis Correia49513482009-07-17 21:39:19 +0200374 * After the radio has been disabled, the device should
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200375 * be put to sleep for powersaving.
376 */
377 rt2800usb_disable_radio(rt2x00dev);
378 rt2800usb_set_state(rt2x00dev, STATE_SLEEP);
379 break;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200380 case STATE_RADIO_IRQ_ON:
381 case STATE_RADIO_IRQ_OFF:
382 /* No support, but no error either */
383 break;
384 case STATE_DEEP_SLEEP:
385 case STATE_SLEEP:
386 case STATE_STANDBY:
387 case STATE_AWAKE:
388 retval = rt2800usb_set_state(rt2x00dev, state);
389 break;
390 default:
391 retval = -ENOTSUPP;
392 break;
393 }
394
395 if (unlikely(retval))
Joe Perchesec9c4982013-04-19 08:33:40 -0700396 rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n",
397 state, retval);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200398
399 return retval;
400}
401
402/*
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100403 * Watchdog handlers
404 */
405static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
406{
407 unsigned int i;
408 u32 reg;
409
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200410 rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100411 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700412 rt2x00_warn(rt2x00dev, "TX HW queue 0 timed out, invoke forced kick\n");
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100413
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200414 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40012);
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100415
416 for (i = 0; i < 10; i++) {
417 udelay(10);
418 if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q))
419 break;
420 }
421
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200422 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100423 }
424
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200425 rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100426 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700427 rt2x00_warn(rt2x00dev, "TX HW queue 1 timed out, invoke forced kick\n");
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100428
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200429 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf4000a);
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100430
431 for (i = 0; i < 10; i++) {
432 udelay(10);
433 if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q))
434 break;
435 }
436
Ivo van Doorn8d0a2dc2011-04-18 15:34:22 +0200437 rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100438 }
439
440 rt2x00usb_watchdog(rt2x00dev);
441}
442
443/*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200444 * TX descriptor initialization
445 */
Ivo van Doorn0c5879b2010-08-06 20:47:20 +0200446static __le32 *rt2800usb_get_txwi(struct queue_entry *entry)
Gertjan van Wingerde9cf4cb02010-06-29 21:43:03 +0200447{
Ivo van Doorn0c5879b2010-08-06 20:47:20 +0200448 if (entry->queue->qid == QID_BEACON)
449 return (__le32 *) (entry->skb->data);
450 else
451 return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE);
Gertjan van Wingerde9cf4cb02010-06-29 21:43:03 +0200452}
453
Ivo van Doorn93331452010-08-23 19:53:39 +0200454static void rt2800usb_write_tx_desc(struct queue_entry *entry,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200455 struct txentry_desc *txdesc)
456{
Ivo van Doorn93331452010-08-23 19:53:39 +0200457 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
458 __le32 *txi = (__le32 *) entry->skb->data;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200459 u32 word;
460
461 /*
Gertjan van Wingerde59679b92010-05-08 23:40:21 +0200462 * Initialize TXINFO descriptor
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200463 */
464 rt2x00_desc_read(txi, 0, &word);
RA-Jay Hungb43d63b2010-11-13 19:11:46 +0100465
466 /*
467 * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is
468 * TXWI + 802.11 header + L2 pad + payload + pad,
Jakub Kiciński4bcafac2011-12-28 01:53:21 +0100469 * so need to decrease size of TXINFO.
RA-Jay Hungb43d63b2010-11-13 19:11:46 +0100470 */
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200471 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
Jakub Kiciński4bcafac2011-12-28 01:53:21 +0100472 roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200473 rt2x00_set_field32(&word, TXINFO_W0_WIV,
474 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
475 rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
476 rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
477 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);
478 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST,
479 test_bit(ENTRY_TXD_BURST, &txdesc->flags));
480 rt2x00_desc_write(txi, 0, word);
Gertjan van Wingerde85b7a8b2010-05-11 23:51:40 +0200481
482 /*
483 * Register descriptor details in skb frame descriptor.
484 */
Gertjan van Wingerde0b8004a2010-06-03 10:51:45 +0200485 skbdesc->flags |= SKBDESC_DESC_IN_SKB;
Gertjan van Wingerde85b7a8b2010-05-11 23:51:40 +0200486 skbdesc->desc = txi;
Stanislaw Gruszkaf0bda572013-04-17 14:30:47 +0200487 skbdesc->desc_len = TXINFO_DESC_SIZE + entry->queue->winfo_size;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200488}
489
490/*
491 * TX data initialization
492 */
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200493static int rt2800usb_get_tx_data_len(struct queue_entry *entry)
494{
Jakub Kiciński4bcafac2011-12-28 01:53:21 +0100495 /*
496 * pad(1~3 bytes) is needed after each 802.11 payload.
497 * USB end pad(4 bytes) is needed at each USB bulk out packet end.
498 * TX frame format is :
499 * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad |
500 * |<------------- tx_pkt_len ------------->|
501 */
502
503 return roundup(entry->skb->len, 4) + 4;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200504}
505
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200506/*
Ivo van Doorn96481b22010-08-06 20:47:57 +0200507 * TX control handlers
508 */
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100509static enum txdone_entry_desc_flags
510rt2800usb_txdone_entry_check(struct queue_entry *entry, u32 reg)
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200511{
512 __le32 *txwi;
513 u32 word;
514 int wcid, ack, pid;
Stanislaw Gruszka5f8f7182012-03-14 11:16:20 +0100515 int tx_wcid, tx_ack, tx_pid, is_agg;
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200516
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200517 /*
518 * This frames has returned with an IO error,
519 * so the status report is not intended for this
520 * frame.
521 */
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100522 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
523 return TXDONE_FAILURE;
524
525 wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID);
526 ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED);
527 pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE);
Stanislaw Gruszka5f8f7182012-03-14 11:16:20 +0100528 is_agg = rt2x00_get_field32(reg, TX_STA_FIFO_TX_AGGRE);
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200529
530 /*
531 * Validate if this TX status report is intended for
532 * this entry by comparing the WCID/ACK/PID fields.
533 */
534 txwi = rt2800usb_get_txwi(entry);
535
536 rt2x00_desc_read(txwi, 1, &word);
537 tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID);
538 tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK);
539 tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID);
540
Stanislaw Gruszka5f8f7182012-03-14 11:16:20 +0100541 if (wcid != tx_wcid || ack != tx_ack || (!is_agg && pid != tx_pid)) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700542 rt2x00_dbg(entry->queue->rt2x00dev,
543 "TX status report missed for queue %d entry %d\n",
544 entry->queue->qid, entry->entry_idx);
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100545 return TXDONE_UNKNOWN;
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200546 }
547
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100548 return TXDONE_SUCCESS;
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200549}
550
551static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)
552{
553 struct data_queue *queue;
554 struct queue_entry *entry;
555 u32 reg;
556 u8 qid;
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100557 enum txdone_entry_desc_flags done_status;
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200558
559 while (kfifo_get(&rt2x00dev->txstatus_fifo, &reg)) {
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100560 /*
561 * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is
562 * guaranteed to be one of the TX QIDs .
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200563 */
564 qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE);
565 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100566
567 if (unlikely(rt2x00queue_empty(queue))) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700568 rt2x00_warn(rt2x00dev, "Got TX status for an empty queue %u, dropping\n",
569 qid);
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100570 break;
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200571 }
572
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100573 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
574
575 if (unlikely(test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
576 !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700577 rt2x00_warn(rt2x00dev, "Data pending for entry %u in queue %u\n",
578 entry->entry_idx, qid);
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100579 break;
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200580 }
581
Stanislaw Gruszkaed61e2b2012-03-14 11:16:18 +0100582 done_status = rt2800usb_txdone_entry_check(entry, reg);
583 if (likely(done_status == TXDONE_SUCCESS))
584 rt2800_txdone_entry(entry, reg, rt2800usb_get_txwi(entry));
585 else
586 rt2x00lib_txdone_noinfo(entry, done_status);
Gertjan van Wingerde8f66bbb2011-05-18 20:25:49 +0200587 }
588}
589
Stanislaw Gruszka627fdaf2012-03-14 11:16:17 +0100590static void rt2800usb_txdone_nostatus(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn96481b22010-08-06 20:47:57 +0200591{
Ivo van Doorn96481b22010-08-06 20:47:57 +0200592 struct data_queue *queue;
593 struct queue_entry *entry;
594
Ivo van Doorn96481b22010-08-06 20:47:57 +0200595 /*
596 * Process any trailing TX status reports for IO failures,
597 * we loop until we find the first non-IO error entry. This
598 * can either be a frame which is free, is being uploaded,
599 * or has completed the upload but didn't have an entry
600 * in the TX_STAT_FIFO register yet.
601 */
602 tx_queue_for_each(rt2x00dev, queue) {
603 while (!rt2x00queue_empty(queue)) {
604 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
605
Stanislaw Gruszka4b1bfb72011-08-10 15:32:22 +0200606 if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
607 !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
Ivo van Doorn96481b22010-08-06 20:47:57 +0200608 break;
Stanislaw Gruszka4b1bfb72011-08-10 15:32:22 +0200609
Johannes Stezenbach6e6d6932011-04-18 15:30:01 +0200610 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
611 rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100612 else if (rt2800usb_entry_txstatus_timeout(entry))
Johannes Stezenbach6e6d6932011-04-18 15:30:01 +0200613 rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN);
614 else
615 break;
Ivo van Doorn96481b22010-08-06 20:47:57 +0200616 }
617 }
Stanislaw Gruszka627fdaf2012-03-14 11:16:17 +0100618}
619
620static void rt2800usb_work_txdone(struct work_struct *work)
621{
622 struct rt2x00_dev *rt2x00dev =
623 container_of(work, struct rt2x00_dev, txdone_work);
624
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100625 while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) ||
626 rt2800usb_txstatus_timeout(rt2x00dev)) {
Stanislaw Gruszka627fdaf2012-03-14 11:16:17 +0100627
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100628 rt2800usb_txdone(rt2x00dev);
Johannes Stezenbachf0187a12011-04-18 15:30:36 +0200629
Stanislaw Gruszkaf4211112012-03-14 11:16:19 +0100630 rt2800usb_txdone_nostatus(rt2x00dev);
631
632 /*
633 * The hw may delay sending the packet after DMA complete
634 * if the medium is busy, thus the TX_STA_FIFO entry is
635 * also delayed -> use a timer to retrieve it.
636 */
637 if (rt2800usb_txstatus_pending(rt2x00dev))
638 rt2800usb_async_read_tx_status(rt2x00dev);
639 }
Ivo van Doorn96481b22010-08-06 20:47:57 +0200640}
641
642/*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200643 * RX control handlers
644 */
645static void rt2800usb_fill_rxdone(struct queue_entry *entry,
646 struct rxdone_entry_desc *rxdesc)
647{
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200648 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
Benoit Papillault5de42f92009-12-04 23:47:06 +0100649 __le32 *rxi = (__le32 *)entry->skb->data;
Benoit Papillault5de42f92009-12-04 23:47:06 +0100650 __le32 *rxd;
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200651 u32 word;
Benoit Papillault5de42f92009-12-04 23:47:06 +0100652 int rx_pkt_len;
653
654 /*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200655 * Copy descriptor to the skbdesc->desc buffer, making it safe from
656 * moving of frame data in rt2x00usb.
657 */
Benoit Papillault5de42f92009-12-04 23:47:06 +0100658 memcpy(skbdesc->desc, rxi, skbdesc->desc_len);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200659
660 /*
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200661 * RX frame format is :
662 * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad |
663 * |<------------ rx_pkt_len -------------->|
664 */
665 rt2x00_desc_read(rxi, 0, &word);
666 rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN);
667
668 /*
669 * Remove the RXINFO structure from the sbk.
670 */
671 skb_pull(entry->skb, RXINFO_DESC_SIZE);
672
673 /*
Sergei Poselenovefd5d6b2012-09-02 13:14:32 +0400674 * Check for rx_pkt_len validity. Return if invalid, leaving
675 * rxdesc->size zeroed out by the upper level.
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200676 */
Sergei Poselenovefd5d6b2012-09-02 13:14:32 +0400677 if (unlikely(rx_pkt_len == 0 ||
678 rx_pkt_len > entry->queue->data_size)) {
Joe Perchesec9c4982013-04-19 08:33:40 -0700679 rt2x00_err(entry->queue->rt2x00dev,
680 "Bad frame size %d, forcing to 0\n", rx_pkt_len);
Sergei Poselenovefd5d6b2012-09-02 13:14:32 +0400681 return;
682 }
683
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200684 rxd = (__le32 *)(entry->skb->data + rx_pkt_len);
685
686 /*
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200687 * It is now safe to read the descriptor on all architectures.
688 */
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200689 rt2x00_desc_read(rxd, 0, &word);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200690
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200691 if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR))
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200692 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
693
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200694 rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200695
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200696 if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) {
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200697 /*
698 * Hardware has stripped IV/EIV data from 802.11 frame during
699 * decryption. Unfortunately the descriptor doesn't contain
700 * any fields with the EIV/IV data either, so they can't
701 * be restored by rt2x00lib.
702 */
703 rxdesc->flags |= RX_FLAG_IV_STRIPPED;
704
Gertjan van Wingerdea45f3692011-01-30 13:22:41 +0100705 /*
706 * The hardware has already checked the Michael Mic and has
707 * stripped it from the frame. Signal this to mac80211.
708 */
709 rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
710
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200711 if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
712 rxdesc->flags |= RX_FLAG_DECRYPTED;
713 else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
714 rxdesc->flags |= RX_FLAG_MMIC_ERROR;
715 }
716
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200717 if (rt2x00_get_field32(word, RXD_W0_MY_BSS))
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200718 rxdesc->dev_flags |= RXDONE_MY_BSS;
719
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200720 if (rt2x00_get_field32(word, RXD_W0_L2PAD))
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200721 rxdesc->dev_flags |= RXDONE_L2PAD;
722
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200723 /*
724 * Remove RXD descriptor from end of buffer.
725 */
726 skb_trim(entry->skb, rx_pkt_len);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200727
728 /*
Gertjan van Wingerde2de64dd2010-05-08 23:40:22 +0200729 * Process the RXWI structure.
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200730 */
Ivo van Doorn74861922010-07-11 12:23:50 +0200731 rt2800_process_rxwi(entry, rxdesc);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200732}
733
734/*
735 * Device probe functions.
736 */
Gabor Juhosa02308e2012-12-29 14:51:51 +0100737static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
Bartlomiej Zolnierkiewicz7ab71322009-11-08 14:38:54 +0100738{
Gabor Juhosa02308e2012-12-29 14:51:51 +0100739 int retval;
740
Bartlomiej Zolnierkiewicz40beee52009-11-08 14:39:55 +0100741 if (rt2800_efuse_detect(rt2x00dev))
Gabor Juhosa02308e2012-12-29 14:51:51 +0100742 retval = rt2800_read_eeprom_efuse(rt2x00dev);
Bartlomiej Zolnierkiewicz40beee52009-11-08 14:39:55 +0100743 else
Gabor Juhosa02308e2012-12-29 14:51:51 +0100744 retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
745 EEPROM_SIZE);
746
747 return retval;
Bartlomiej Zolnierkiewicz7ab71322009-11-08 14:38:54 +0100748}
749
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200750static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
751{
752 int retval;
753
Gertjan van Wingerdead417a52012-09-03 03:25:51 +0200754 retval = rt2800_probe_hw(rt2x00dev);
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200755 if (retval)
756 return retval;
757
758 /*
Gertjan van Wingerdead417a52012-09-03 03:25:51 +0200759 * Set txstatus timer function.
Gertjan van Wingerdea396e102012-08-31 19:22:11 +0200760 */
Gertjan van Wingerdead417a52012-09-03 03:25:51 +0200761 rt2x00dev->txstatus_timer.function = rt2800usb_tx_sta_fifo_timeout;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200762
Ivo van Doorn96481b22010-08-06 20:47:57 +0200763 /*
764 * Overwrite TX done handler
765 */
766 PREPARE_WORK(&rt2x00dev->txdone_work, rt2800usb_work_txdone);
767
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200768 return 0;
769}
770
Helmut Schaae7836192010-07-11 12:28:54 +0200771static const struct ieee80211_ops rt2800usb_mac80211_ops = {
772 .tx = rt2x00mac_tx,
773 .start = rt2x00mac_start,
774 .stop = rt2x00mac_stop,
775 .add_interface = rt2x00mac_add_interface,
776 .remove_interface = rt2x00mac_remove_interface,
777 .config = rt2x00mac_config,
778 .configure_filter = rt2x00mac_configure_filter,
779 .set_tim = rt2x00mac_set_tim,
780 .set_key = rt2x00mac_set_key,
781 .sw_scan_start = rt2x00mac_sw_scan_start,
782 .sw_scan_complete = rt2x00mac_sw_scan_complete,
783 .get_stats = rt2x00mac_get_stats,
784 .get_tkip_seq = rt2800_get_tkip_seq,
785 .set_rts_threshold = rt2800_set_rts_threshold,
Helmut Schaaa2b13282011-09-08 14:38:01 +0200786 .sta_add = rt2x00mac_sta_add,
787 .sta_remove = rt2x00mac_sta_remove,
Helmut Schaae7836192010-07-11 12:28:54 +0200788 .bss_info_changed = rt2x00mac_bss_info_changed,
789 .conf_tx = rt2800_conf_tx,
790 .get_tsf = rt2800_get_tsf,
791 .rfkill_poll = rt2x00mac_rfkill_poll,
792 .ampdu_action = rt2800_ampdu_action,
Ivo van Doornf44df182010-11-04 20:40:11 +0100793 .flush = rt2x00mac_flush,
Helmut Schaa977206d2010-12-13 12:31:58 +0100794 .get_survey = rt2800_get_survey,
Ivo van Doorne7dee442011-04-18 15:34:41 +0200795 .get_ringparam = rt2x00mac_get_ringparam,
Gertjan van Wingerde5f0dd292011-07-06 23:00:21 +0200796 .tx_frames_pending = rt2x00mac_tx_frames_pending,
Helmut Schaae7836192010-07-11 12:28:54 +0200797};
798
Ivo van Doorne7966432010-07-11 12:31:23 +0200799static const struct rt2800_ops rt2800usb_rt2800_ops = {
800 .register_read = rt2x00usb_register_read,
801 .register_read_lock = rt2x00usb_register_read_lock,
802 .register_write = rt2x00usb_register_write,
803 .register_write_lock = rt2x00usb_register_write_lock,
804 .register_multiread = rt2x00usb_register_multiread,
805 .register_multiwrite = rt2x00usb_register_multiwrite,
806 .regbusy_read = rt2x00usb_regbusy_read,
Gertjan van Wingerdead417a52012-09-03 03:25:51 +0200807 .read_eeprom = rt2800usb_read_eeprom,
808 .hwcrypt_disabled = rt2800usb_hwcrypt_disabled,
Ivo van Doorne7966432010-07-11 12:31:23 +0200809 .drv_write_firmware = rt2800usb_write_firmware,
810 .drv_init_registers = rt2800usb_init_registers,
Ivo van Doorn0c5879b2010-08-06 20:47:20 +0200811 .drv_get_txwi = rt2800usb_get_txwi,
Ivo van Doorne7966432010-07-11 12:31:23 +0200812};
813
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200814static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
815 .probe_hw = rt2800usb_probe_hw,
816 .get_firmware_name = rt2800usb_get_firmware_name,
Ivo van Doornf31c9a82010-07-11 12:30:37 +0200817 .check_firmware = rt2800_check_firmware,
818 .load_firmware = rt2800_load_firmware,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200819 .initialize = rt2x00usb_initialize,
820 .uninitialize = rt2x00usb_uninitialize,
821 .clear_entry = rt2x00usb_clear_entry,
822 .set_device_state = rt2800usb_set_device_state,
Bartlomiej Zolnierkiewiczf4450612009-11-04 18:36:40 +0100823 .rfkill_poll = rt2800_rfkill_poll,
824 .link_stats = rt2800_link_stats,
825 .reset_tuner = rt2800_reset_tuner,
826 .link_tuner = rt2800_link_tuner,
Helmut Schaa9e33a352011-03-28 13:33:40 +0200827 .gain_calibration = rt2800_gain_calibration,
John Li2e9c43d2012-02-16 21:40:57 +0800828 .vco_calibration = rt2800_vco_calibration,
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100829 .watchdog = rt2800usb_watchdog,
Ivo van Doorndbba3062010-12-13 12:34:54 +0100830 .start_queue = rt2800usb_start_queue,
831 .kick_queue = rt2x00usb_kick_queue,
832 .stop_queue = rt2800usb_stop_queue,
Ivo van Doorn5be65602010-12-13 12:35:40 +0100833 .flush_queue = rt2x00usb_flush_queue,
Johannes Stezenbach0e0d39e2011-04-18 15:29:12 +0200834 .tx_dma_done = rt2800usb_tx_dma_done,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200835 .write_tx_desc = rt2800usb_write_tx_desc,
Jakub Kiciński4bcafac2011-12-28 01:53:21 +0100836 .write_tx_data = rt2800_write_tx_data,
Gertjan van Wingerdef0194b22010-06-03 10:51:53 +0200837 .write_beacon = rt2800_write_beacon,
Helmut Schaa69cf36a2011-01-30 13:16:03 +0100838 .clear_beacon = rt2800_clear_beacon,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200839 .get_tx_data_len = rt2800usb_get_tx_data_len,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200840 .fill_rxdone = rt2800usb_fill_rxdone,
Bartlomiej Zolnierkiewiczf4450612009-11-04 18:36:40 +0100841 .config_shared_key = rt2800_config_shared_key,
842 .config_pairwise_key = rt2800_config_pairwise_key,
843 .config_filter = rt2800_config_filter,
844 .config_intf = rt2800_config_intf,
845 .config_erp = rt2800_config_erp,
846 .config_ant = rt2800_config_ant,
847 .config = rt2800_config,
Helmut Schaaa2b13282011-09-08 14:38:01 +0200848 .sta_add = rt2800_sta_add,
849 .sta_remove = rt2800_sta_remove,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200850};
851
Gabor Juhosd36d13a2013-06-04 13:40:43 +0200852static void rt2800usb_queue_init(struct data_queue *queue)
853{
854 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
855 unsigned short txwi_size, rxwi_size;
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200856
Gabor Juhosd36d13a2013-06-04 13:40:43 +0200857 if (rt2x00_rt(rt2x00dev, RT5592)) {
858 txwi_size = TXWI_DESC_SIZE_5592;
859 rxwi_size = RXWI_DESC_SIZE_5592;
860 } else {
861 txwi_size = TXWI_DESC_SIZE;
862 rxwi_size = RXWI_DESC_SIZE;
863 }
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200864
Gabor Juhosd36d13a2013-06-04 13:40:43 +0200865 switch (queue->qid) {
866 case QID_RX:
867 queue->limit = 128;
868 queue->data_size = AGGREGATION_SIZE;
869 queue->desc_size = RXINFO_DESC_SIZE;
870 queue->winfo_size = rxwi_size;
871 queue->priv_size = sizeof(struct queue_entry_priv_usb);
872 break;
873
874 case QID_AC_VO:
875 case QID_AC_VI:
876 case QID_AC_BE:
877 case QID_AC_BK:
878 queue->limit = 16;
879 queue->data_size = AGGREGATION_SIZE;
880 queue->desc_size = TXINFO_DESC_SIZE;
881 queue->winfo_size = txwi_size;
882 queue->priv_size = sizeof(struct queue_entry_priv_usb);
883 break;
884
885 case QID_BEACON:
886 queue->limit = 8;
887 queue->data_size = MGMT_FRAME_SIZE;
888 queue->desc_size = TXINFO_DESC_SIZE;
889 queue->winfo_size = txwi_size;
890 queue->priv_size = sizeof(struct queue_entry_priv_usb);
891 break;
892
893 case QID_ATIM:
894 /* fallthrough */
895 default:
896 BUG();
897 break;
898 }
899}
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200900
901static const struct rt2x00_ops rt2800usb_ops = {
Gertjan van Wingerde04d03622009-11-23 22:44:51 +0100902 .name = KBUILD_MODNAME,
Gertjan van Wingerde3a1c0122012-02-06 23:45:07 +0100903 .drv_data_size = sizeof(struct rt2800_drv_data),
Gertjan van Wingerde04d03622009-11-23 22:44:51 +0100904 .max_ap_intf = 8,
905 .eeprom_size = EEPROM_SIZE,
906 .rf_size = RF_SIZE,
907 .tx_queues = NUM_TX_QUEUES,
Gertjan van Wingerdee6218cc2009-11-23 22:44:52 +0100908 .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
Gabor Juhosd36d13a2013-06-04 13:40:43 +0200909 .queue_init = rt2800usb_queue_init,
Gertjan van Wingerde04d03622009-11-23 22:44:51 +0100910 .lib = &rt2800usb_rt2x00_ops,
Ivo van Doorne7966432010-07-11 12:31:23 +0200911 .drv = &rt2800usb_rt2800_ops,
Helmut Schaae7836192010-07-11 12:28:54 +0200912 .hw = &rt2800usb_mac80211_ops,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200913#ifdef CONFIG_RT2X00_LIB_DEBUGFS
Gertjan van Wingerde04d03622009-11-23 22:44:51 +0100914 .debugfs = &rt2800_rt2x00debug,
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200915#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
916};
917
Stanislaw Gruszka613c75f2013-03-16 19:19:50 +0100918static const struct rt2x00_ops rt2800usb_ops_5592 = {
919 .name = KBUILD_MODNAME,
920 .drv_data_size = sizeof(struct rt2800_drv_data),
921 .max_ap_intf = 8,
922 .eeprom_size = EEPROM_SIZE,
923 .rf_size = RF_SIZE,
924 .tx_queues = NUM_TX_QUEUES,
925 .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE_5592,
Gabor Juhosd36d13a2013-06-04 13:40:43 +0200926 .queue_init = rt2800usb_queue_init,
Stanislaw Gruszka613c75f2013-03-16 19:19:50 +0100927 .lib = &rt2800usb_rt2x00_ops,
928 .drv = &rt2800usb_rt2800_ops,
929 .hw = &rt2800usb_mac80211_ops,
930#ifdef CONFIG_RT2X00_LIB_DEBUGFS
931 .debugfs = &rt2800_rt2x00debug,
932#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
933};
934
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200935/*
936 * rt2800usb module information.
937 */
938static struct usb_device_id rt2800usb_device_table[] = {
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200939 /* Abocom */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200940 { USB_DEVICE(0x07b8, 0x2870) },
941 { USB_DEVICE(0x07b8, 0x2770) },
942 { USB_DEVICE(0x07b8, 0x3070) },
943 { USB_DEVICE(0x07b8, 0x3071) },
944 { USB_DEVICE(0x07b8, 0x3072) },
945 { USB_DEVICE(0x1482, 0x3c09) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +0100946 /* AirTies */
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +0200947 { USB_DEVICE(0x1eda, 0x2012) },
Xose Vazquez Perez63b37642012-04-17 01:50:32 +0200948 { USB_DEVICE(0x1eda, 0x2210) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200949 { USB_DEVICE(0x1eda, 0x2310) },
Xose Vazquez Pereze8958332010-04-19 11:54:16 +0200950 /* Allwin */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200951 { USB_DEVICE(0x8516, 0x2070) },
952 { USB_DEVICE(0x8516, 0x2770) },
953 { USB_DEVICE(0x8516, 0x2870) },
954 { USB_DEVICE(0x8516, 0x3070) },
955 { USB_DEVICE(0x8516, 0x3071) },
956 { USB_DEVICE(0x8516, 0x3072) },
Mark Davisb3ba44c62011-04-12 00:19:10 -0400957 /* Alpha Networks */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200958 { USB_DEVICE(0x14b2, 0x3c06) },
959 { USB_DEVICE(0x14b2, 0x3c07) },
960 { USB_DEVICE(0x14b2, 0x3c09) },
961 { USB_DEVICE(0x14b2, 0x3c12) },
962 { USB_DEVICE(0x14b2, 0x3c23) },
963 { USB_DEVICE(0x14b2, 0x3c25) },
964 { USB_DEVICE(0x14b2, 0x3c27) },
965 { USB_DEVICE(0x14b2, 0x3c28) },
966 { USB_DEVICE(0x14b2, 0x3c2c) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200967 /* Amit */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200968 { USB_DEVICE(0x15c5, 0x0008) },
Xose Vazquez Perez2edcb7f2009-11-17 13:43:16 +0100969 /* Askey */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200970 { USB_DEVICE(0x1690, 0x0740) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200971 /* ASUS */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200972 { USB_DEVICE(0x0b05, 0x1731) },
973 { USB_DEVICE(0x0b05, 0x1732) },
974 { USB_DEVICE(0x0b05, 0x1742) },
975 { USB_DEVICE(0x0b05, 0x1784) },
976 { USB_DEVICE(0x1761, 0x0b05) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200977 /* AzureWave */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200978 { USB_DEVICE(0x13d3, 0x3247) },
979 { USB_DEVICE(0x13d3, 0x3273) },
980 { USB_DEVICE(0x13d3, 0x3305) },
981 { USB_DEVICE(0x13d3, 0x3307) },
982 { USB_DEVICE(0x13d3, 0x3321) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200983 /* Belkin */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200984 { USB_DEVICE(0x050d, 0x8053) },
985 { USB_DEVICE(0x050d, 0x805c) },
986 { USB_DEVICE(0x050d, 0x815c) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +0100987 { USB_DEVICE(0x050d, 0x825a) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200988 { USB_DEVICE(0x050d, 0x825b) },
989 { USB_DEVICE(0x050d, 0x935a) },
990 { USB_DEVICE(0x050d, 0x935b) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200991 /* Buffalo */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200992 { USB_DEVICE(0x0411, 0x00e8) },
Gertjan van Wingerdec18b7802011-11-12 19:10:43 +0100993 { USB_DEVICE(0x0411, 0x0158) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +0100994 { USB_DEVICE(0x0411, 0x015d) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200995 { USB_DEVICE(0x0411, 0x016f) },
996 { USB_DEVICE(0x0411, 0x01a2) },
Jeongdo Sona769f952012-06-15 02:28:01 +0900997 { USB_DEVICE(0x0411, 0x01ee) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +0200998 /* Corega */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +0200999 { USB_DEVICE(0x07aa, 0x002f) },
1000 { USB_DEVICE(0x07aa, 0x003c) },
1001 { USB_DEVICE(0x07aa, 0x003f) },
1002 { USB_DEVICE(0x18c5, 0x0012) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001003 /* D-Link */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001004 { USB_DEVICE(0x07d1, 0x3c09) },
1005 { USB_DEVICE(0x07d1, 0x3c0a) },
1006 { USB_DEVICE(0x07d1, 0x3c0d) },
1007 { USB_DEVICE(0x07d1, 0x3c0e) },
1008 { USB_DEVICE(0x07d1, 0x3c0f) },
1009 { USB_DEVICE(0x07d1, 0x3c11) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001010 { USB_DEVICE(0x07d1, 0x3c13) },
1011 { USB_DEVICE(0x07d1, 0x3c15) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001012 { USB_DEVICE(0x07d1, 0x3c16) },
Xose Vazquez Perezcd435d52013-01-30 17:14:13 +01001013 { USB_DEVICE(0x07d1, 0x3c17) },
Gertjan van Wingerded42a1792012-02-11 21:58:09 +01001014 { USB_DEVICE(0x2001, 0x3c1b) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001015 /* Draytek */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001016 { USB_DEVICE(0x07fa, 0x7712) },
Anthony Bourguignon276b02e2011-08-05 07:46:32 +02001017 /* DVICO */
1018 { USB_DEVICE(0x0fe9, 0xb307) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001019 /* Edimax */
Xose Vazquez Pereze828b9f2012-04-17 16:28:05 +02001020 { USB_DEVICE(0x7392, 0x4085) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001021 { USB_DEVICE(0x7392, 0x7711) },
1022 { USB_DEVICE(0x7392, 0x7717) },
1023 { USB_DEVICE(0x7392, 0x7718) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001024 { USB_DEVICE(0x7392, 0x7722) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001025 /* Encore */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001026 { USB_DEVICE(0x203d, 0x1480) },
1027 { USB_DEVICE(0x203d, 0x14a9) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001028 /* EnGenius */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001029 { USB_DEVICE(0x1740, 0x9701) },
1030 { USB_DEVICE(0x1740, 0x9702) },
1031 { USB_DEVICE(0x1740, 0x9703) },
1032 { USB_DEVICE(0x1740, 0x9705) },
1033 { USB_DEVICE(0x1740, 0x9706) },
1034 { USB_DEVICE(0x1740, 0x9707) },
1035 { USB_DEVICE(0x1740, 0x9708) },
1036 { USB_DEVICE(0x1740, 0x9709) },
Mark Davisb3ba44c62011-04-12 00:19:10 -04001037 /* Gemtek */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001038 { USB_DEVICE(0x15a9, 0x0012) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001039 /* Gigabyte */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001040 { USB_DEVICE(0x1044, 0x800b) },
1041 { USB_DEVICE(0x1044, 0x800d) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001042 /* Hawking */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001043 { USB_DEVICE(0x0e66, 0x0001) },
1044 { USB_DEVICE(0x0e66, 0x0003) },
1045 { USB_DEVICE(0x0e66, 0x0009) },
1046 { USB_DEVICE(0x0e66, 0x000b) },
1047 { USB_DEVICE(0x0e66, 0x0013) },
1048 { USB_DEVICE(0x0e66, 0x0017) },
1049 { USB_DEVICE(0x0e66, 0x0018) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001050 /* I-O DATA */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001051 { USB_DEVICE(0x04bb, 0x0945) },
1052 { USB_DEVICE(0x04bb, 0x0947) },
1053 { USB_DEVICE(0x04bb, 0x0948) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001054 /* Linksys */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001055 { USB_DEVICE(0x13b1, 0x0031) },
1056 { USB_DEVICE(0x1737, 0x0070) },
1057 { USB_DEVICE(0x1737, 0x0071) },
Larry Finger3f81f8f2011-12-27 12:22:51 -06001058 { USB_DEVICE(0x1737, 0x0077) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001059 { USB_DEVICE(0x1737, 0x0078) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001060 /* Logitec */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001061 { USB_DEVICE(0x0789, 0x0162) },
1062 { USB_DEVICE(0x0789, 0x0163) },
1063 { USB_DEVICE(0x0789, 0x0164) },
1064 { USB_DEVICE(0x0789, 0x0166) },
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001065 /* Motorola */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001066 { USB_DEVICE(0x100d, 0x9031) },
Xose Vazquez Perez2edcb7f2009-11-17 13:43:16 +01001067 /* MSI */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001068 { USB_DEVICE(0x0db0, 0x3820) },
1069 { USB_DEVICE(0x0db0, 0x3821) },
1070 { USB_DEVICE(0x0db0, 0x3822) },
1071 { USB_DEVICE(0x0db0, 0x3870) },
1072 { USB_DEVICE(0x0db0, 0x3871) },
1073 { USB_DEVICE(0x0db0, 0x6899) },
1074 { USB_DEVICE(0x0db0, 0x821a) },
1075 { USB_DEVICE(0x0db0, 0x822a) },
1076 { USB_DEVICE(0x0db0, 0x822b) },
1077 { USB_DEVICE(0x0db0, 0x822c) },
1078 { USB_DEVICE(0x0db0, 0x870a) },
1079 { USB_DEVICE(0x0db0, 0x871a) },
1080 { USB_DEVICE(0x0db0, 0x871b) },
1081 { USB_DEVICE(0x0db0, 0x871c) },
1082 { USB_DEVICE(0x0db0, 0x899a) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001083 /* Ovislink */
1084 { USB_DEVICE(0x1b75, 0x3071) },
1085 { USB_DEVICE(0x1b75, 0x3072) },
Xose Vazquez Perezfc3f1482010-03-28 15:52:43 +02001086 /* Para */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001087 { USB_DEVICE(0x20b8, 0x8888) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001088 /* Pegatron */
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001089 { USB_DEVICE(0x1d4d, 0x0002) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001090 { USB_DEVICE(0x1d4d, 0x000c) },
1091 { USB_DEVICE(0x1d4d, 0x000e) },
1092 { USB_DEVICE(0x1d4d, 0x0011) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001093 /* Philips */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001094 { USB_DEVICE(0x0471, 0x200f) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001095 /* Planex */
Xose Vazquez Pereze828b9f2012-04-17 16:28:05 +02001096 { USB_DEVICE(0x2019, 0x5201) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001097 { USB_DEVICE(0x2019, 0xab25) },
1098 { USB_DEVICE(0x2019, 0xed06) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001099 /* Quanta */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001100 { USB_DEVICE(0x1a32, 0x0304) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001101 /* Ralink */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001102 { USB_DEVICE(0x148f, 0x2070) },
1103 { USB_DEVICE(0x148f, 0x2770) },
1104 { USB_DEVICE(0x148f, 0x2870) },
1105 { USB_DEVICE(0x148f, 0x3070) },
1106 { USB_DEVICE(0x148f, 0x3071) },
1107 { USB_DEVICE(0x148f, 0x3072) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001108 /* Samsung */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001109 { USB_DEVICE(0x04e8, 0x2018) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001110 /* Siemens */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001111 { USB_DEVICE(0x129b, 0x1828) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001112 /* Sitecom */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001113 { USB_DEVICE(0x0df6, 0x0017) },
1114 { USB_DEVICE(0x0df6, 0x002b) },
1115 { USB_DEVICE(0x0df6, 0x002c) },
1116 { USB_DEVICE(0x0df6, 0x002d) },
1117 { USB_DEVICE(0x0df6, 0x0039) },
1118 { USB_DEVICE(0x0df6, 0x003b) },
1119 { USB_DEVICE(0x0df6, 0x003d) },
1120 { USB_DEVICE(0x0df6, 0x003e) },
1121 { USB_DEVICE(0x0df6, 0x003f) },
1122 { USB_DEVICE(0x0df6, 0x0040) },
1123 { USB_DEVICE(0x0df6, 0x0042) },
1124 { USB_DEVICE(0x0df6, 0x0047) },
1125 { USB_DEVICE(0x0df6, 0x0048) },
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001126 { USB_DEVICE(0x0df6, 0x0051) },
1127 { USB_DEVICE(0x0df6, 0x005f) },
Gertjan van Wingerdeacb56122011-07-06 22:59:19 +02001128 { USB_DEVICE(0x0df6, 0x0060) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001129 /* SMC */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001130 { USB_DEVICE(0x083a, 0x6618) },
1131 { USB_DEVICE(0x083a, 0x7511) },
1132 { USB_DEVICE(0x083a, 0x7512) },
1133 { USB_DEVICE(0x083a, 0x7522) },
1134 { USB_DEVICE(0x083a, 0x8522) },
1135 { USB_DEVICE(0x083a, 0xa618) },
1136 { USB_DEVICE(0x083a, 0xa701) },
1137 { USB_DEVICE(0x083a, 0xa702) },
1138 { USB_DEVICE(0x083a, 0xa703) },
1139 { USB_DEVICE(0x083a, 0xb522) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001140 /* Sparklan */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001141 { USB_DEVICE(0x15a9, 0x0006) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001142 /* Sweex */
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001143 { USB_DEVICE(0x177f, 0x0153) },
Xose Vazquez Perez12b66392013-02-02 03:33:44 +01001144 { USB_DEVICE(0x177f, 0x0164) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001145 { USB_DEVICE(0x177f, 0x0302) },
Gertjan van Wingerdebc93eda2011-12-28 01:53:18 +01001146 { USB_DEVICE(0x177f, 0x0313) },
Jaume Delclòs36f318b2012-11-02 23:35:20 +01001147 { USB_DEVICE(0x177f, 0x0323) },
Xose Vazquez Perez12b66392013-02-02 03:33:44 +01001148 { USB_DEVICE(0x177f, 0x0324) },
Mark Davisb3ba44c62011-04-12 00:19:10 -04001149 /* U-Media */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001150 { USB_DEVICE(0x157e, 0x300e) },
1151 { USB_DEVICE(0x157e, 0x3013) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001152 /* ZCOM */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001153 { USB_DEVICE(0x0cde, 0x0022) },
1154 { USB_DEVICE(0x0cde, 0x0025) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001155 /* Zinwell */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001156 { USB_DEVICE(0x5a57, 0x0280) },
1157 { USB_DEVICE(0x5a57, 0x0282) },
1158 { USB_DEVICE(0x5a57, 0x0283) },
1159 { USB_DEVICE(0x5a57, 0x5257) },
Gertjan van Wingerdea6a8d66e2010-11-13 19:10:31 +01001160 /* Zyxel */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001161 { USB_DEVICE(0x0586, 0x3416) },
1162 { USB_DEVICE(0x0586, 0x3418) },
Xose Vazquez Perezcd435d52013-01-30 17:14:13 +01001163 { USB_DEVICE(0x0586, 0x341a) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001164 { USB_DEVICE(0x0586, 0x341e) },
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001165 { USB_DEVICE(0x0586, 0x343e) },
Gertjan van Wingerdef93bc9b2010-11-13 19:09:50 +01001166#ifdef CONFIG_RT2800USB_RT33XX
Eduardo Bacchi Kienetz43bf8c22011-07-10 17:05:14 +02001167 /* Belkin */
1168 { USB_DEVICE(0x050d, 0x945b) },
Albert Pool8fd9d052012-05-14 18:08:32 +02001169 /* D-Link */
1170 { USB_DEVICE(0x2001, 0x3c17) },
Xose Vazquez Perez63b37642012-04-17 01:50:32 +02001171 /* Panasonic */
1172 { USB_DEVICE(0x083a, 0xb511) },
1173 /* Philips */
1174 { USB_DEVICE(0x0471, 0x20dd) },
Gertjan van Wingerdef93bc9b2010-11-13 19:09:50 +01001175 /* Ralink */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001176 { USB_DEVICE(0x148f, 0x3370) },
1177 { USB_DEVICE(0x148f, 0x8070) },
Gertjan van Wingerdef93bc9b2010-11-13 19:09:50 +01001178 /* Sitecom */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001179 { USB_DEVICE(0x0df6, 0x0050) },
Xose Vazquez Perez12b66392013-02-02 03:33:44 +01001180 /* Sweex */
1181 { USB_DEVICE(0x177f, 0x0163) },
1182 { USB_DEVICE(0x177f, 0x0165) },
Gertjan van Wingerdef93bc9b2010-11-13 19:09:50 +01001183#endif
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001184#ifdef CONFIG_RT2800USB_RT35XX
Xose Vazquez Pereze8958332010-04-19 11:54:16 +02001185 /* Allwin */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001186 { USB_DEVICE(0x8516, 0x3572) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001187 /* Askey */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001188 { USB_DEVICE(0x1690, 0x0744) },
Xose Vazquez Pereze828b9f2012-04-17 16:28:05 +02001189 { USB_DEVICE(0x1690, 0x0761) },
Xose Vazquez Perez63b37642012-04-17 01:50:32 +02001190 { USB_DEVICE(0x1690, 0x0764) },
Gertjan van Wingerde177ef832012-08-31 19:22:09 +02001191 /* ASUS */
1192 { USB_DEVICE(0x0b05, 0x179d) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001193 /* Cisco */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001194 { USB_DEVICE(0x167b, 0x4001) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001195 /* EnGenius */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001196 { USB_DEVICE(0x1740, 0x9801) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001197 /* I-O DATA */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001198 { USB_DEVICE(0x04bb, 0x0944) },
Mark Davisb3ba44c62011-04-12 00:19:10 -04001199 /* Linksys */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001200 { USB_DEVICE(0x13b1, 0x002f) },
1201 { USB_DEVICE(0x1737, 0x0079) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001202 /* Ralink */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001203 { USB_DEVICE(0x148f, 0x3572) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001204 /* Sitecom */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001205 { USB_DEVICE(0x0df6, 0x0041) },
Gertjan van Wingerdeacb56122011-07-06 22:59:19 +02001206 { USB_DEVICE(0x0df6, 0x0062) },
Xose Vazquez Perez63b37642012-04-17 01:50:32 +02001207 { USB_DEVICE(0x0df6, 0x0065) },
1208 { USB_DEVICE(0x0df6, 0x0066) },
1209 { USB_DEVICE(0x0df6, 0x0068) },
Xose Vazquez Perez8d4ca612011-03-27 20:33:06 +02001210 /* Toshiba */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001211 { USB_DEVICE(0x0930, 0x0a07) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001212 /* Zinwell */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001213 { USB_DEVICE(0x5a57, 0x0284) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001214#endif
Gertjan van Wingerdeaca355b2011-05-04 21:41:36 +02001215#ifdef CONFIG_RT2800USB_RT53XX
John Li2ed71882012-02-17 17:33:06 +08001216 /* Arcadyan */
1217 { USB_DEVICE(0x043e, 0x7a12) },
Xose Vazquez Perezcd435d52013-01-30 17:14:13 +01001218 { USB_DEVICE(0x043e, 0x7a32) },
Gertjan van Wingerdeaca355b2011-05-04 21:41:36 +02001219 /* Azurewave */
1220 { USB_DEVICE(0x13d3, 0x3329) },
1221 { USB_DEVICE(0x13d3, 0x3365) },
Xose Vazquez Perez63b37642012-04-17 01:50:32 +02001222 /* D-Link */
1223 { USB_DEVICE(0x2001, 0x3c15) },
1224 { USB_DEVICE(0x2001, 0x3c19) },
1225 { USB_DEVICE(0x2001, 0x3c1c) },
1226 { USB_DEVICE(0x2001, 0x3c1d) },
John W. Linvillefe8e4102012-12-11 15:55:02 -05001227 { USB_DEVICE(0x2001, 0x3c1e) },
John Li2ed71882012-02-17 17:33:06 +08001228 /* LG innotek */
1229 { USB_DEVICE(0x043e, 0x7a22) },
Xose Vazquez Perezcd435d52013-01-30 17:14:13 +01001230 { USB_DEVICE(0x043e, 0x7a42) },
John Li2ed71882012-02-17 17:33:06 +08001231 /* Panasonic */
1232 { USB_DEVICE(0x04da, 0x1801) },
1233 { USB_DEVICE(0x04da, 0x1800) },
Xose Vazquez Perezcd435d52013-01-30 17:14:13 +01001234 { USB_DEVICE(0x04da, 0x23f6) },
John Li2ed71882012-02-17 17:33:06 +08001235 /* Philips */
1236 { USB_DEVICE(0x0471, 0x2104) },
Xose Vazquez Perezcd435d52013-01-30 17:14:13 +01001237 { USB_DEVICE(0x0471, 0x2126) },
1238 { USB_DEVICE(0x0471, 0x2180) },
1239 { USB_DEVICE(0x0471, 0x2181) },
1240 { USB_DEVICE(0x0471, 0x2182) },
Gertjan van Wingerdeaca355b2011-05-04 21:41:36 +02001241 /* Ralink */
1242 { USB_DEVICE(0x148f, 0x5370) },
1243 { USB_DEVICE(0x148f, 0x5372) },
1244#endif
Stanislaw Gruszkab8863f82013-03-16 19:19:30 +01001245#ifdef CONFIG_RT2800USB_RT55XX
Stanislaw Gruszka856a8502013-03-16 19:19:53 +01001246 /* Arcadyan */
1247 { USB_DEVICE(0x043e, 0x7a32), .driver_info = 5592 },
1248 /* AVM GmbH */
1249 { USB_DEVICE(0x057c, 0x8501), .driver_info = 5592 },
1250 /* D-Link DWA-160-B2 */
1251 { USB_DEVICE(0x2001, 0x3c1a), .driver_info = 5592 },
1252 /* Proware */
1253 { USB_DEVICE(0x043e, 0x7a13), .driver_info = 5592 },
1254 /* Ralink */
Stanislaw Gruszka613c75f2013-03-16 19:19:50 +01001255 { USB_DEVICE(0x148f, 0x5572), .driver_info = 5592 },
Stanislaw Gruszkab8863f82013-03-16 19:19:30 +01001256#endif
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001257#ifdef CONFIG_RT2800USB_UNKNOWN
1258 /*
1259 * Unclear what kind of devices these are (they aren't supported by the
Xose Vazquez Perez12ef1162010-05-03 13:11:38 +02001260 * vendor linux driver).
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001261 */
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001262 /* Abocom */
1263 { USB_DEVICE(0x07b8, 0x3073) },
1264 { USB_DEVICE(0x07b8, 0x3074) },
Mark Davisb3ba44c62011-04-12 00:19:10 -04001265 /* Alpha Networks */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001266 { USB_DEVICE(0x14b2, 0x3c08) },
1267 { USB_DEVICE(0x14b2, 0x3c11) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001268 /* Amigo */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001269 { USB_DEVICE(0x0e0b, 0x9031) },
1270 { USB_DEVICE(0x0e0b, 0x9041) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001271 /* ASUS */
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001272 { USB_DEVICE(0x0b05, 0x166a) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001273 { USB_DEVICE(0x0b05, 0x1760) },
1274 { USB_DEVICE(0x0b05, 0x1761) },
1275 { USB_DEVICE(0x0b05, 0x1790) },
Xose Vazquez Perezd9d76a02013-02-09 04:14:35 +01001276 { USB_DEVICE(0x0b05, 0x17a7) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001277 /* AzureWave */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001278 { USB_DEVICE(0x13d3, 0x3262) },
1279 { USB_DEVICE(0x13d3, 0x3284) },
1280 { USB_DEVICE(0x13d3, 0x3322) },
Xose Vazquez Perezd9d76a02013-02-09 04:14:35 +01001281 { USB_DEVICE(0x13d3, 0x3340) },
1282 { USB_DEVICE(0x13d3, 0x3399) },
1283 { USB_DEVICE(0x13d3, 0x3400) },
1284 { USB_DEVICE(0x13d3, 0x3401) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001285 /* Belkin */
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001286 { USB_DEVICE(0x050d, 0x1003) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001287 /* Buffalo */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001288 { USB_DEVICE(0x0411, 0x012e) },
1289 { USB_DEVICE(0x0411, 0x0148) },
1290 { USB_DEVICE(0x0411, 0x0150) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001291 /* Corega */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001292 { USB_DEVICE(0x07aa, 0x0041) },
1293 { USB_DEVICE(0x07aa, 0x0042) },
1294 { USB_DEVICE(0x18c5, 0x0008) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001295 /* D-Link */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001296 { USB_DEVICE(0x07d1, 0x3c0b) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001297 /* Encore */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001298 { USB_DEVICE(0x203d, 0x14a1) },
Xose Vazquez Perezd9d76a02013-02-09 04:14:35 +01001299 /* EnGenius */
1300 { USB_DEVICE(0x1740, 0x0600) },
1301 { USB_DEVICE(0x1740, 0x0602) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001302 /* Gemtek */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001303 { USB_DEVICE(0x15a9, 0x0010) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001304 /* Gigabyte */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001305 { USB_DEVICE(0x1044, 0x800c) },
Xose Vazquez Perezd9d76a02013-02-09 04:14:35 +01001306 /* Hercules */
1307 { USB_DEVICE(0x06f8, 0xe036) },
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001308 /* Huawei */
1309 { USB_DEVICE(0x148f, 0xf101) },
1310 /* I-O DATA */
1311 { USB_DEVICE(0x04bb, 0x094b) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001312 /* LevelOne */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001313 { USB_DEVICE(0x1740, 0x0605) },
1314 { USB_DEVICE(0x1740, 0x0615) },
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001315 /* Logitec */
1316 { USB_DEVICE(0x0789, 0x0168) },
1317 { USB_DEVICE(0x0789, 0x0169) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001318 /* Motorola */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001319 { USB_DEVICE(0x100d, 0x9032) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001320 /* Pegatron */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001321 { USB_DEVICE(0x05a6, 0x0101) },
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001322 { USB_DEVICE(0x1d4d, 0x0010) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001323 /* Planex */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001324 { USB_DEVICE(0x2019, 0xab24) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001325 /* Qcom */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001326 { USB_DEVICE(0x18e8, 0x6259) },
Gertjan van Wingerde87a3b892011-04-18 15:32:33 +02001327 /* RadioShack */
1328 { USB_DEVICE(0x08b9, 0x1197) },
1329 /* Sitecom */
1330 { USB_DEVICE(0x0df6, 0x003c) },
1331 { USB_DEVICE(0x0df6, 0x004a) },
1332 { USB_DEVICE(0x0df6, 0x004d) },
1333 { USB_DEVICE(0x0df6, 0x0053) },
Xose Vazquez Perezd9d76a02013-02-09 04:14:35 +01001334 { USB_DEVICE(0x0df6, 0x0069) },
1335 { USB_DEVICE(0x0df6, 0x006f) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001336 /* SMC */
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001337 { USB_DEVICE(0x083a, 0xa512) },
1338 { USB_DEVICE(0x083a, 0xc522) },
1339 { USB_DEVICE(0x083a, 0xd522) },
1340 { USB_DEVICE(0x083a, 0xf511) },
Xose Vazquez Perezd9d76a02013-02-09 04:14:35 +01001341 /* Sweex */
1342 { USB_DEVICE(0x177f, 0x0254) },
1343 /* TP-LINK */
1344 { USB_DEVICE(0xf201, 0x5370) },
Gertjan van Wingerdede1ebdc2010-02-14 12:52:05 +01001345#endif
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001346 { 0, }
1347};
1348
1349MODULE_AUTHOR(DRV_PROJECT);
1350MODULE_VERSION(DRV_VERSION);
1351MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver.");
1352MODULE_SUPPORTED_DEVICE("Ralink RT2870 USB chipset based cards");
1353MODULE_DEVICE_TABLE(usb, rt2800usb_device_table);
1354MODULE_FIRMWARE(FIRMWARE_RT2870);
1355MODULE_LICENSE("GPL");
1356
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001357static int rt2800usb_probe(struct usb_interface *usb_intf,
1358 const struct usb_device_id *id)
1359{
Stanislaw Gruszka613c75f2013-03-16 19:19:50 +01001360 if (id->driver_info == 5592)
1361 return rt2x00usb_probe(usb_intf, &rt2800usb_ops_5592);
1362
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001363 return rt2x00usb_probe(usb_intf, &rt2800usb_ops);
1364}
1365
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001366static struct usb_driver rt2800usb_driver = {
1367 .name = KBUILD_MODNAME,
1368 .id_table = rt2800usb_device_table,
Gertjan van Wingerdee01ae272011-04-18 15:32:13 +02001369 .probe = rt2800usb_probe,
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001370 .disconnect = rt2x00usb_disconnect,
1371 .suspend = rt2x00usb_suspend,
1372 .resume = rt2x00usb_resume,
Stanislaw Gruszka761ce8c2012-10-16 14:34:12 +02001373 .reset_resume = rt2x00usb_resume,
Sarah Sharpe1f12eb2012-04-23 10:08:51 -07001374 .disable_hub_initiated_lpm = 1,
Ivo van Doornd53d9e62009-04-26 15:47:48 +02001375};
1376
Greg Kroah-Hartmand632eb12011-11-18 09:44:20 -08001377module_usb_driver(rt2800usb_driver);