2 Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
3 <http://rt2x00.serialmonkey.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Abstract: rt2800usb device specific routines.
24 Supported chipsets: RT2800U.
27 #include <linux/crc-ccitt.h>
28 #include <linux/delay.h>
29 #include <linux/etherdevice.h>
30 #include <linux/init.h>
31 #include <linux/kernel.h>
32 #include <linux/module.h>
33 #include <linux/usb.h>
36 #include "rt2x00usb.h"
37 #include "rt2800lib.h"
39 #include "rt2800usb.h"
42 * Allow hardware encryption to be disabled.
44 static int modparam_nohwcrypt = 1;
45 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
46 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
51 static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
53 return FIRMWARE_RT2870;
56 static bool rt2800usb_check_crc(const u8 *data, const size_t len)
62 * The last 2 bytes in the firmware array are the crc checksum itself,
63 * this means that we should never pass those 2 bytes to the crc
66 fw_crc = (data[len - 2] << 8 | data[len - 1]);
69 * Use the crc ccitt algorithm.
70 * This will return the same value as the legacy driver which
71 * used bit ordering reversion on the both the firmware bytes
72 * before input input as well as on the final output.
73 * Obviously using crc ccitt directly is much more efficient.
75 crc = crc_ccitt(~0, data, len - 2);
78 * There is a small difference between the crc-itu-t + bitrev and
79 * the crc-ccitt crc calculation. In the latter method the 2 bytes
80 * will be swapped, use swab16 to convert the crc to the correct
88 static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev,
89 const u8 *data, const size_t len)
91 u16 chipset = (rt2x00_rev(&rt2x00dev->chip) >> 16) & 0xffff;
96 * There are 2 variations of the rt2870 firmware.
99 * Note that (b) contains 2 seperate firmware blobs of 4k
100 * within the file. The first blob is the same firmware as (a),
101 * but the second blob is for the additional chipsets.
103 if (len != 4096 && len != 8192)
104 return FW_BAD_LENGTH;
107 * Check if we need the upper 4kb firmware data or not.
110 (chipset != 0x2860) &&
111 (chipset != 0x2872) &&
113 return FW_BAD_VERSION;
116 * 8kb firmware files must be checked as if it were
117 * 2 seperate firmware files.
119 while (offset < len) {
120 if (!rt2800usb_check_crc(data + offset, 4096))
129 static int rt2800usb_load_firmware(struct rt2x00_dev *rt2x00dev,
130 const u8 *data, const size_t len)
137 u16 chipset = (rt2x00_rev(&rt2x00dev->chip) >> 16) & 0xffff;
140 * Check which section of the firmware we need.
142 if ((chipset == 0x2860) ||
143 (chipset == 0x2872) ||
144 (chipset == 0x3070)) {
153 * Wait for stable hardware.
155 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
156 rt2800_register_read(rt2x00dev, MAC_CSR0, ®);
157 if (reg && reg != ~0)
162 if (i == REGISTER_BUSY_COUNT) {
163 ERROR(rt2x00dev, "Unstable hardware.\n");
168 * Write firmware to device.
170 rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
171 USB_VENDOR_REQUEST_OUT,
173 data + offset, length,
174 REGISTER_TIMEOUT32(length));
176 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
177 rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
180 * Send firmware request to device to load firmware,
181 * we need to specify a long timeout time.
183 status = rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE,
184 0, USB_MODE_FIRMWARE,
185 REGISTER_TIMEOUT_FIRMWARE);
187 ERROR(rt2x00dev, "Failed to write Firmware to device.\n");
192 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
195 * Send signal to firmware during boot time.
197 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0);
199 if ((chipset == 0x3070) ||
200 (chipset == 0x3071) ||
201 (chipset == 0x3572)) {
203 rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0);
208 * Wait for device to stabilize.
210 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
211 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, ®);
212 if (rt2x00_get_field32(reg, PBF_SYS_CTRL_READY))
217 if (i == REGISTER_BUSY_COUNT) {
218 ERROR(rt2x00dev, "PBF system register not ready.\n");
223 * Initialize firmware.
225 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
226 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
233 * Device state switch handlers.
235 static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
236 enum dev_state state)
240 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
241 rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX,
242 (state == STATE_RADIO_RX_ON) ||
243 (state == STATE_RADIO_RX_ON_LINK));
244 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
247 static int rt2800usb_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
252 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
253 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®);
254 if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) &&
255 !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY))
261 ERROR(rt2x00dev, "WPDMA TX/RX busy, aborting.\n");
265 static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
271 * Initialize all registers.
273 if (unlikely(rt2800usb_wait_wpdma_ready(rt2x00dev) ||
274 rt2800_init_registers(rt2x00dev) ||
275 rt2800_init_bbp(rt2x00dev) ||
276 rt2800_init_rfcsr(rt2x00dev)))
279 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
280 rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1);
281 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
285 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®);
286 rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
287 rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1);
288 rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1);
289 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
292 rt2800_register_read(rt2x00dev, USB_DMA_CFG, ®);
293 rt2x00_set_field32(®, USB_DMA_CFG_PHY_CLEAR, 0);
294 /* Don't use bulk in aggregation when working with USB 1.1 */
295 rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_EN,
296 (rt2x00dev->rx->usb_maxpacket == 512));
297 rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128);
299 * Total room for RX frames in kilobytes, PBF might still exceed
300 * this limit so reduce the number to prevent errors.
302 rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_LIMIT,
303 ((RX_ENTRIES * DATA_FRAME_SIZE) / 1024) - 3);
304 rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_EN, 1);
305 rt2x00_set_field32(®, USB_DMA_CFG_TX_BULK_EN, 1);
306 rt2800_register_write(rt2x00dev, USB_DMA_CFG, reg);
308 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
309 rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1);
310 rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1);
311 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
314 * Initialize LED control
316 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word);
317 rt2800_mcu_request(rt2x00dev, MCU_LED_1, 0xff,
318 word & 0xff, (word >> 8) & 0xff);
320 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED2, &word);
321 rt2800_mcu_request(rt2x00dev, MCU_LED_2, 0xff,
322 word & 0xff, (word >> 8) & 0xff);
324 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED3, &word);
325 rt2800_mcu_request(rt2x00dev, MCU_LED_3, 0xff,
326 word & 0xff, (word >> 8) & 0xff);
331 static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev)
335 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®);
336 rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
337 rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
338 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
340 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0);
341 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0);
342 rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0);
344 /* Wait for DMA, ignore error */
345 rt2800usb_wait_wpdma_ready(rt2x00dev);
347 rt2x00usb_disable_radio(rt2x00dev);
350 static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev,
351 enum dev_state state)
353 if (state == STATE_AWAKE)
354 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
356 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 2);
361 static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
362 enum dev_state state)
369 * Before the radio can be enabled, the device first has
370 * to be woken up. After that it needs a bit of time
371 * to be fully awake and then the radio can be enabled.
373 rt2800usb_set_state(rt2x00dev, STATE_AWAKE);
375 retval = rt2800usb_enable_radio(rt2x00dev);
377 case STATE_RADIO_OFF:
379 * After the radio has been disabled, the device should
380 * be put to sleep for powersaving.
382 rt2800usb_disable_radio(rt2x00dev);
383 rt2800usb_set_state(rt2x00dev, STATE_SLEEP);
385 case STATE_RADIO_RX_ON:
386 case STATE_RADIO_RX_ON_LINK:
387 case STATE_RADIO_RX_OFF:
388 case STATE_RADIO_RX_OFF_LINK:
389 rt2800usb_toggle_rx(rt2x00dev, state);
391 case STATE_RADIO_IRQ_ON:
392 case STATE_RADIO_IRQ_OFF:
393 /* No support, but no error either */
395 case STATE_DEEP_SLEEP:
399 retval = rt2800usb_set_state(rt2x00dev, state);
406 if (unlikely(retval))
407 ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n",
414 * TX descriptor initialization
416 static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
418 struct txentry_desc *txdesc)
420 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
421 __le32 *txi = skbdesc->desc;
422 __le32 *txwi = &txi[TXINFO_DESC_SIZE / sizeof(__le32)];
426 * Initialize TX Info descriptor
428 rt2x00_desc_read(txwi, 0, &word);
429 rt2x00_set_field32(&word, TXWI_W0_FRAG,
430 test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
431 rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0);
432 rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0);
433 rt2x00_set_field32(&word, TXWI_W0_TS,
434 test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
435 rt2x00_set_field32(&word, TXWI_W0_AMPDU,
436 test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags));
437 rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density);
438 rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs);
439 rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs);
440 rt2x00_set_field32(&word, TXWI_W0_BW,
441 test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags));
442 rt2x00_set_field32(&word, TXWI_W0_SHORT_GI,
443 test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags));
444 rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc);
445 rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode);
446 rt2x00_desc_write(txwi, 0, word);
448 rt2x00_desc_read(txwi, 1, &word);
449 rt2x00_set_field32(&word, TXWI_W1_ACK,
450 test_bit(ENTRY_TXD_ACK, &txdesc->flags));
451 rt2x00_set_field32(&word, TXWI_W1_NSEQ,
452 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
453 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
454 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
455 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
456 txdesc->key_idx : 0xff);
457 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
458 skb->len - txdesc->l2pad);
459 rt2x00_set_field32(&word, TXWI_W1_PACKETID,
460 skbdesc->entry->queue->qid + 1);
461 rt2x00_desc_write(txwi, 1, word);
464 * Always write 0 to IV/EIV fields, hardware will insert the IV
465 * from the IVEIV register when TXINFO_W0_WIV is set to 0.
466 * When TXINFO_W0_WIV is set to 1 it will use the IV data
467 * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
468 * crypto entry in the registers should be used to encrypt the frame.
470 _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
471 _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
474 * Initialize TX descriptor
476 rt2x00_desc_read(txi, 0, &word);
477 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
478 skb->len + TXWI_DESC_SIZE);
479 rt2x00_set_field32(&word, TXINFO_W0_WIV,
480 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
481 rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
482 rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
483 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);
484 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST,
485 test_bit(ENTRY_TXD_BURST, &txdesc->flags));
486 rt2x00_desc_write(txi, 0, word);
490 * TX data initialization
492 static void rt2800usb_write_beacon(struct queue_entry *entry)
494 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
495 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
496 unsigned int beacon_base;
500 * Add the descriptor in front of the skb.
502 skb_push(entry->skb, entry->queue->desc_size);
503 memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len);
504 skbdesc->desc = entry->skb->data;
507 * Disable beaconing while we are reloading the beacon data,
508 * otherwise we might be sending out invalid data.
510 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®);
511 rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0);
512 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
515 * Write entire beacon with descriptor to register.
517 beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
518 rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
519 USB_VENDOR_REQUEST_OUT, beacon_base,
520 entry->skb->data, entry->skb->len,
521 REGISTER_TIMEOUT32(entry->skb->len));
524 * Clean up the beacon skb.
526 dev_kfree_skb(entry->skb);
530 static int rt2800usb_get_tx_data_len(struct queue_entry *entry)
535 * The length _must_ include 4 bytes padding,
536 * it should always be multiple of 4,
537 * but it must _not_ be a multiple of the USB packet size.
539 length = roundup(entry->skb->len + 4, 4);
540 length += (4 * !(length % entry->queue->usb_maxpacket));
545 static void rt2800usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
546 const enum data_queue_qid queue)
550 if (queue != QID_BEACON) {
551 rt2x00usb_kick_tx_queue(rt2x00dev, queue);
555 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®);
556 if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) {
557 rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1);
558 rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1);
559 rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1);
560 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
565 * RX control handlers
567 static void rt2800usb_fill_rxdone(struct queue_entry *entry,
568 struct rxdone_entry_desc *rxdesc)
570 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
571 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
572 __le32 *rxd = (__le32 *)entry->skb->data;
581 * Copy descriptor to the skbdesc->desc buffer, making it safe from
582 * moving of frame data in rt2x00usb.
584 memcpy(skbdesc->desc, rxd, skbdesc->desc_len);
585 rxd = (__le32 *)skbdesc->desc;
586 rxwi = &rxd[RXINFO_DESC_SIZE / sizeof(__le32)];
589 * It is now safe to read the descriptor on all architectures.
591 rt2x00_desc_read(rxd, 0, &rxd0);
592 rt2x00_desc_read(rxwi, 0, &rxwi0);
593 rt2x00_desc_read(rxwi, 1, &rxwi1);
594 rt2x00_desc_read(rxwi, 2, &rxwi2);
595 rt2x00_desc_read(rxwi, 3, &rxwi3);
597 if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR))
598 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
600 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) {
601 rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF);
602 rxdesc->cipher_status =
603 rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR);
606 if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) {
608 * Hardware has stripped IV/EIV data from 802.11 frame during
609 * decryption. Unfortunately the descriptor doesn't contain
610 * any fields with the EIV/IV data either, so they can't
611 * be restored by rt2x00lib.
613 rxdesc->flags |= RX_FLAG_IV_STRIPPED;
615 if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
616 rxdesc->flags |= RX_FLAG_DECRYPTED;
617 else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
618 rxdesc->flags |= RX_FLAG_MMIC_ERROR;
621 if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS))
622 rxdesc->dev_flags |= RXDONE_MY_BSS;
624 if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) {
625 rxdesc->dev_flags |= RXDONE_L2PAD;
626 skbdesc->flags |= SKBDESC_L2_PADDED;
629 if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
630 rxdesc->flags |= RX_FLAG_SHORT_GI;
632 if (rt2x00_get_field32(rxwi1, RXWI_W1_BW))
633 rxdesc->flags |= RX_FLAG_40MHZ;
636 * Detect RX rate, always use MCS as signal type.
638 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS;
639 rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE);
640 rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS);
643 * Mask of 0x8 bit to remove the short preamble flag.
645 if (rxdesc->rate_mode == RATE_MODE_CCK)
646 rxdesc->signal &= ~0x8;
649 (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) +
650 rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2;
653 (rt2x00_get_field32(rxwi3, RXWI_W3_SNR0) +
654 rt2x00_get_field32(rxwi3, RXWI_W3_SNR1)) / 2;
656 rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
659 * Remove RXWI descriptor from start of buffer.
661 skb_pull(entry->skb, skbdesc->desc_len);
662 skb_trim(entry->skb, rxdesc->size);
666 * Device probe functions.
668 static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
670 rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE);
672 return rt2800_validate_eeprom(rt2x00dev);
676 * RF value list for rt2870
677 * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750)
679 static const struct rf_channel rf_vals[] = {
680 { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b },
681 { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f },
682 { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b },
683 { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f },
684 { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b },
685 { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f },
686 { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b },
687 { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f },
688 { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b },
689 { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f },
690 { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b },
691 { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f },
692 { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b },
693 { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 },
695 /* 802.11 UNI / HyperLan 2 */
696 { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 },
697 { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 },
698 { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 },
699 { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 },
700 { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b },
701 { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b },
702 { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 },
703 { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 },
704 { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b },
705 { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 },
706 { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 },
707 { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 },
709 /* 802.11 HyperLan 2 */
710 { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 },
711 { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 },
712 { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 },
713 { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 },
714 { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 },
715 { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b },
716 { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 },
717 { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 },
718 { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 },
719 { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 },
720 { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b },
721 { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 },
722 { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b },
723 { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 },
724 { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b },
725 { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 },
728 { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 },
729 { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 },
730 { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f },
731 { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f },
732 { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 },
733 { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 },
734 { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 },
735 { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f },
736 { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 },
737 { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 },
738 { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f },
741 { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b },
742 { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 },
743 { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b },
744 { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 },
745 { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 },
746 { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b },
747 { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 },
751 * RF value list for rt3070
754 static const struct rf_channel rf_vals_3070[] = {
771 static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
773 struct hw_mode_spec *spec = &rt2x00dev->spec;
774 struct channel_info *info;
781 * Initialize all hw fields.
783 rt2x00dev->hw->flags =
784 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
785 IEEE80211_HW_SIGNAL_DBM |
786 IEEE80211_HW_SUPPORTS_PS |
787 IEEE80211_HW_PS_NULLFUNC_STACK;
788 rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
790 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
791 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
792 rt2x00_eeprom_addr(rt2x00dev,
795 rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
798 * Initialize hw_mode information.
800 spec->supported_bands = SUPPORT_BAND_2GHZ;
801 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
803 if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
804 rt2x00_rf(&rt2x00dev->chip, RF2720)) {
805 spec->num_channels = 14;
806 spec->channels = rf_vals;
807 } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
808 rt2x00_rf(&rt2x00dev->chip, RF2750)) {
809 spec->supported_bands |= SUPPORT_BAND_5GHZ;
810 spec->num_channels = ARRAY_SIZE(rf_vals);
811 spec->channels = rf_vals;
812 } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
813 rt2x00_rf(&rt2x00dev->chip, RF2020)) {
814 spec->num_channels = ARRAY_SIZE(rf_vals_3070);
815 spec->channels = rf_vals_3070;
819 * Initialize HT information.
821 spec->ht.ht_supported = true;
823 IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
824 IEEE80211_HT_CAP_GRN_FLD |
825 IEEE80211_HT_CAP_SGI_20 |
826 IEEE80211_HT_CAP_SGI_40 |
827 IEEE80211_HT_CAP_TX_STBC |
828 IEEE80211_HT_CAP_RX_STBC |
829 IEEE80211_HT_CAP_PSMP_SUPPORT;
830 spec->ht.ampdu_factor = 3;
831 spec->ht.ampdu_density = 4;
832 spec->ht.mcs.tx_params =
833 IEEE80211_HT_MCS_TX_DEFINED |
834 IEEE80211_HT_MCS_TX_RX_DIFF |
835 ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) <<
836 IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
838 switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
840 spec->ht.mcs.rx_mask[2] = 0xff;
842 spec->ht.mcs.rx_mask[1] = 0xff;
844 spec->ht.mcs.rx_mask[0] = 0xff;
845 spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */
850 * Create channel information array
852 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
856 spec->channels_info = info;
858 tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
859 tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
861 for (i = 0; i < 14; i++) {
862 info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]);
863 info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]);
866 if (spec->num_channels > 14) {
867 tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
868 tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
870 for (i = 14; i < spec->num_channels; i++) {
871 info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]);
872 info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]);
879 static const struct rt2800_ops rt2800usb_rt2800_ops = {
880 .register_read = rt2x00usb_register_read,
881 .register_write = rt2x00usb_register_write,
882 .register_write_lock = rt2x00usb_register_write_lock,
884 .register_multiread = rt2x00usb_register_multiread,
885 .register_multiwrite = rt2x00usb_register_multiwrite,
887 .regbusy_read = rt2x00usb_regbusy_read,
890 static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
894 rt2x00dev->priv = (void *)&rt2800usb_rt2800_ops;
897 * Allocate eeprom data.
899 retval = rt2800usb_validate_eeprom(rt2x00dev);
903 retval = rt2800_init_eeprom(rt2x00dev);
908 * Initialize hw specifications.
910 retval = rt2800usb_probe_hw_mode(rt2x00dev);
915 * This device has multiple filters for control frames
916 * and has a separate filter for PS Poll frames.
918 __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
919 __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
922 * This device requires firmware.
924 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
925 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
926 if (!modparam_nohwcrypt)
927 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
930 * Set the rssi offset.
932 rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET;
937 static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
938 .probe_hw = rt2800usb_probe_hw,
939 .get_firmware_name = rt2800usb_get_firmware_name,
940 .check_firmware = rt2800usb_check_firmware,
941 .load_firmware = rt2800usb_load_firmware,
942 .initialize = rt2x00usb_initialize,
943 .uninitialize = rt2x00usb_uninitialize,
944 .clear_entry = rt2x00usb_clear_entry,
945 .set_device_state = rt2800usb_set_device_state,
946 .rfkill_poll = rt2800_rfkill_poll,
947 .link_stats = rt2800_link_stats,
948 .reset_tuner = rt2800_reset_tuner,
949 .link_tuner = rt2800_link_tuner,
950 .write_tx_desc = rt2800usb_write_tx_desc,
951 .write_tx_data = rt2x00usb_write_tx_data,
952 .write_beacon = rt2800usb_write_beacon,
953 .get_tx_data_len = rt2800usb_get_tx_data_len,
954 .kick_tx_queue = rt2800usb_kick_tx_queue,
955 .kill_tx_queue = rt2x00usb_kill_tx_queue,
956 .fill_rxdone = rt2800usb_fill_rxdone,
957 .config_shared_key = rt2800_config_shared_key,
958 .config_pairwise_key = rt2800_config_pairwise_key,
959 .config_filter = rt2800_config_filter,
960 .config_intf = rt2800_config_intf,
961 .config_erp = rt2800_config_erp,
962 .config_ant = rt2800_config_ant,
963 .config = rt2800_config,
966 static const struct data_queue_desc rt2800usb_queue_rx = {
967 .entry_num = RX_ENTRIES,
968 .data_size = AGGREGATION_SIZE,
969 .desc_size = RXINFO_DESC_SIZE + RXWI_DESC_SIZE,
970 .priv_size = sizeof(struct queue_entry_priv_usb),
973 static const struct data_queue_desc rt2800usb_queue_tx = {
974 .entry_num = TX_ENTRIES,
975 .data_size = AGGREGATION_SIZE,
976 .desc_size = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
977 .priv_size = sizeof(struct queue_entry_priv_usb),
980 static const struct data_queue_desc rt2800usb_queue_bcn = {
981 .entry_num = 8 * BEACON_ENTRIES,
982 .data_size = MGMT_FRAME_SIZE,
983 .desc_size = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
984 .priv_size = sizeof(struct queue_entry_priv_usb),
987 static const struct rt2x00_ops rt2800usb_ops = {
988 .name = KBUILD_MODNAME,
991 .eeprom_size = EEPROM_SIZE,
993 .tx_queues = NUM_TX_QUEUES,
994 .rx = &rt2800usb_queue_rx,
995 .tx = &rt2800usb_queue_tx,
996 .bcn = &rt2800usb_queue_bcn,
997 .lib = &rt2800usb_rt2x00_ops,
998 .hw = &rt2800_mac80211_ops,
999 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
1000 .debugfs = &rt2800_rt2x00debug,
1001 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
1005 * rt2800usb module information.
1007 static struct usb_device_id rt2800usb_device_table[] = {
1009 { USB_DEVICE(0x07b8, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) },
1010 { USB_DEVICE(0x07b8, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) },
1011 { USB_DEVICE(0x07b8, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) },
1012 { USB_DEVICE(0x07b8, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) },
1013 { USB_DEVICE(0x07b8, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) },
1014 { USB_DEVICE(0x1482, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
1016 { USB_DEVICE(0x1eda, 0x2310), USB_DEVICE_DATA(&rt2800usb_ops) },
1018 { USB_DEVICE(0x0e0b, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) },
1019 { USB_DEVICE(0x0e0b, 0x9041), USB_DEVICE_DATA(&rt2800usb_ops) },
1021 { USB_DEVICE(0x15c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) },
1023 { USB_DEVICE(0x0b05, 0x1731), USB_DEVICE_DATA(&rt2800usb_ops) },
1024 { USB_DEVICE(0x0b05, 0x1732), USB_DEVICE_DATA(&rt2800usb_ops) },
1025 { USB_DEVICE(0x0b05, 0x1742), USB_DEVICE_DATA(&rt2800usb_ops) },
1026 { USB_DEVICE(0x0b05, 0x1760), USB_DEVICE_DATA(&rt2800usb_ops) },
1027 { USB_DEVICE(0x0b05, 0x1761), USB_DEVICE_DATA(&rt2800usb_ops) },
1029 { USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) },
1030 { USB_DEVICE(0x13d3, 0x3262), USB_DEVICE_DATA(&rt2800usb_ops) },
1031 { USB_DEVICE(0x13d3, 0x3273), USB_DEVICE_DATA(&rt2800usb_ops) },
1032 { USB_DEVICE(0x13d3, 0x3284), USB_DEVICE_DATA(&rt2800usb_ops) },
1034 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
1035 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
1036 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) },
1037 { USB_DEVICE(0x050d, 0x825a), USB_DEVICE_DATA(&rt2800usb_ops) },
1039 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) },
1040 { USB_DEVICE(0x0411, 0x012e), USB_DEVICE_DATA(&rt2800usb_ops) },
1042 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
1043 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
1044 { USB_DEVICE(0x14b2, 0x3c08), USB_DEVICE_DATA(&rt2800usb_ops) },
1045 { USB_DEVICE(0x14b2, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
1046 { USB_DEVICE(0x14b2, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) },
1047 { USB_DEVICE(0x14b2, 0x3c12), USB_DEVICE_DATA(&rt2800usb_ops) },
1048 { USB_DEVICE(0x14b2, 0x3c23), USB_DEVICE_DATA(&rt2800usb_ops) },
1049 { USB_DEVICE(0x14b2, 0x3c25), USB_DEVICE_DATA(&rt2800usb_ops) },
1050 { USB_DEVICE(0x14b2, 0x3c27), USB_DEVICE_DATA(&rt2800usb_ops) },
1051 { USB_DEVICE(0x14b2, 0x3c28), USB_DEVICE_DATA(&rt2800usb_ops) },
1053 { USB_DEVICE(0x07aa, 0x002f), USB_DEVICE_DATA(&rt2800usb_ops) },
1054 { USB_DEVICE(0x07aa, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) },
1055 { USB_DEVICE(0x07aa, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) },
1056 { USB_DEVICE(0x18c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) },
1057 { USB_DEVICE(0x18c5, 0x0012), USB_DEVICE_DATA(&rt2800usb_ops) },
1059 { USB_DEVICE(0x07d1, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
1060 { USB_DEVICE(0x07d1, 0x3c0a), USB_DEVICE_DATA(&rt2800usb_ops) },
1061 { USB_DEVICE(0x07d1, 0x3c0b), USB_DEVICE_DATA(&rt2800usb_ops) },
1062 { USB_DEVICE(0x07d1, 0x3c0d), USB_DEVICE_DATA(&rt2800usb_ops) },
1063 { USB_DEVICE(0x07d1, 0x3c0e), USB_DEVICE_DATA(&rt2800usb_ops) },
1064 { USB_DEVICE(0x07d1, 0x3c0f), USB_DEVICE_DATA(&rt2800usb_ops) },
1065 { USB_DEVICE(0x07d1, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) },
1066 { USB_DEVICE(0x07d1, 0x3c13), USB_DEVICE_DATA(&rt2800usb_ops) },
1068 { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) },
1069 { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) },
1070 { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) },
1072 { USB_DEVICE(0x203d, 0x1480), USB_DEVICE_DATA(&rt2800usb_ops) },
1074 { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) },
1075 { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) },
1076 { USB_DEVICE(0x1740, 0x9703), USB_DEVICE_DATA(&rt2800usb_ops) },
1077 { USB_DEVICE(0x1740, 0x9705), USB_DEVICE_DATA(&rt2800usb_ops) },
1078 { USB_DEVICE(0x1740, 0x9706), USB_DEVICE_DATA(&rt2800usb_ops) },
1079 { USB_DEVICE(0x1740, 0x9801), USB_DEVICE_DATA(&rt2800usb_ops) },
1081 { USB_DEVICE(0x15a9, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) },
1083 { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) },
1084 { USB_DEVICE(0x1044, 0x800c), USB_DEVICE_DATA(&rt2800usb_ops) },
1085 { USB_DEVICE(0x1044, 0x800d), USB_DEVICE_DATA(&rt2800usb_ops) },
1087 { USB_DEVICE(0x0e66, 0x0001), USB_DEVICE_DATA(&rt2800usb_ops) },
1088 { USB_DEVICE(0x0e66, 0x0003), USB_DEVICE_DATA(&rt2800usb_ops) },
1089 { USB_DEVICE(0x0e66, 0x0009), USB_DEVICE_DATA(&rt2800usb_ops) },
1090 { USB_DEVICE(0x0e66, 0x000b), USB_DEVICE_DATA(&rt2800usb_ops) },
1092 { USB_DEVICE(0x04bb, 0x0945), USB_DEVICE_DATA(&rt2800usb_ops) },
1094 { USB_DEVICE(0x1740, 0x0605), USB_DEVICE_DATA(&rt2800usb_ops) },
1095 { USB_DEVICE(0x1740, 0x0615), USB_DEVICE_DATA(&rt2800usb_ops) },
1097 { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) },
1098 { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) },
1099 { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) },
1101 { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) },
1102 { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) },
1103 { USB_DEVICE(0x0789, 0x0164), USB_DEVICE_DATA(&rt2800usb_ops) },
1105 { USB_DEVICE(0x100d, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) },
1106 { USB_DEVICE(0x100d, 0x9032), USB_DEVICE_DATA(&rt2800usb_ops) },
1108 { USB_DEVICE(0x1b75, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) },
1110 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) },
1111 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) },
1112 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) },
1114 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
1116 { USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) },
1117 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) },
1118 { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) },
1120 { USB_DEVICE(0x18e8, 0x6259), USB_DEVICE_DATA(&rt2800usb_ops) },
1122 { USB_DEVICE(0x1a32, 0x0304), USB_DEVICE_DATA(&rt2800usb_ops) },
1124 { USB_DEVICE(0x0db0, 0x3820), USB_DEVICE_DATA(&rt2800usb_ops) },
1125 { USB_DEVICE(0x0db0, 0x6899), USB_DEVICE_DATA(&rt2800usb_ops) },
1126 { USB_DEVICE(0x148f, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) },
1127 { USB_DEVICE(0x148f, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) },
1128 { USB_DEVICE(0x148f, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) },
1129 { USB_DEVICE(0x148f, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) },
1130 { USB_DEVICE(0x148f, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) },
1131 { USB_DEVICE(0x148f, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) },
1132 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) },
1134 { USB_DEVICE(0x04e8, 0x2018), USB_DEVICE_DATA(&rt2800usb_ops) },
1136 { USB_DEVICE(0x129b, 0x1828), USB_DEVICE_DATA(&rt2800usb_ops) },
1138 { USB_DEVICE(0x0df6, 0x0017), USB_DEVICE_DATA(&rt2800usb_ops) },
1139 { USB_DEVICE(0x0df6, 0x002b), USB_DEVICE_DATA(&rt2800usb_ops) },
1140 { USB_DEVICE(0x0df6, 0x002c), USB_DEVICE_DATA(&rt2800usb_ops) },
1141 { USB_DEVICE(0x0df6, 0x002d), USB_DEVICE_DATA(&rt2800usb_ops) },
1142 { USB_DEVICE(0x0df6, 0x0039), USB_DEVICE_DATA(&rt2800usb_ops) },
1143 { USB_DEVICE(0x0df6, 0x003b), USB_DEVICE_DATA(&rt2800usb_ops) },
1144 { USB_DEVICE(0x0df6, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) },
1145 { USB_DEVICE(0x0df6, 0x003d), USB_DEVICE_DATA(&rt2800usb_ops) },
1146 { USB_DEVICE(0x0df6, 0x003e), USB_DEVICE_DATA(&rt2800usb_ops) },
1147 { USB_DEVICE(0x0df6, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) },
1148 { USB_DEVICE(0x0df6, 0x0040), USB_DEVICE_DATA(&rt2800usb_ops) },
1149 { USB_DEVICE(0x0df6, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) },
1151 { USB_DEVICE(0x083a, 0x6618), USB_DEVICE_DATA(&rt2800usb_ops) },
1152 { USB_DEVICE(0x083a, 0x7511), USB_DEVICE_DATA(&rt2800usb_ops) },
1153 { USB_DEVICE(0x083a, 0x7512), USB_DEVICE_DATA(&rt2800usb_ops) },
1154 { USB_DEVICE(0x083a, 0x7522), USB_DEVICE_DATA(&rt2800usb_ops) },
1155 { USB_DEVICE(0x083a, 0x8522), USB_DEVICE_DATA(&rt2800usb_ops) },
1156 { USB_DEVICE(0x083a, 0xa512), USB_DEVICE_DATA(&rt2800usb_ops) },
1157 { USB_DEVICE(0x083a, 0xa618), USB_DEVICE_DATA(&rt2800usb_ops) },
1158 { USB_DEVICE(0x083a, 0xb522), USB_DEVICE_DATA(&rt2800usb_ops) },
1159 { USB_DEVICE(0x083a, 0xc522), USB_DEVICE_DATA(&rt2800usb_ops) },
1161 { USB_DEVICE(0x15a9, 0x0006), USB_DEVICE_DATA(&rt2800usb_ops) },
1163 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) },
1164 { USB_DEVICE(0x177f, 0x0302), USB_DEVICE_DATA(&rt2800usb_ops) },
1165 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) },
1167 { USB_DEVICE(0x157e, 0x300e), USB_DEVICE_DATA(&rt2800usb_ops) },
1169 { USB_DEVICE(0x0cde, 0x0022), USB_DEVICE_DATA(&rt2800usb_ops) },
1170 { USB_DEVICE(0x0cde, 0x0025), USB_DEVICE_DATA(&rt2800usb_ops) },
1172 { USB_DEVICE(0x5a57, 0x0280), USB_DEVICE_DATA(&rt2800usb_ops) },
1173 { USB_DEVICE(0x5a57, 0x0282), USB_DEVICE_DATA(&rt2800usb_ops) },
1174 { USB_DEVICE(0x5a57, 0x0283), USB_DEVICE_DATA(&rt2800usb_ops) },
1175 { USB_DEVICE(0x5a57, 0x5257), USB_DEVICE_DATA(&rt2800usb_ops) },
1177 { USB_DEVICE(0x0586, 0x3416), USB_DEVICE_DATA(&rt2800usb_ops) },
1178 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) },
1182 MODULE_AUTHOR(DRV_PROJECT);
1183 MODULE_VERSION(DRV_VERSION);
1184 MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver.");
1185 MODULE_SUPPORTED_DEVICE("Ralink RT2870 USB chipset based cards");
1186 MODULE_DEVICE_TABLE(usb, rt2800usb_device_table);
1187 MODULE_FIRMWARE(FIRMWARE_RT2870);
1188 MODULE_LICENSE("GPL");
1190 static struct usb_driver rt2800usb_driver = {
1191 .name = KBUILD_MODNAME,
1192 .id_table = rt2800usb_device_table,
1193 .probe = rt2x00usb_probe,
1194 .disconnect = rt2x00usb_disconnect,
1195 .suspend = rt2x00usb_suspend,
1196 .resume = rt2x00usb_resume,
1199 static int __init rt2800usb_init(void)
1201 return usb_register(&rt2800usb_driver);
1204 static void __exit rt2800usb_exit(void)
1206 usb_deregister(&rt2800usb_driver);
1209 module_init(rt2800usb_init);
1210 module_exit(rt2800usb_exit);