PageRenderTime 1256ms CodeModel.GetById 32ms RepoModel.GetById 2ms app.codeStats 1ms

/drivers/net/wireless/rt2x00/rt2800usb.c

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C | 1152 lines | 777 code | 112 blank | 263 comment | 48 complexity | 39245f7a79914b23e72d6bbf0774e1bd MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*
  2. Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
  3. Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
  4. 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>
  8. <http://rt2x00.serialmonkey.com>
  9. This program is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2 of the License, or
  12. (at your option) any later version.
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. GNU General Public License for more details.
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the
  19. Free Software Foundation, Inc.,
  20. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. /*
  23. Module: rt2800usb
  24. Abstract: rt2800usb device specific routines.
  25. Supported chipsets: RT2800U.
  26. */
  27. #include <linux/delay.h>
  28. #include <linux/etherdevice.h>
  29. #include <linux/init.h>
  30. #include <linux/kernel.h>
  31. #include <linux/module.h>
  32. #include <linux/usb.h>
  33. #include "rt2x00.h"
  34. #include "rt2x00usb.h"
  35. #include "rt2800lib.h"
  36. #include "rt2800.h"
  37. #include "rt2800usb.h"
  38. /*
  39. * Allow hardware encryption to be disabled.
  40. */
  41. static int modparam_nohwcrypt;
  42. module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
  43. MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
  44. /*
  45. * Queue handlers.
  46. */
  47. static void rt2800usb_start_queue(struct data_queue *queue)
  48. {
  49. struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
  50. u32 reg;
  51. switch (queue->qid) {
  52. case QID_RX:
  53. rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
  54. rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 1);
  55. rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
  56. break;
  57. case QID_BEACON:
  58. rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
  59. rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 1);
  60. rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 1);
  61. rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
  62. rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
  63. break;
  64. default:
  65. break;
  66. }
  67. }
  68. static void rt2800usb_stop_queue(struct data_queue *queue)
  69. {
  70. struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
  71. u32 reg;
  72. switch (queue->qid) {
  73. case QID_RX:
  74. rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
  75. rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
  76. rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
  77. break;
  78. case QID_BEACON:
  79. rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
  80. rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
  81. rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
  82. rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
  83. rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
  84. break;
  85. default:
  86. break;
  87. }
  88. }
  89. /*
  90. * test if there is an entry in any TX queue for which DMA is done
  91. * but the TX status has not been returned yet
  92. */
  93. static bool rt2800usb_txstatus_pending(struct rt2x00_dev *rt2x00dev)
  94. {
  95. struct data_queue *queue;
  96. tx_queue_for_each(rt2x00dev, queue) {
  97. if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) !=
  98. rt2x00queue_get_entry(queue, Q_INDEX_DONE))
  99. return true;
  100. }
  101. return false;
  102. }
  103. static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
  104. int urb_status, u32 tx_status)
  105. {
  106. if (urb_status) {
  107. WARNING(rt2x00dev, "rt2x00usb_register_read_async failed: %d\n", urb_status);
  108. return false;
  109. }
  110. /* try to read all TX_STA_FIFO entries before scheduling txdone_work */
  111. if (rt2x00_get_field32(tx_status, TX_STA_FIFO_VALID)) {
  112. if (!kfifo_put(&rt2x00dev->txstatus_fifo, &tx_status)) {
  113. WARNING(rt2x00dev, "TX status FIFO overrun, "
  114. "drop tx status report.\n");
  115. queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
  116. } else
  117. return true;
  118. } else if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo)) {
  119. queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
  120. } else if (rt2800usb_txstatus_pending(rt2x00dev)) {
  121. mod_timer(&rt2x00dev->txstatus_timer, jiffies + msecs_to_jiffies(2));
  122. }
  123. return false;
  124. }
  125. static void rt2800usb_tx_dma_done(struct queue_entry *entry)
  126. {
  127. struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
  128. rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO,
  129. rt2800usb_tx_sta_fifo_read_completed);
  130. }
  131. static void rt2800usb_tx_sta_fifo_timeout(unsigned long data)
  132. {
  133. struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
  134. rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO,
  135. rt2800usb_tx_sta_fifo_read_completed);
  136. }
  137. /*
  138. * Firmware functions
  139. */
  140. static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
  141. {
  142. return FIRMWARE_RT2870;
  143. }
  144. static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
  145. const u8 *data, const size_t len)
  146. {
  147. int status;
  148. u32 offset;
  149. u32 length;
  150. /*
  151. * Check which section of the firmware we need.
  152. */
  153. if (rt2x00_rt(rt2x00dev, RT2860) ||
  154. rt2x00_rt(rt2x00dev, RT2872) ||
  155. rt2x00_rt(rt2x00dev, RT3070)) {
  156. offset = 0;
  157. length = 4096;
  158. } else {
  159. offset = 4096;
  160. length = 4096;
  161. }
  162. /*
  163. * Write firmware to device.
  164. */
  165. rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
  166. data + offset, length);
  167. rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
  168. rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
  169. /*
  170. * Send firmware request to device to load firmware,
  171. * we need to specify a long timeout time.
  172. */
  173. status = rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE,
  174. 0, USB_MODE_FIRMWARE,
  175. REGISTER_TIMEOUT_FIRMWARE);
  176. if (status < 0) {
  177. ERROR(rt2x00dev, "Failed to write Firmware to device.\n");
  178. return status;
  179. }
  180. msleep(10);
  181. rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
  182. return 0;
  183. }
  184. /*
  185. * Device state switch handlers.
  186. */
  187. static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
  188. {
  189. u32 reg;
  190. /*
  191. * Wait until BBP and RF are ready.
  192. */
  193. if (rt2800_wait_csr_ready(rt2x00dev))
  194. return -EBUSY;
  195. rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
  196. rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);
  197. rt2x00usb_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
  198. rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
  199. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  200. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
  201. rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
  202. rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
  203. rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
  204. USB_MODE_RESET, REGISTER_TIMEOUT);
  205. rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);
  206. return 0;
  207. }
  208. static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
  209. {
  210. u32 reg;
  211. if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev)))
  212. return -EIO;
  213. rt2x00usb_register_read(rt2x00dev, USB_DMA_CFG, &reg);
  214. rt2x00_set_field32(&reg, USB_DMA_CFG_PHY_CLEAR, 0);
  215. rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_EN, 0);
  216. rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128);
  217. /*
  218. * Total room for RX frames in kilobytes, PBF might still exceed
  219. * this limit so reduce the number to prevent errors.
  220. */
  221. rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_AGG_LIMIT,
  222. ((rt2x00dev->ops->rx->entry_num * DATA_FRAME_SIZE)
  223. / 1024) - 3);
  224. rt2x00_set_field32(&reg, USB_DMA_CFG_RX_BULK_EN, 1);
  225. rt2x00_set_field32(&reg, USB_DMA_CFG_TX_BULK_EN, 1);
  226. rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg);
  227. return rt2800_enable_radio(rt2x00dev);
  228. }
  229. static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev)
  230. {
  231. rt2800_disable_radio(rt2x00dev);
  232. rt2x00usb_disable_radio(rt2x00dev);
  233. }
  234. static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev,
  235. enum dev_state state)
  236. {
  237. if (state == STATE_AWAKE)
  238. rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 2);
  239. else
  240. rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0xff, 2);
  241. return 0;
  242. }
  243. static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
  244. enum dev_state state)
  245. {
  246. int retval = 0;
  247. switch (state) {
  248. case STATE_RADIO_ON:
  249. /*
  250. * Before the radio can be enabled, the device first has
  251. * to be woken up. After that it needs a bit of time
  252. * to be fully awake and then the radio can be enabled.
  253. */
  254. rt2800usb_set_state(rt2x00dev, STATE_AWAKE);
  255. msleep(1);
  256. retval = rt2800usb_enable_radio(rt2x00dev);
  257. break;
  258. case STATE_RADIO_OFF:
  259. /*
  260. * After the radio has been disabled, the device should
  261. * be put to sleep for powersaving.
  262. */
  263. rt2800usb_disable_radio(rt2x00dev);
  264. rt2800usb_set_state(rt2x00dev, STATE_SLEEP);
  265. break;
  266. case STATE_RADIO_IRQ_ON:
  267. case STATE_RADIO_IRQ_OFF:
  268. /* No support, but no error either */
  269. break;
  270. case STATE_DEEP_SLEEP:
  271. case STATE_SLEEP:
  272. case STATE_STANDBY:
  273. case STATE_AWAKE:
  274. retval = rt2800usb_set_state(rt2x00dev, state);
  275. break;
  276. default:
  277. retval = -ENOTSUPP;
  278. break;
  279. }
  280. if (unlikely(retval))
  281. ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n",
  282. state, retval);
  283. return retval;
  284. }
  285. /*
  286. * Watchdog handlers
  287. */
  288. static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
  289. {
  290. unsigned int i;
  291. u32 reg;
  292. rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
  293. if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) {
  294. WARNING(rt2x00dev, "TX HW queue 0 timed out,"
  295. " invoke forced kick\n");
  296. rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40012);
  297. for (i = 0; i < 10; i++) {
  298. udelay(10);
  299. if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q))
  300. break;
  301. }
  302. rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
  303. }
  304. rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
  305. if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) {
  306. WARNING(rt2x00dev, "TX HW queue 1 timed out,"
  307. " invoke forced kick\n");
  308. rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf4000a);
  309. for (i = 0; i < 10; i++) {
  310. udelay(10);
  311. if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q))
  312. break;
  313. }
  314. rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006);
  315. }
  316. rt2x00usb_watchdog(rt2x00dev);
  317. }
  318. /*
  319. * TX descriptor initialization
  320. */
  321. static __le32 *rt2800usb_get_txwi(struct queue_entry *entry)
  322. {
  323. if (entry->queue->qid == QID_BEACON)
  324. return (__le32 *) (entry->skb->data);
  325. else
  326. return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE);
  327. }
  328. static void rt2800usb_write_tx_desc(struct queue_entry *entry,
  329. struct txentry_desc *txdesc)
  330. {
  331. struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
  332. __le32 *txi = (__le32 *) entry->skb->data;
  333. u32 word;
  334. /*
  335. * Initialize TXINFO descriptor
  336. */
  337. rt2x00_desc_read(txi, 0, &word);
  338. /*
  339. * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is
  340. * TXWI + 802.11 header + L2 pad + payload + pad,
  341. * so need to decrease size of TXINFO and USB end pad.
  342. */
  343. rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
  344. entry->skb->len - TXINFO_DESC_SIZE - 4);
  345. rt2x00_set_field32(&word, TXINFO_W0_WIV,
  346. !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
  347. rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
  348. rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
  349. rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);
  350. rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST,
  351. test_bit(ENTRY_TXD_BURST, &txdesc->flags));
  352. rt2x00_desc_write(txi, 0, word);
  353. /*
  354. * Register descriptor details in skb frame descriptor.
  355. */
  356. skbdesc->flags |= SKBDESC_DESC_IN_SKB;
  357. skbdesc->desc = txi;
  358. skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
  359. }
  360. static void rt2800usb_write_tx_data(struct queue_entry *entry,
  361. struct txentry_desc *txdesc)
  362. {
  363. unsigned int len;
  364. int err;
  365. rt2800_write_tx_data(entry, txdesc);
  366. /*
  367. * pad(1~3 bytes) is added after each 802.11 payload.
  368. * USB end pad(4 bytes) is added at each USB bulk out packet end.
  369. * TX frame format is :
  370. * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad |
  371. * |<------------- tx_pkt_len ------------->|
  372. */
  373. len = roundup(entry->skb->len, 4) + 4;
  374. err = skb_padto(entry->skb, len);
  375. if (unlikely(err)) {
  376. WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n");
  377. return;
  378. }
  379. entry->skb->len = len;
  380. }
  381. /*
  382. * TX data initialization
  383. */
  384. static int rt2800usb_get_tx_data_len(struct queue_entry *entry)
  385. {
  386. return entry->skb->len;
  387. }
  388. /*
  389. * TX control handlers
  390. */
  391. static void rt2800usb_work_txdone(struct work_struct *work)
  392. {
  393. struct rt2x00_dev *rt2x00dev =
  394. container_of(work, struct rt2x00_dev, txdone_work);
  395. struct data_queue *queue;
  396. struct queue_entry *entry;
  397. rt2800_txdone(rt2x00dev);
  398. /*
  399. * Process any trailing TX status reports for IO failures,
  400. * we loop until we find the first non-IO error entry. This
  401. * can either be a frame which is free, is being uploaded,
  402. * or has completed the upload but didn't have an entry
  403. * in the TX_STAT_FIFO register yet.
  404. */
  405. tx_queue_for_each(rt2x00dev, queue) {
  406. while (!rt2x00queue_empty(queue)) {
  407. entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
  408. if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
  409. !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
  410. break;
  411. if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
  412. rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
  413. else if (rt2x00queue_status_timeout(entry))
  414. rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN);
  415. else
  416. break;
  417. }
  418. }
  419. /*
  420. * The hw may delay sending the packet after DMA complete
  421. * if the medium is busy, thus the TX_STA_FIFO entry is
  422. * also delayed -> use a timer to retrieve it.
  423. */
  424. if (rt2800usb_txstatus_pending(rt2x00dev))
  425. mod_timer(&rt2x00dev->txstatus_timer, jiffies + msecs_to_jiffies(2));
  426. }
  427. /*
  428. * RX control handlers
  429. */
  430. static void rt2800usb_fill_rxdone(struct queue_entry *entry,
  431. struct rxdone_entry_desc *rxdesc)
  432. {
  433. struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
  434. __le32 *rxi = (__le32 *)entry->skb->data;
  435. __le32 *rxd;
  436. u32 word;
  437. int rx_pkt_len;
  438. /*
  439. * Copy descriptor to the skbdesc->desc buffer, making it safe from
  440. * moving of frame data in rt2x00usb.
  441. */
  442. memcpy(skbdesc->desc, rxi, skbdesc->desc_len);
  443. /*
  444. * RX frame format is :
  445. * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad |
  446. * |<------------ rx_pkt_len -------------->|
  447. */
  448. rt2x00_desc_read(rxi, 0, &word);
  449. rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN);
  450. /*
  451. * Remove the RXINFO structure from the sbk.
  452. */
  453. skb_pull(entry->skb, RXINFO_DESC_SIZE);
  454. /*
  455. * FIXME: we need to check for rx_pkt_len validity
  456. */
  457. rxd = (__le32 *)(entry->skb->data + rx_pkt_len);
  458. /*
  459. * It is now safe to read the descriptor on all architectures.
  460. */
  461. rt2x00_desc_read(rxd, 0, &word);
  462. if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR))
  463. rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
  464. rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR);
  465. if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) {
  466. /*
  467. * Hardware has stripped IV/EIV data from 802.11 frame during
  468. * decryption. Unfortunately the descriptor doesn't contain
  469. * any fields with the EIV/IV data either, so they can't
  470. * be restored by rt2x00lib.
  471. */
  472. rxdesc->flags |= RX_FLAG_IV_STRIPPED;
  473. /*
  474. * The hardware has already checked the Michael Mic and has
  475. * stripped it from the frame. Signal this to mac80211.
  476. */
  477. rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
  478. if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
  479. rxdesc->flags |= RX_FLAG_DECRYPTED;
  480. else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
  481. rxdesc->flags |= RX_FLAG_MMIC_ERROR;
  482. }
  483. if (rt2x00_get_field32(word, RXD_W0_MY_BSS))
  484. rxdesc->dev_flags |= RXDONE_MY_BSS;
  485. if (rt2x00_get_field32(word, RXD_W0_L2PAD))
  486. rxdesc->dev_flags |= RXDONE_L2PAD;
  487. /*
  488. * Remove RXD descriptor from end of buffer.
  489. */
  490. skb_trim(entry->skb, rx_pkt_len);
  491. /*
  492. * Process the RXWI structure.
  493. */
  494. rt2800_process_rxwi(entry, rxdesc);
  495. }
  496. /*
  497. * Device probe functions.
  498. */
  499. static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
  500. {
  501. if (rt2800_efuse_detect(rt2x00dev))
  502. rt2800_read_eeprom_efuse(rt2x00dev);
  503. else
  504. rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
  505. EEPROM_SIZE);
  506. return rt2800_validate_eeprom(rt2x00dev);
  507. }
  508. static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
  509. {
  510. int retval;
  511. /*
  512. * Allocate eeprom data.
  513. */
  514. retval = rt2800usb_validate_eeprom(rt2x00dev);
  515. if (retval)
  516. return retval;
  517. retval = rt2800_init_eeprom(rt2x00dev);
  518. if (retval)
  519. return retval;
  520. /*
  521. * Initialize hw specifications.
  522. */
  523. retval = rt2800_probe_hw_mode(rt2x00dev);
  524. if (retval)
  525. return retval;
  526. /*
  527. * This device has multiple filters for control frames
  528. * and has a separate filter for PS Poll frames.
  529. */
  530. __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
  531. __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
  532. /*
  533. * This device requires firmware.
  534. */
  535. __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
  536. __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
  537. if (!modparam_nohwcrypt)
  538. __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
  539. __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
  540. __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
  541. __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
  542. __set_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags);
  543. setup_timer(&rt2x00dev->txstatus_timer,
  544. rt2800usb_tx_sta_fifo_timeout,
  545. (unsigned long) rt2x00dev);
  546. /*
  547. * Set the rssi offset.
  548. */
  549. rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET;
  550. /*
  551. * Overwrite TX done handler
  552. */
  553. PREPARE_WORK(&rt2x00dev->txdone_work, rt2800usb_work_txdone);
  554. return 0;
  555. }
  556. static const struct ieee80211_ops rt2800usb_mac80211_ops = {
  557. .tx = rt2x00mac_tx,
  558. .start = rt2x00mac_start,
  559. .stop = rt2x00mac_stop,
  560. .add_interface = rt2x00mac_add_interface,
  561. .remove_interface = rt2x00mac_remove_interface,
  562. .config = rt2x00mac_config,
  563. .configure_filter = rt2x00mac_configure_filter,
  564. .set_tim = rt2x00mac_set_tim,
  565. .set_key = rt2x00mac_set_key,
  566. .sw_scan_start = rt2x00mac_sw_scan_start,
  567. .sw_scan_complete = rt2x00mac_sw_scan_complete,
  568. .get_stats = rt2x00mac_get_stats,
  569. .get_tkip_seq = rt2800_get_tkip_seq,
  570. .set_rts_threshold = rt2800_set_rts_threshold,
  571. .bss_info_changed = rt2x00mac_bss_info_changed,
  572. .conf_tx = rt2800_conf_tx,
  573. .get_tsf = rt2800_get_tsf,
  574. .rfkill_poll = rt2x00mac_rfkill_poll,
  575. .ampdu_action = rt2800_ampdu_action,
  576. .flush = rt2x00mac_flush,
  577. .get_survey = rt2800_get_survey,
  578. .get_ringparam = rt2x00mac_get_ringparam,
  579. };
  580. static const struct rt2800_ops rt2800usb_rt2800_ops = {
  581. .register_read = rt2x00usb_register_read,
  582. .register_read_lock = rt2x00usb_register_read_lock,
  583. .register_write = rt2x00usb_register_write,
  584. .register_write_lock = rt2x00usb_register_write_lock,
  585. .register_multiread = rt2x00usb_register_multiread,
  586. .register_multiwrite = rt2x00usb_register_multiwrite,
  587. .regbusy_read = rt2x00usb_regbusy_read,
  588. .drv_write_firmware = rt2800usb_write_firmware,
  589. .drv_init_registers = rt2800usb_init_registers,
  590. .drv_get_txwi = rt2800usb_get_txwi,
  591. };
  592. static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
  593. .probe_hw = rt2800usb_probe_hw,
  594. .get_firmware_name = rt2800usb_get_firmware_name,
  595. .check_firmware = rt2800_check_firmware,
  596. .load_firmware = rt2800_load_firmware,
  597. .initialize = rt2x00usb_initialize,
  598. .uninitialize = rt2x00usb_uninitialize,
  599. .clear_entry = rt2x00usb_clear_entry,
  600. .set_device_state = rt2800usb_set_device_state,
  601. .rfkill_poll = rt2800_rfkill_poll,
  602. .link_stats = rt2800_link_stats,
  603. .reset_tuner = rt2800_reset_tuner,
  604. .link_tuner = rt2800_link_tuner,
  605. .gain_calibration = rt2800_gain_calibration,
  606. .watchdog = rt2800usb_watchdog,
  607. .start_queue = rt2800usb_start_queue,
  608. .kick_queue = rt2x00usb_kick_queue,
  609. .stop_queue = rt2800usb_stop_queue,
  610. .flush_queue = rt2x00usb_flush_queue,
  611. .tx_dma_done = rt2800usb_tx_dma_done,
  612. .write_tx_desc = rt2800usb_write_tx_desc,
  613. .write_tx_data = rt2800usb_write_tx_data,
  614. .write_beacon = rt2800_write_beacon,
  615. .clear_beacon = rt2800_clear_beacon,
  616. .get_tx_data_len = rt2800usb_get_tx_data_len,
  617. .fill_rxdone = rt2800usb_fill_rxdone,
  618. .config_shared_key = rt2800_config_shared_key,
  619. .config_pairwise_key = rt2800_config_pairwise_key,
  620. .config_filter = rt2800_config_filter,
  621. .config_intf = rt2800_config_intf,
  622. .config_erp = rt2800_config_erp,
  623. .config_ant = rt2800_config_ant,
  624. .config = rt2800_config,
  625. };
  626. static const struct data_queue_desc rt2800usb_queue_rx = {
  627. .entry_num = 128,
  628. .data_size = AGGREGATION_SIZE,
  629. .desc_size = RXINFO_DESC_SIZE + RXWI_DESC_SIZE,
  630. .priv_size = sizeof(struct queue_entry_priv_usb),
  631. };
  632. static const struct data_queue_desc rt2800usb_queue_tx = {
  633. .entry_num = 64,
  634. .data_size = AGGREGATION_SIZE,
  635. .desc_size = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
  636. .priv_size = sizeof(struct queue_entry_priv_usb),
  637. };
  638. static const struct data_queue_desc rt2800usb_queue_bcn = {
  639. .entry_num = 8,
  640. .data_size = MGMT_FRAME_SIZE,
  641. .desc_size = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
  642. .priv_size = sizeof(struct queue_entry_priv_usb),
  643. };
  644. static const struct rt2x00_ops rt2800usb_ops = {
  645. .name = KBUILD_MODNAME,
  646. .max_sta_intf = 1,
  647. .max_ap_intf = 8,
  648. .eeprom_size = EEPROM_SIZE,
  649. .rf_size = RF_SIZE,
  650. .tx_queues = NUM_TX_QUEUES,
  651. .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
  652. .rx = &rt2800usb_queue_rx,
  653. .tx = &rt2800usb_queue_tx,
  654. .bcn = &rt2800usb_queue_bcn,
  655. .lib = &rt2800usb_rt2x00_ops,
  656. .drv = &rt2800usb_rt2800_ops,
  657. .hw = &rt2800usb_mac80211_ops,
  658. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  659. .debugfs = &rt2800_rt2x00debug,
  660. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  661. };
  662. /*
  663. * rt2800usb module information.
  664. */
  665. static struct usb_device_id rt2800usb_device_table[] = {
  666. /* Abocom */
  667. { USB_DEVICE(0x07b8, 0x2870) },
  668. { USB_DEVICE(0x07b8, 0x2770) },
  669. { USB_DEVICE(0x07b8, 0x3070) },
  670. { USB_DEVICE(0x07b8, 0x3071) },
  671. { USB_DEVICE(0x07b8, 0x3072) },
  672. { USB_DEVICE(0x1482, 0x3c09) },
  673. /* AirTies */
  674. { USB_DEVICE(0x1eda, 0x2012) },
  675. { USB_DEVICE(0x1eda, 0x2310) },
  676. /* Allwin */
  677. { USB_DEVICE(0x8516, 0x2070) },
  678. { USB_DEVICE(0x8516, 0x2770) },
  679. { USB_DEVICE(0x8516, 0x2870) },
  680. { USB_DEVICE(0x8516, 0x3070) },
  681. { USB_DEVICE(0x8516, 0x3071) },
  682. { USB_DEVICE(0x8516, 0x3072) },
  683. /* Alpha Networks */
  684. { USB_DEVICE(0x14b2, 0x3c06) },
  685. { USB_DEVICE(0x14b2, 0x3c07) },
  686. { USB_DEVICE(0x14b2, 0x3c09) },
  687. { USB_DEVICE(0x14b2, 0x3c12) },
  688. { USB_DEVICE(0x14b2, 0x3c23) },
  689. { USB_DEVICE(0x14b2, 0x3c25) },
  690. { USB_DEVICE(0x14b2, 0x3c27) },
  691. { USB_DEVICE(0x14b2, 0x3c28) },
  692. { USB_DEVICE(0x14b2, 0x3c2c) },
  693. /* Amit */
  694. { USB_DEVICE(0x15c5, 0x0008) },
  695. /* Askey */
  696. { USB_DEVICE(0x1690, 0x0740) },
  697. /* ASUS */
  698. { USB_DEVICE(0x0b05, 0x1731) },
  699. { USB_DEVICE(0x0b05, 0x1732) },
  700. { USB_DEVICE(0x0b05, 0x1742) },
  701. { USB_DEVICE(0x0b05, 0x1784) },
  702. { USB_DEVICE(0x1761, 0x0b05) },
  703. /* AzureWave */
  704. { USB_DEVICE(0x13d3, 0x3247) },
  705. { USB_DEVICE(0x13d3, 0x3273) },
  706. { USB_DEVICE(0x13d3, 0x3305) },
  707. { USB_DEVICE(0x13d3, 0x3307) },
  708. { USB_DEVICE(0x13d3, 0x3321) },
  709. /* Belkin */
  710. { USB_DEVICE(0x050d, 0x8053) },
  711. { USB_DEVICE(0x050d, 0x805c) },
  712. { USB_DEVICE(0x050d, 0x815c) },
  713. { USB_DEVICE(0x050d, 0x825a) },
  714. { USB_DEVICE(0x050d, 0x825b) },
  715. { USB_DEVICE(0x050d, 0x935a) },
  716. { USB_DEVICE(0x050d, 0x935b) },
  717. /* Buffalo */
  718. { USB_DEVICE(0x0411, 0x00e8) },
  719. { USB_DEVICE(0x0411, 0x0158) },
  720. { USB_DEVICE(0x0411, 0x015d) },
  721. { USB_DEVICE(0x0411, 0x016f) },
  722. { USB_DEVICE(0x0411, 0x01a2) },
  723. /* Corega */
  724. { USB_DEVICE(0x07aa, 0x002f) },
  725. { USB_DEVICE(0x07aa, 0x003c) },
  726. { USB_DEVICE(0x07aa, 0x003f) },
  727. { USB_DEVICE(0x18c5, 0x0012) },
  728. /* D-Link */
  729. { USB_DEVICE(0x07d1, 0x3c09) },
  730. { USB_DEVICE(0x07d1, 0x3c0a) },
  731. { USB_DEVICE(0x07d1, 0x3c0d) },
  732. { USB_DEVICE(0x07d1, 0x3c0e) },
  733. { USB_DEVICE(0x07d1, 0x3c0f) },
  734. { USB_DEVICE(0x07d1, 0x3c11) },
  735. { USB_DEVICE(0x07d1, 0x3c13) },
  736. { USB_DEVICE(0x07d1, 0x3c15) },
  737. { USB_DEVICE(0x07d1, 0x3c16) },
  738. { USB_DEVICE(0x2001, 0x3c1b) },
  739. /* Draytek */
  740. { USB_DEVICE(0x07fa, 0x7712) },
  741. /* Edimax */
  742. { USB_DEVICE(0x7392, 0x7711) },
  743. { USB_DEVICE(0x7392, 0x7717) },
  744. { USB_DEVICE(0x7392, 0x7718) },
  745. { USB_DEVICE(0x7392, 0x7722) },
  746. /* Encore */
  747. { USB_DEVICE(0x203d, 0x1480) },
  748. { USB_DEVICE(0x203d, 0x14a9) },
  749. /* EnGenius */
  750. { USB_DEVICE(0x1740, 0x9701) },
  751. { USB_DEVICE(0x1740, 0x9702) },
  752. { USB_DEVICE(0x1740, 0x9703) },
  753. { USB_DEVICE(0x1740, 0x9705) },
  754. { USB_DEVICE(0x1740, 0x9706) },
  755. { USB_DEVICE(0x1740, 0x9707) },
  756. { USB_DEVICE(0x1740, 0x9708) },
  757. { USB_DEVICE(0x1740, 0x9709) },
  758. /* Gemtek */
  759. { USB_DEVICE(0x15a9, 0x0012) },
  760. /* Gigabyte */
  761. { USB_DEVICE(0x1044, 0x800b) },
  762. { USB_DEVICE(0x1044, 0x800d) },
  763. /* Hawking */
  764. { USB_DEVICE(0x0e66, 0x0001) },
  765. { USB_DEVICE(0x0e66, 0x0003) },
  766. { USB_DEVICE(0x0e66, 0x0009) },
  767. { USB_DEVICE(0x0e66, 0x000b) },
  768. { USB_DEVICE(0x0e66, 0x0013) },
  769. { USB_DEVICE(0x0e66, 0x0017) },
  770. { USB_DEVICE(0x0e66, 0x0018) },
  771. /* I-O DATA */
  772. { USB_DEVICE(0x04bb, 0x0945) },
  773. { USB_DEVICE(0x04bb, 0x0947) },
  774. { USB_DEVICE(0x04bb, 0x0948) },
  775. /* Linksys */
  776. { USB_DEVICE(0x13b1, 0x0031) },
  777. { USB_DEVICE(0x1737, 0x0070) },
  778. { USB_DEVICE(0x1737, 0x0071) },
  779. { USB_DEVICE(0x1737, 0x0077) },
  780. { USB_DEVICE(0x1737, 0x0078) },
  781. /* Logitec */
  782. { USB_DEVICE(0x0789, 0x0162) },
  783. { USB_DEVICE(0x0789, 0x0163) },
  784. { USB_DEVICE(0x0789, 0x0164) },
  785. { USB_DEVICE(0x0789, 0x0166) },
  786. /* Motorola */
  787. { USB_DEVICE(0x100d, 0x9031) },
  788. /* MSI */
  789. { USB_DEVICE(0x0db0, 0x3820) },
  790. { USB_DEVICE(0x0db0, 0x3821) },
  791. { USB_DEVICE(0x0db0, 0x3822) },
  792. { USB_DEVICE(0x0db0, 0x3870) },
  793. { USB_DEVICE(0x0db0, 0x3871) },
  794. { USB_DEVICE(0x0db0, 0x6899) },
  795. { USB_DEVICE(0x0db0, 0x821a) },
  796. { USB_DEVICE(0x0db0, 0x822a) },
  797. { USB_DEVICE(0x0db0, 0x822b) },
  798. { USB_DEVICE(0x0db0, 0x822c) },
  799. { USB_DEVICE(0x0db0, 0x870a) },
  800. { USB_DEVICE(0x0db0, 0x871a) },
  801. { USB_DEVICE(0x0db0, 0x871b) },
  802. { USB_DEVICE(0x0db0, 0x871c) },
  803. { USB_DEVICE(0x0db0, 0x899a) },
  804. /* Ovislink */
  805. { USB_DEVICE(0x1b75, 0x3071) },
  806. { USB_DEVICE(0x1b75, 0x3072) },
  807. /* Para */
  808. { USB_DEVICE(0x20b8, 0x8888) },
  809. /* Pegatron */
  810. { USB_DEVICE(0x1d4d, 0x0002) },
  811. { USB_DEVICE(0x1d4d, 0x000c) },
  812. { USB_DEVICE(0x1d4d, 0x000e) },
  813. { USB_DEVICE(0x1d4d, 0x0011) },
  814. /* Philips */
  815. { USB_DEVICE(0x0471, 0x200f) },
  816. /* Planex */
  817. { USB_DEVICE(0x2019, 0xab25) },
  818. { USB_DEVICE(0x2019, 0xed06) },
  819. /* Quanta */
  820. { USB_DEVICE(0x1a32, 0x0304) },
  821. /* Ralink */
  822. { USB_DEVICE(0x148f, 0x2070) },
  823. { USB_DEVICE(0x148f, 0x2770) },
  824. { USB_DEVICE(0x148f, 0x2870) },
  825. { USB_DEVICE(0x148f, 0x3070) },
  826. { USB_DEVICE(0x148f, 0x3071) },
  827. { USB_DEVICE(0x148f, 0x3072) },
  828. /* Samsung */
  829. { USB_DEVICE(0x04e8, 0x2018) },
  830. /* Siemens */
  831. { USB_DEVICE(0x129b, 0x1828) },
  832. /* Sitecom */
  833. { USB_DEVICE(0x0df6, 0x0017) },
  834. { USB_DEVICE(0x0df6, 0x002b) },
  835. { USB_DEVICE(0x0df6, 0x002c) },
  836. { USB_DEVICE(0x0df6, 0x002d) },
  837. { USB_DEVICE(0x0df6, 0x0039) },
  838. { USB_DEVICE(0x0df6, 0x003b) },
  839. { USB_DEVICE(0x0df6, 0x003d) },
  840. { USB_DEVICE(0x0df6, 0x003e) },
  841. { USB_DEVICE(0x0df6, 0x003f) },
  842. { USB_DEVICE(0x0df6, 0x0040) },
  843. { USB_DEVICE(0x0df6, 0x0042) },
  844. { USB_DEVICE(0x0df6, 0x0047) },
  845. { USB_DEVICE(0x0df6, 0x0048) },
  846. { USB_DEVICE(0x0df6, 0x0051) },
  847. { USB_DEVICE(0x0df6, 0x005f) },
  848. { USB_DEVICE(0x0df6, 0x0060) },
  849. /* SMC */
  850. { USB_DEVICE(0x083a, 0x6618) },
  851. { USB_DEVICE(0x083a, 0x7511) },
  852. { USB_DEVICE(0x083a, 0x7512) },
  853. { USB_DEVICE(0x083a, 0x7522) },
  854. { USB_DEVICE(0x083a, 0x8522) },
  855. { USB_DEVICE(0x083a, 0xa618) },
  856. { USB_DEVICE(0x083a, 0xa701) },
  857. { USB_DEVICE(0x083a, 0xa702) },
  858. { USB_DEVICE(0x083a, 0xa703) },
  859. { USB_DEVICE(0x083a, 0xb522) },
  860. /* Sparklan */
  861. { USB_DEVICE(0x15a9, 0x0006) },
  862. /* Sweex */
  863. { USB_DEVICE(0x177f, 0x0153) },
  864. { USB_DEVICE(0x177f, 0x0302) },
  865. { USB_DEVICE(0x177f, 0x0313) },
  866. /* U-Media */
  867. { USB_DEVICE(0x157e, 0x300e) },
  868. { USB_DEVICE(0x157e, 0x3013) },
  869. /* ZCOM */
  870. { USB_DEVICE(0x0cde, 0x0022) },
  871. { USB_DEVICE(0x0cde, 0x0025) },
  872. /* Zinwell */
  873. { USB_DEVICE(0x5a57, 0x0280) },
  874. { USB_DEVICE(0x5a57, 0x0282) },
  875. { USB_DEVICE(0x5a57, 0x0283) },
  876. { USB_DEVICE(0x5a57, 0x5257) },
  877. /* Zyxel */
  878. { USB_DEVICE(0x0586, 0x3416) },
  879. { USB_DEVICE(0x0586, 0x3418) },
  880. { USB_DEVICE(0x0586, 0x341e) },
  881. { USB_DEVICE(0x0586, 0x343e) },
  882. #ifdef CONFIG_RT2800USB_RT33XX
  883. /* Belkin */
  884. { USB_DEVICE(0x050d, 0x945b) },
  885. /* Ralink */
  886. { USB_DEVICE(0x148f, 0x3370) },
  887. { USB_DEVICE(0x148f, 0x8070) },
  888. /* Sitecom */
  889. { USB_DEVICE(0x0df6, 0x0050) },
  890. #endif
  891. #ifdef CONFIG_RT2800USB_RT35XX
  892. /* Allwin */
  893. { USB_DEVICE(0x8516, 0x3572) },
  894. /* Askey */
  895. { USB_DEVICE(0x1690, 0x0744) },
  896. /* Cisco */
  897. { USB_DEVICE(0x167b, 0x4001) },
  898. /* EnGenius */
  899. { USB_DEVICE(0x1740, 0x9801) },
  900. /* I-O DATA */
  901. { USB_DEVICE(0x04bb, 0x0944) },
  902. /* Linksys */
  903. { USB_DEVICE(0x13b1, 0x002f) },
  904. { USB_DEVICE(0x1737, 0x0079) },
  905. /* Ralink */
  906. { USB_DEVICE(0x148f, 0x3572) },
  907. /* Sitecom */
  908. { USB_DEVICE(0x0df6, 0x0041) },
  909. { USB_DEVICE(0x0df6, 0x0062) },
  910. /* Toshiba */
  911. { USB_DEVICE(0x0930, 0x0a07) },
  912. /* Zinwell */
  913. { USB_DEVICE(0x5a57, 0x0284) },
  914. #endif
  915. #ifdef CONFIG_RT2800USB_RT53XX
  916. /* Azurewave */
  917. { USB_DEVICE(0x13d3, 0x3329) },
  918. { USB_DEVICE(0x13d3, 0x3365) },
  919. /* Ralink */
  920. { USB_DEVICE(0x148f, 0x5370) },
  921. { USB_DEVICE(0x148f, 0x5372) },
  922. #endif
  923. #ifdef CONFIG_RT2800USB_UNKNOWN
  924. /*
  925. * Unclear what kind of devices these are (they aren't supported by the
  926. * vendor linux driver).
  927. */
  928. /* Abocom */
  929. { USB_DEVICE(0x07b8, 0x3073) },
  930. { USB_DEVICE(0x07b8, 0x3074) },
  931. /* Alpha Networks */
  932. { USB_DEVICE(0x14b2, 0x3c08) },
  933. { USB_DEVICE(0x14b2, 0x3c11) },
  934. /* Amigo */
  935. { USB_DEVICE(0x0e0b, 0x9031) },
  936. { USB_DEVICE(0x0e0b, 0x9041) },
  937. /* ASUS */
  938. { USB_DEVICE(0x0b05, 0x166a) },
  939. { USB_DEVICE(0x0b05, 0x1760) },
  940. { USB_DEVICE(0x0b05, 0x1761) },
  941. { USB_DEVICE(0x0b05, 0x1790) },
  942. { USB_DEVICE(0x0b05, 0x179d) },
  943. /* AzureWave */
  944. { USB_DEVICE(0x13d3, 0x3262) },
  945. { USB_DEVICE(0x13d3, 0x3284) },
  946. { USB_DEVICE(0x13d3, 0x3322) },
  947. /* Belkin */
  948. { USB_DEVICE(0x050d, 0x1003) },
  949. /* Buffalo */
  950. { USB_DEVICE(0x0411, 0x012e) },
  951. { USB_DEVICE(0x0411, 0x0148) },
  952. { USB_DEVICE(0x0411, 0x0150) },
  953. /* Corega */
  954. { USB_DEVICE(0x07aa, 0x0041) },
  955. { USB_DEVICE(0x07aa, 0x0042) },
  956. { USB_DEVICE(0x18c5, 0x0008) },
  957. /* D-Link */
  958. { USB_DEVICE(0x07d1, 0x3c0b) },
  959. { USB_DEVICE(0x07d1, 0x3c17) },
  960. { USB_DEVICE(0x2001, 0x3c17) },
  961. /* Edimax */
  962. { USB_DEVICE(0x7392, 0x4085) },
  963. /* Encore */
  964. { USB_DEVICE(0x203d, 0x14a1) },
  965. /* Fujitsu Stylistic 550 */
  966. { USB_DEVICE(0x1690, 0x0761) },
  967. /* Gemtek */
  968. { USB_DEVICE(0x15a9, 0x0010) },
  969. /* Gigabyte */
  970. { USB_DEVICE(0x1044, 0x800c) },
  971. /* Huawei */
  972. { USB_DEVICE(0x148f, 0xf101) },
  973. /* I-O DATA */
  974. { USB_DEVICE(0x04bb, 0x094b) },
  975. /* LevelOne */
  976. { USB_DEVICE(0x1740, 0x0605) },
  977. { USB_DEVICE(0x1740, 0x0615) },
  978. /* Logitec */
  979. { USB_DEVICE(0x0789, 0x0168) },
  980. { USB_DEVICE(0x0789, 0x0169) },
  981. /* Motorola */
  982. { USB_DEVICE(0x100d, 0x9032) },
  983. /* Pegatron */
  984. { USB_DEVICE(0x05a6, 0x0101) },
  985. { USB_DEVICE(0x1d4d, 0x0010) },
  986. /* Planex */
  987. { USB_DEVICE(0x2019, 0x5201) },
  988. { USB_DEVICE(0x2019, 0xab24) },
  989. /* Qcom */
  990. { USB_DEVICE(0x18e8, 0x6259) },
  991. /* RadioShack */
  992. { USB_DEVICE(0x08b9, 0x1197) },
  993. /* Sitecom */
  994. { USB_DEVICE(0x0df6, 0x003c) },
  995. { USB_DEVICE(0x0df6, 0x004a) },
  996. { USB_DEVICE(0x0df6, 0x004d) },
  997. { USB_DEVICE(0x0df6, 0x0053) },
  998. /* SMC */
  999. { USB_DEVICE(0x083a, 0xa512) },
  1000. { USB_DEVICE(0x083a, 0xc522) },
  1001. { USB_DEVICE(0x083a, 0xd522) },
  1002. { USB_DEVICE(0x083a, 0xf511) },
  1003. /* Zyxel */
  1004. { USB_DEVICE(0x0586, 0x341a) },
  1005. #endif
  1006. { 0, }
  1007. };
  1008. MODULE_AUTHOR(DRV_PROJECT);
  1009. MODULE_VERSION(DRV_VERSION);
  1010. MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver.");
  1011. MODULE_SUPPORTED_DEVICE("Ralink RT2870 USB chipset based cards");
  1012. MODULE_DEVICE_TABLE(usb, rt2800usb_device_table);
  1013. MODULE_FIRMWARE(FIRMWARE_RT2870);
  1014. MODULE_LICENSE("GPL");
  1015. static int rt2800usb_probe(struct usb_interface *usb_intf,
  1016. const struct usb_device_id *id)
  1017. {
  1018. return rt2x00usb_probe(usb_intf, &rt2800usb_ops);
  1019. }
  1020. static struct usb_driver rt2800usb_driver = {
  1021. .name = KBUILD_MODNAME,
  1022. .id_table = rt2800usb_device_table,
  1023. .probe = rt2800usb_probe,
  1024. .disconnect = rt2x00usb_disconnect,
  1025. .suspend = rt2x00usb_suspend,
  1026. .resume = rt2x00usb_resume,
  1027. };
  1028. static int __init rt2800usb_init(void)
  1029. {
  1030. return usb_register(&rt2800usb_driver);
  1031. }
  1032. static void __exit rt2800usb_exit(void)
  1033. {
  1034. usb_deregister(&rt2800usb_driver);
  1035. }
  1036. module_init(rt2800usb_init);
  1037. module_exit(rt2800usb_exit);