2 Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
3 Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
4 Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
5 Copyright (C) 2009 Luis Correia <luis.f.correia@gmail.com>
6 Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
7 Copyright (C) 2009 Mark Asselstine <asselsm@gmail.com>
8 Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
9 Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
10 <http://rt2x00.serialmonkey.com>
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the
24 Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 Abstract: rt2800pci device specific routines.
31 Supported chipsets: RT2800E & RT2800ED.
34 #include <linux/delay.h>
35 #include <linux/etherdevice.h>
36 #include <linux/init.h>
37 #include <linux/kernel.h>
38 #include <linux/module.h>
39 #include <linux/pci.h>
40 #include <linux/platform_device.h>
41 #include <linux/eeprom_93cx6.h>
44 #include "rt2x00mmio.h"
45 #include "rt2x00pci.h"
46 #include "rt2x00soc.h"
47 #include "rt2800lib.h"
48 #include "rt2800mmio.h"
50 #include "rt2800pci.h"
53 * Allow hardware encryption to be disabled.
55 static bool modparam_nohwcrypt
= false;
56 module_param_named(nohwcrypt
, modparam_nohwcrypt
, bool, S_IRUGO
);
57 MODULE_PARM_DESC(nohwcrypt
, "Disable hardware encryption.");
59 static bool rt2800pci_hwcrypt_disabled(struct rt2x00_dev
*rt2x00dev
)
61 return modparam_nohwcrypt
;
64 static void rt2800pci_mcu_status(struct rt2x00_dev
*rt2x00dev
, const u8 token
)
70 * SOC devices don't support MCU requests.
72 if (rt2x00_is_soc(rt2x00dev
))
75 for (i
= 0; i
< 200; i
++) {
76 rt2x00mmio_register_read(rt2x00dev
, H2M_MAILBOX_CID
, ®
);
78 if ((rt2x00_get_field32(reg
, H2M_MAILBOX_CID_CMD0
) == token
) ||
79 (rt2x00_get_field32(reg
, H2M_MAILBOX_CID_CMD1
) == token
) ||
80 (rt2x00_get_field32(reg
, H2M_MAILBOX_CID_CMD2
) == token
) ||
81 (rt2x00_get_field32(reg
, H2M_MAILBOX_CID_CMD3
) == token
))
84 udelay(REGISTER_BUSY_DELAY
);
88 rt2x00_err(rt2x00dev
, "MCU request failed, no response from hardware\n");
90 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_STATUS
, ~0);
91 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_CID
, ~0);
94 #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
95 static int rt2800pci_read_eeprom_soc(struct rt2x00_dev
*rt2x00dev
)
97 void __iomem
*base_addr
= ioremap(0x1F040000, EEPROM_SIZE
);
102 memcpy_fromio(rt2x00dev
->eeprom
, base_addr
, EEPROM_SIZE
);
108 static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev
*rt2x00dev
)
112 #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */
115 static void rt2800pci_eepromregister_read(struct eeprom_93cx6
*eeprom
)
117 struct rt2x00_dev
*rt2x00dev
= eeprom
->data
;
120 rt2x00mmio_register_read(rt2x00dev
, E2PROM_CSR
, ®
);
122 eeprom
->reg_data_in
= !!rt2x00_get_field32(reg
, E2PROM_CSR_DATA_IN
);
123 eeprom
->reg_data_out
= !!rt2x00_get_field32(reg
, E2PROM_CSR_DATA_OUT
);
124 eeprom
->reg_data_clock
=
125 !!rt2x00_get_field32(reg
, E2PROM_CSR_DATA_CLOCK
);
126 eeprom
->reg_chip_select
=
127 !!rt2x00_get_field32(reg
, E2PROM_CSR_CHIP_SELECT
);
130 static void rt2800pci_eepromregister_write(struct eeprom_93cx6
*eeprom
)
132 struct rt2x00_dev
*rt2x00dev
= eeprom
->data
;
135 rt2x00_set_field32(®
, E2PROM_CSR_DATA_IN
, !!eeprom
->reg_data_in
);
136 rt2x00_set_field32(®
, E2PROM_CSR_DATA_OUT
, !!eeprom
->reg_data_out
);
137 rt2x00_set_field32(®
, E2PROM_CSR_DATA_CLOCK
,
138 !!eeprom
->reg_data_clock
);
139 rt2x00_set_field32(®
, E2PROM_CSR_CHIP_SELECT
,
140 !!eeprom
->reg_chip_select
);
142 rt2x00mmio_register_write(rt2x00dev
, E2PROM_CSR
, reg
);
145 static int rt2800pci_read_eeprom_pci(struct rt2x00_dev
*rt2x00dev
)
147 struct eeprom_93cx6 eeprom
;
150 rt2x00mmio_register_read(rt2x00dev
, E2PROM_CSR
, ®
);
152 eeprom
.data
= rt2x00dev
;
153 eeprom
.register_read
= rt2800pci_eepromregister_read
;
154 eeprom
.register_write
= rt2800pci_eepromregister_write
;
155 switch (rt2x00_get_field32(reg
, E2PROM_CSR_TYPE
))
158 eeprom
.width
= PCI_EEPROM_WIDTH_93C46
;
161 eeprom
.width
= PCI_EEPROM_WIDTH_93C66
;
164 eeprom
.width
= PCI_EEPROM_WIDTH_93C86
;
167 eeprom
.reg_data_in
= 0;
168 eeprom
.reg_data_out
= 0;
169 eeprom
.reg_data_clock
= 0;
170 eeprom
.reg_chip_select
= 0;
172 eeprom_93cx6_multiread(&eeprom
, EEPROM_BASE
, rt2x00dev
->eeprom
,
173 EEPROM_SIZE
/ sizeof(u16
));
178 static int rt2800pci_efuse_detect(struct rt2x00_dev
*rt2x00dev
)
180 return rt2800_efuse_detect(rt2x00dev
);
183 static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev
*rt2x00dev
)
185 return rt2800_read_eeprom_efuse(rt2x00dev
);
188 static inline int rt2800pci_read_eeprom_pci(struct rt2x00_dev
*rt2x00dev
)
193 static inline int rt2800pci_efuse_detect(struct rt2x00_dev
*rt2x00dev
)
198 static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev
*rt2x00dev
)
202 #endif /* CONFIG_PCI */
207 static char *rt2800pci_get_firmware_name(struct rt2x00_dev
*rt2x00dev
)
210 * Chip rt3290 use specific 4KB firmware named rt3290.bin.
212 if (rt2x00_rt(rt2x00dev
, RT3290
))
213 return FIRMWARE_RT3290
;
215 return FIRMWARE_RT2860
;
218 static int rt2800pci_write_firmware(struct rt2x00_dev
*rt2x00dev
,
219 const u8
*data
, const size_t len
)
224 * enable Host program ram write selection
227 rt2x00_set_field32(®
, PBF_SYS_CTRL_HOST_RAM_WRITE
, 1);
228 rt2x00mmio_register_write(rt2x00dev
, PBF_SYS_CTRL
, reg
);
231 * Write firmware to device.
233 rt2x00mmio_register_multiwrite(rt2x00dev
, FIRMWARE_IMAGE_BASE
,
236 rt2x00mmio_register_write(rt2x00dev
, PBF_SYS_CTRL
, 0x00000);
237 rt2x00mmio_register_write(rt2x00dev
, PBF_SYS_CTRL
, 0x00001);
239 rt2x00mmio_register_write(rt2x00dev
, H2M_BBP_AGENT
, 0);
240 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_CSR
, 0);
246 * Device state switch handlers.
248 static int rt2800pci_enable_radio(struct rt2x00_dev
*rt2x00dev
)
252 /* Wait for DMA, ignore error until we initialize queues. */
253 rt2800_wait_wpdma_ready(rt2x00dev
);
255 if (unlikely(rt2800mmio_init_queues(rt2x00dev
)))
258 retval
= rt2800_enable_radio(rt2x00dev
);
262 /* After resume MCU_BOOT_SIGNAL will trash these. */
263 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_STATUS
, ~0);
264 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_CID
, ~0);
266 rt2800_mcu_request(rt2x00dev
, MCU_SLEEP
, TOKEN_RADIO_OFF
, 0xff, 0x02);
267 rt2800pci_mcu_status(rt2x00dev
, TOKEN_RADIO_OFF
);
269 rt2800_mcu_request(rt2x00dev
, MCU_WAKEUP
, TOKEN_WAKEUP
, 0, 0);
270 rt2800pci_mcu_status(rt2x00dev
, TOKEN_WAKEUP
);
275 static void rt2800pci_disable_radio(struct rt2x00_dev
*rt2x00dev
)
277 if (rt2x00_is_soc(rt2x00dev
)) {
278 rt2800_disable_radio(rt2x00dev
);
279 rt2x00mmio_register_write(rt2x00dev
, PWR_PIN_CFG
, 0);
280 rt2x00mmio_register_write(rt2x00dev
, TX_PIN_CFG
, 0);
284 static int rt2800pci_set_state(struct rt2x00_dev
*rt2x00dev
,
285 enum dev_state state
)
287 if (state
== STATE_AWAKE
) {
288 rt2800_mcu_request(rt2x00dev
, MCU_WAKEUP
, TOKEN_WAKEUP
,
290 rt2800pci_mcu_status(rt2x00dev
, TOKEN_WAKEUP
);
291 } else if (state
== STATE_SLEEP
) {
292 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_STATUS
,
294 rt2x00mmio_register_write(rt2x00dev
, H2M_MAILBOX_CID
,
296 rt2800_mcu_request(rt2x00dev
, MCU_SLEEP
, TOKEN_SLEEP
,
303 static int rt2800pci_set_device_state(struct rt2x00_dev
*rt2x00dev
,
304 enum dev_state state
)
310 retval
= rt2800pci_enable_radio(rt2x00dev
);
312 case STATE_RADIO_OFF
:
314 * After the radio has been disabled, the device should
315 * be put to sleep for powersaving.
317 rt2800pci_disable_radio(rt2x00dev
);
318 rt2800pci_set_state(rt2x00dev
, STATE_SLEEP
);
320 case STATE_RADIO_IRQ_ON
:
321 case STATE_RADIO_IRQ_OFF
:
322 rt2800mmio_toggle_irq(rt2x00dev
, state
);
324 case STATE_DEEP_SLEEP
:
328 retval
= rt2800pci_set_state(rt2x00dev
, state
);
335 if (unlikely(retval
))
336 rt2x00_err(rt2x00dev
, "Device failed to enter state %d (%d)\n",
343 * Device probe functions.
345 static int rt2800pci_read_eeprom(struct rt2x00_dev
*rt2x00dev
)
349 if (rt2x00_is_soc(rt2x00dev
))
350 retval
= rt2800pci_read_eeprom_soc(rt2x00dev
);
351 else if (rt2800pci_efuse_detect(rt2x00dev
))
352 retval
= rt2800pci_read_eeprom_efuse(rt2x00dev
);
354 retval
= rt2800pci_read_eeprom_pci(rt2x00dev
);
360 static const struct ieee80211_ops rt2800pci_mac80211_ops
= {
362 .start
= rt2x00mac_start
,
363 .stop
= rt2x00mac_stop
,
364 .add_interface
= rt2x00mac_add_interface
,
365 .remove_interface
= rt2x00mac_remove_interface
,
366 .config
= rt2x00mac_config
,
367 .configure_filter
= rt2x00mac_configure_filter
,
368 .set_key
= rt2x00mac_set_key
,
369 .sw_scan_start
= rt2x00mac_sw_scan_start
,
370 .sw_scan_complete
= rt2x00mac_sw_scan_complete
,
371 .get_stats
= rt2x00mac_get_stats
,
372 .get_tkip_seq
= rt2800_get_tkip_seq
,
373 .set_rts_threshold
= rt2800_set_rts_threshold
,
374 .sta_add
= rt2x00mac_sta_add
,
375 .sta_remove
= rt2x00mac_sta_remove
,
376 .bss_info_changed
= rt2x00mac_bss_info_changed
,
377 .conf_tx
= rt2800_conf_tx
,
378 .get_tsf
= rt2800_get_tsf
,
379 .rfkill_poll
= rt2x00mac_rfkill_poll
,
380 .ampdu_action
= rt2800_ampdu_action
,
381 .flush
= rt2x00mac_flush
,
382 .get_survey
= rt2800_get_survey
,
383 .get_ringparam
= rt2x00mac_get_ringparam
,
384 .tx_frames_pending
= rt2x00mac_tx_frames_pending
,
387 static const struct rt2800_ops rt2800pci_rt2800_ops
= {
388 .register_read
= rt2x00mmio_register_read
,
389 .register_read_lock
= rt2x00mmio_register_read
, /* same for PCI */
390 .register_write
= rt2x00mmio_register_write
,
391 .register_write_lock
= rt2x00mmio_register_write
, /* same for PCI */
392 .register_multiread
= rt2x00mmio_register_multiread
,
393 .register_multiwrite
= rt2x00mmio_register_multiwrite
,
394 .regbusy_read
= rt2x00mmio_regbusy_read
,
395 .read_eeprom
= rt2800pci_read_eeprom
,
396 .hwcrypt_disabled
= rt2800pci_hwcrypt_disabled
,
397 .drv_write_firmware
= rt2800pci_write_firmware
,
398 .drv_init_registers
= rt2800mmio_init_registers
,
399 .drv_get_txwi
= rt2800mmio_get_txwi
,
402 static const struct rt2x00lib_ops rt2800pci_rt2x00_ops
= {
403 .irq_handler
= rt2800mmio_interrupt
,
404 .txstatus_tasklet
= rt2800mmio_txstatus_tasklet
,
405 .pretbtt_tasklet
= rt2800mmio_pretbtt_tasklet
,
406 .tbtt_tasklet
= rt2800mmio_tbtt_tasklet
,
407 .rxdone_tasklet
= rt2800mmio_rxdone_tasklet
,
408 .autowake_tasklet
= rt2800mmio_autowake_tasklet
,
409 .probe_hw
= rt2800_probe_hw
,
410 .get_firmware_name
= rt2800pci_get_firmware_name
,
411 .check_firmware
= rt2800_check_firmware
,
412 .load_firmware
= rt2800_load_firmware
,
413 .initialize
= rt2x00mmio_initialize
,
414 .uninitialize
= rt2x00mmio_uninitialize
,
415 .get_entry_state
= rt2800mmio_get_entry_state
,
416 .clear_entry
= rt2800mmio_clear_entry
,
417 .set_device_state
= rt2800pci_set_device_state
,
418 .rfkill_poll
= rt2800_rfkill_poll
,
419 .link_stats
= rt2800_link_stats
,
420 .reset_tuner
= rt2800_reset_tuner
,
421 .link_tuner
= rt2800_link_tuner
,
422 .gain_calibration
= rt2800_gain_calibration
,
423 .vco_calibration
= rt2800_vco_calibration
,
424 .start_queue
= rt2800mmio_start_queue
,
425 .kick_queue
= rt2800mmio_kick_queue
,
426 .stop_queue
= rt2800mmio_stop_queue
,
427 .flush_queue
= rt2x00mmio_flush_queue
,
428 .write_tx_desc
= rt2800mmio_write_tx_desc
,
429 .write_tx_data
= rt2800_write_tx_data
,
430 .write_beacon
= rt2800_write_beacon
,
431 .clear_beacon
= rt2800_clear_beacon
,
432 .fill_rxdone
= rt2800mmio_fill_rxdone
,
433 .config_shared_key
= rt2800_config_shared_key
,
434 .config_pairwise_key
= rt2800_config_pairwise_key
,
435 .config_filter
= rt2800_config_filter
,
436 .config_intf
= rt2800_config_intf
,
437 .config_erp
= rt2800_config_erp
,
438 .config_ant
= rt2800_config_ant
,
439 .config
= rt2800_config
,
440 .sta_add
= rt2800_sta_add
,
441 .sta_remove
= rt2800_sta_remove
,
444 static const struct rt2x00_ops rt2800pci_ops
= {
445 .name
= KBUILD_MODNAME
,
446 .drv_data_size
= sizeof(struct rt2800_drv_data
),
448 .eeprom_size
= EEPROM_SIZE
,
450 .tx_queues
= NUM_TX_QUEUES
,
451 .queue_init
= rt2800mmio_queue_init
,
452 .lib
= &rt2800pci_rt2x00_ops
,
453 .drv
= &rt2800pci_rt2800_ops
,
454 .hw
= &rt2800pci_mac80211_ops
,
455 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
456 .debugfs
= &rt2800_rt2x00debug
,
457 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
461 * RT2800pci module information.
463 static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table
) = {
464 { PCI_DEVICE(0x1814, 0x0601) },
465 { PCI_DEVICE(0x1814, 0x0681) },
466 { PCI_DEVICE(0x1814, 0x0701) },
467 { PCI_DEVICE(0x1814, 0x0781) },
468 { PCI_DEVICE(0x1814, 0x3090) },
469 { PCI_DEVICE(0x1814, 0x3091) },
470 { PCI_DEVICE(0x1814, 0x3092) },
471 { PCI_DEVICE(0x1432, 0x7708) },
472 { PCI_DEVICE(0x1432, 0x7727) },
473 { PCI_DEVICE(0x1432, 0x7728) },
474 { PCI_DEVICE(0x1432, 0x7738) },
475 { PCI_DEVICE(0x1432, 0x7748) },
476 { PCI_DEVICE(0x1432, 0x7758) },
477 { PCI_DEVICE(0x1432, 0x7768) },
478 { PCI_DEVICE(0x1462, 0x891a) },
479 { PCI_DEVICE(0x1a3b, 0x1059) },
480 #ifdef CONFIG_RT2800PCI_RT3290
481 { PCI_DEVICE(0x1814, 0x3290) },
483 #ifdef CONFIG_RT2800PCI_RT33XX
484 { PCI_DEVICE(0x1814, 0x3390) },
486 #ifdef CONFIG_RT2800PCI_RT35XX
487 { PCI_DEVICE(0x1432, 0x7711) },
488 { PCI_DEVICE(0x1432, 0x7722) },
489 { PCI_DEVICE(0x1814, 0x3060) },
490 { PCI_DEVICE(0x1814, 0x3062) },
491 { PCI_DEVICE(0x1814, 0x3562) },
492 { PCI_DEVICE(0x1814, 0x3592) },
493 { PCI_DEVICE(0x1814, 0x3593) },
494 { PCI_DEVICE(0x1814, 0x359f) },
496 #ifdef CONFIG_RT2800PCI_RT53XX
497 { PCI_DEVICE(0x1814, 0x5360) },
498 { PCI_DEVICE(0x1814, 0x5362) },
499 { PCI_DEVICE(0x1814, 0x5390) },
500 { PCI_DEVICE(0x1814, 0x5392) },
501 { PCI_DEVICE(0x1814, 0x539a) },
502 { PCI_DEVICE(0x1814, 0x539b) },
503 { PCI_DEVICE(0x1814, 0x539f) },
507 #endif /* CONFIG_PCI */
509 MODULE_AUTHOR(DRV_PROJECT
);
510 MODULE_VERSION(DRV_VERSION
);
511 MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver.");
512 MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards");
514 MODULE_FIRMWARE(FIRMWARE_RT2860
);
515 MODULE_DEVICE_TABLE(pci
, rt2800pci_device_table
);
516 #endif /* CONFIG_PCI */
517 MODULE_LICENSE("GPL");
519 #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
520 static const struct ieee80211_ops rt2800soc_mac80211_ops
= {
522 .start
= rt2x00mac_start
,
523 .stop
= rt2x00mac_stop
,
524 .add_interface
= rt2x00mac_add_interface
,
525 .remove_interface
= rt2x00mac_remove_interface
,
526 .config
= rt2x00mac_config
,
527 .configure_filter
= rt2x00mac_configure_filter
,
528 .set_key
= rt2x00mac_set_key
,
529 .sw_scan_start
= rt2x00mac_sw_scan_start
,
530 .sw_scan_complete
= rt2x00mac_sw_scan_complete
,
531 .get_stats
= rt2x00mac_get_stats
,
532 .get_tkip_seq
= rt2800_get_tkip_seq
,
533 .set_rts_threshold
= rt2800_set_rts_threshold
,
534 .sta_add
= rt2x00mac_sta_add
,
535 .sta_remove
= rt2x00mac_sta_remove
,
536 .bss_info_changed
= rt2x00mac_bss_info_changed
,
537 .conf_tx
= rt2800_conf_tx
,
538 .get_tsf
= rt2800_get_tsf
,
539 .rfkill_poll
= rt2x00mac_rfkill_poll
,
540 .ampdu_action
= rt2800_ampdu_action
,
541 .flush
= rt2x00mac_flush
,
542 .get_survey
= rt2800_get_survey
,
543 .get_ringparam
= rt2x00mac_get_ringparam
,
544 .tx_frames_pending
= rt2x00mac_tx_frames_pending
,
547 static const struct rt2800_ops rt2800soc_rt2800_ops
= {
548 .register_read
= rt2x00mmio_register_read
,
549 .register_read_lock
= rt2x00mmio_register_read
, /* same for SoCs */
550 .register_write
= rt2x00mmio_register_write
,
551 .register_write_lock
= rt2x00mmio_register_write
, /* same for SoCs */
552 .register_multiread
= rt2x00mmio_register_multiread
,
553 .register_multiwrite
= rt2x00mmio_register_multiwrite
,
554 .regbusy_read
= rt2x00mmio_regbusy_read
,
555 .read_eeprom
= rt2800pci_read_eeprom
,
556 .hwcrypt_disabled
= rt2800pci_hwcrypt_disabled
,
557 .drv_write_firmware
= rt2800pci_write_firmware
,
558 .drv_init_registers
= rt2800mmio_init_registers
,
559 .drv_get_txwi
= rt2800mmio_get_txwi
,
562 static const struct rt2x00lib_ops rt2800soc_rt2x00_ops
= {
563 .irq_handler
= rt2800mmio_interrupt
,
564 .txstatus_tasklet
= rt2800mmio_txstatus_tasklet
,
565 .pretbtt_tasklet
= rt2800mmio_pretbtt_tasklet
,
566 .tbtt_tasklet
= rt2800mmio_tbtt_tasklet
,
567 .rxdone_tasklet
= rt2800mmio_rxdone_tasklet
,
568 .autowake_tasklet
= rt2800mmio_autowake_tasklet
,
569 .probe_hw
= rt2800_probe_hw
,
570 .get_firmware_name
= rt2800pci_get_firmware_name
,
571 .check_firmware
= rt2800_check_firmware
,
572 .load_firmware
= rt2800_load_firmware
,
573 .initialize
= rt2x00mmio_initialize
,
574 .uninitialize
= rt2x00mmio_uninitialize
,
575 .get_entry_state
= rt2800mmio_get_entry_state
,
576 .clear_entry
= rt2800mmio_clear_entry
,
577 .set_device_state
= rt2800pci_set_device_state
,
578 .rfkill_poll
= rt2800_rfkill_poll
,
579 .link_stats
= rt2800_link_stats
,
580 .reset_tuner
= rt2800_reset_tuner
,
581 .link_tuner
= rt2800_link_tuner
,
582 .gain_calibration
= rt2800_gain_calibration
,
583 .vco_calibration
= rt2800_vco_calibration
,
584 .start_queue
= rt2800mmio_start_queue
,
585 .kick_queue
= rt2800mmio_kick_queue
,
586 .stop_queue
= rt2800mmio_stop_queue
,
587 .flush_queue
= rt2x00mmio_flush_queue
,
588 .write_tx_desc
= rt2800mmio_write_tx_desc
,
589 .write_tx_data
= rt2800_write_tx_data
,
590 .write_beacon
= rt2800_write_beacon
,
591 .clear_beacon
= rt2800_clear_beacon
,
592 .fill_rxdone
= rt2800mmio_fill_rxdone
,
593 .config_shared_key
= rt2800_config_shared_key
,
594 .config_pairwise_key
= rt2800_config_pairwise_key
,
595 .config_filter
= rt2800_config_filter
,
596 .config_intf
= rt2800_config_intf
,
597 .config_erp
= rt2800_config_erp
,
598 .config_ant
= rt2800_config_ant
,
599 .config
= rt2800_config
,
600 .sta_add
= rt2800_sta_add
,
601 .sta_remove
= rt2800_sta_remove
,
604 static const struct rt2x00_ops rt2800soc_ops
= {
605 .name
= KBUILD_MODNAME
,
606 .drv_data_size
= sizeof(struct rt2800_drv_data
),
608 .eeprom_size
= EEPROM_SIZE
,
610 .tx_queues
= NUM_TX_QUEUES
,
611 .queue_init
= rt2800mmio_queue_init
,
612 .lib
= &rt2800soc_rt2x00_ops
,
613 .drv
= &rt2800soc_rt2800_ops
,
614 .hw
= &rt2800soc_mac80211_ops
,
615 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
616 .debugfs
= &rt2800_rt2x00debug
,
617 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
620 static int rt2800soc_probe(struct platform_device
*pdev
)
622 return rt2x00soc_probe(pdev
, &rt2800soc_ops
);
625 static struct platform_driver rt2800soc_driver
= {
627 .name
= "rt2800_wmac",
628 .owner
= THIS_MODULE
,
629 .mod_name
= KBUILD_MODNAME
,
631 .probe
= rt2800soc_probe
,
632 .remove
= rt2x00soc_remove
,
633 .suspend
= rt2x00soc_suspend
,
634 .resume
= rt2x00soc_resume
,
636 #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */
639 static int rt2800pci_probe(struct pci_dev
*pci_dev
,
640 const struct pci_device_id
*id
)
642 return rt2x00pci_probe(pci_dev
, &rt2800pci_ops
);
645 static struct pci_driver rt2800pci_driver
= {
646 .name
= KBUILD_MODNAME
,
647 .id_table
= rt2800pci_device_table
,
648 .probe
= rt2800pci_probe
,
649 .remove
= rt2x00pci_remove
,
650 .suspend
= rt2x00pci_suspend
,
651 .resume
= rt2x00pci_resume
,
653 #endif /* CONFIG_PCI */
655 static int __init
rt2800pci_init(void)
659 #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
660 ret
= platform_driver_register(&rt2800soc_driver
);
665 ret
= pci_register_driver(&rt2800pci_driver
);
667 #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
668 platform_driver_unregister(&rt2800soc_driver
);
677 static void __exit
rt2800pci_exit(void)
680 pci_unregister_driver(&rt2800pci_driver
);
682 #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
683 platform_driver_unregister(&rt2800soc_driver
);
687 module_init(rt2800pci_init
);
688 module_exit(rt2800pci_exit
);