30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/pci.h>
34 #include <linux/slab.h>
53 #define WAIT_FOR_BBP(__dev, __reg) \
54 rt2x00pci_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg))
55 #define WAIT_FOR_RF(__dev, __reg) \
56 rt2x00pci_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg))
58 static void rt2400pci_bbp_write(
struct rt2x00_dev *rt2x00dev,
76 rt2x00pci_register_write(rt2x00dev,
BBPCSR, reg);
82 static void rt2400pci_bbp_read(
struct rt2x00_dev *rt2x00dev,
103 rt2x00pci_register_write(rt2x00dev,
BBPCSR, reg);
113 static void rt2400pci_rf_write(
struct rt2x00_dev *rt2x00dev,
114 const unsigned int word,
const u32 value)
131 rt2x00pci_register_write(rt2x00dev,
RFCSR, reg);
132 rt2x00_rf_write(rt2x00dev, word, value);
143 rt2x00pci_register_read(rt2x00dev,
CSR21, ®);
165 rt2x00pci_register_write(rt2x00dev,
CSR21, reg);
168 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
169 static const struct rt2x00debug rt2400pci_rt2x00debug = {
172 .read = rt2x00pci_register_read,
173 .write = rt2x00pci_register_write,
176 .word_size =
sizeof(
u32),
180 .read = rt2x00_eeprom_read,
181 .write = rt2x00_eeprom_write,
183 .word_size =
sizeof(
u16),
187 .read = rt2400pci_bbp_read,
188 .write = rt2400pci_bbp_write,
190 .word_size =
sizeof(
u8),
194 .read = rt2x00_rf_read,
195 .write = rt2400pci_rf_write,
197 .word_size =
sizeof(
u32),
203 static int rt2400pci_rfkill_poll(
struct rt2x00_dev *rt2x00dev)
207 rt2x00pci_register_read(rt2x00dev,
GPIOCSR, ®);
211 #ifdef CONFIG_RT2X00_LIB_LEDS
212 static void rt2400pci_brightness_set(
struct led_classdev *led_cdev,
230 static int rt2400pci_blink_set(
struct led_classdev *led_cdev,
231 unsigned long *delay_on,
232 unsigned long *delay_off)
246 static void rt2400pci_init_led(
struct rt2x00_dev *rt2x00dev,
252 led->
led_dev.brightness_set = rt2400pci_brightness_set;
253 led->
led_dev.blink_set = rt2400pci_blink_set;
261 static void rt2400pci_config_filter(
struct rt2x00_dev *rt2x00dev,
262 const unsigned int filter_flags)
271 rt2x00pci_register_read(rt2x00dev,
RXCSR0, ®);
284 rt2x00pci_register_write(rt2x00dev,
RXCSR0, reg);
287 static void rt2400pci_config_intf(
struct rt2x00_dev *rt2x00dev,
290 const unsigned int flags)
292 unsigned int bcn_preload;
300 rt2x00pci_register_read(rt2x00dev,
BCNCSR1, ®);
302 rt2x00pci_register_write(rt2x00dev,
BCNCSR1, reg);
307 rt2x00pci_register_read(rt2x00dev,
CSR14, ®);
309 rt2x00pci_register_write(rt2x00dev,
CSR14, reg);
313 rt2x00pci_register_multiwrite(rt2x00dev,
CSR3,
314 conf->
mac,
sizeof(conf->
mac));
317 rt2x00pci_register_multiwrite(rt2x00dev,
CSR5,
321 static void rt2400pci_config_erp(
struct rt2x00_dev *rt2x00dev,
334 rt2x00pci_register_read(rt2x00dev,
TXCSR1, ®);
339 rt2x00pci_register_write(rt2x00dev,
TXCSR1, reg);
341 rt2x00pci_register_read(rt2x00dev,
ARCSR2, ®);
346 rt2x00pci_register_write(rt2x00dev,
ARCSR2, reg);
348 rt2x00pci_register_read(rt2x00dev,
ARCSR3, ®);
353 rt2x00pci_register_write(rt2x00dev,
ARCSR3, reg);
355 rt2x00pci_register_read(rt2x00dev,
ARCSR4, ®);
360 rt2x00pci_register_write(rt2x00dev,
ARCSR4, reg);
362 rt2x00pci_register_read(rt2x00dev,
ARCSR5, ®);
367 rt2x00pci_register_write(rt2x00dev,
ARCSR5, reg);
374 rt2x00pci_register_read(rt2x00dev,
CSR11, ®);
376 rt2x00pci_register_write(rt2x00dev,
CSR11, reg);
378 rt2x00pci_register_read(rt2x00dev,
CSR18, ®);
381 rt2x00pci_register_write(rt2x00dev,
CSR18, reg);
383 rt2x00pci_register_read(rt2x00dev,
CSR19, ®);
386 rt2x00pci_register_write(rt2x00dev,
CSR19, reg);
390 rt2x00pci_register_read(rt2x00dev,
CSR12, ®);
395 rt2x00pci_register_write(rt2x00dev,
CSR12, reg);
399 static void rt2400pci_config_ant(
struct rt2x00_dev *rt2x00dev,
412 rt2400pci_bbp_read(rt2x00dev, 4, &r4);
413 rt2400pci_bbp_read(rt2x00dev, 1, &r1);
447 rt2400pci_bbp_write(rt2x00dev, 4, r4);
448 rt2400pci_bbp_write(rt2x00dev, 1, r1);
451 static void rt2400pci_config_channel(
struct rt2x00_dev *rt2x00dev,
460 rt2400pci_rf_write(rt2x00dev, 1, rf->
rf1);
461 rt2400pci_rf_write(rt2x00dev, 2, rf->
rf2);
462 rt2400pci_rf_write(rt2x00dev, 3, rf->
rf3);
467 if (rt2x00_rf(rt2x00dev,
RF2420))
475 rt2400pci_rf_write(rt2x00dev, 1, rf->
rf1);
476 rt2400pci_rf_write(rt2x00dev, 2, 0x000c2a32);
477 rt2400pci_rf_write(rt2x00dev, 3, rf->
rf3);
481 rt2400pci_rf_write(rt2x00dev, 1, rf->
rf1);
482 rt2400pci_rf_write(rt2x00dev, 2, rf->
rf2);
483 rt2400pci_rf_write(rt2x00dev, 3, rf->
rf3);
493 rt2400pci_rf_write(rt2x00dev, 1, rf->
rf1);
494 rt2400pci_rf_write(rt2x00dev, 3, rf->
rf3);
499 rt2x00pci_register_read(rt2x00dev,
CNT0, &rf->
rf1);
502 static void rt2400pci_config_txpower(
struct rt2x00_dev *rt2x00dev,
int txpower)
507 static void rt2400pci_config_retry_limit(
struct rt2x00_dev *rt2x00dev,
512 rt2x00pci_register_read(rt2x00dev,
CSR11, ®);
514 libconf->
conf->long_frame_max_tx_count);
516 libconf->
conf->short_frame_max_tx_count);
517 rt2x00pci_register_write(rt2x00dev,
CSR11, reg);
520 static void rt2400pci_config_ps(
struct rt2x00_dev *rt2x00dev,
529 rt2x00pci_register_read(rt2x00dev,
CSR20, ®);
533 libconf->
conf->listen_interval - 1);
537 rt2x00pci_register_write(rt2x00dev,
CSR20, reg);
540 rt2x00pci_register_write(rt2x00dev,
CSR20, reg);
542 rt2x00pci_register_read(rt2x00dev,
CSR20, ®);
544 rt2x00pci_register_write(rt2x00dev,
CSR20, reg);
547 rt2x00dev->
ops->lib->set_device_state(rt2x00dev, state);
550 static void rt2400pci_config(
struct rt2x00_dev *rt2x00dev,
552 const unsigned int flags)
555 rt2400pci_config_channel(rt2x00dev, &libconf->
rf);
557 rt2400pci_config_txpower(rt2x00dev,
558 libconf->
conf->power_level);
560 rt2400pci_config_retry_limit(rt2x00dev, libconf);
562 rt2400pci_config_ps(rt2x00dev, libconf);
565 static void rt2400pci_config_cw(
struct rt2x00_dev *rt2x00dev,
570 rt2x00pci_register_read(rt2x00dev,
CSR11, ®);
573 rt2x00pci_register_write(rt2x00dev,
CSR11, reg);
579 static void rt2400pci_link_stats(
struct rt2x00_dev *rt2x00dev,
588 rt2x00pci_register_read(rt2x00dev,
CNT0, ®);
594 rt2400pci_bbp_read(rt2x00dev, 39, &bbp);
598 static inline void rt2400pci_set_vgc(
struct rt2x00_dev *rt2x00dev,
602 rt2400pci_bbp_write(rt2x00dev, 13, vgc_level);
608 static void rt2400pci_reset_tuner(
struct rt2x00_dev *rt2x00dev,
611 rt2400pci_set_vgc(rt2x00dev, qual, 0x08);
614 static void rt2400pci_link_tuner(
struct rt2x00_dev *rt2x00dev,
621 if (count > 60 || !(count & 1))
628 rt2400pci_set_vgc(rt2x00dev, qual, ++qual->
vgc_level);
630 rt2400pci_set_vgc(rt2x00dev, qual, --qual->
vgc_level);
641 switch (queue->
qid) {
643 rt2x00pci_register_read(rt2x00dev,
RXCSR0, ®);
645 rt2x00pci_register_write(rt2x00dev,
RXCSR0, reg);
648 rt2x00pci_register_read(rt2x00dev,
CSR14, ®);
652 rt2x00pci_register_write(rt2x00dev,
CSR14, reg);
659 static void rt2400pci_kick_queue(
struct data_queue *queue)
664 switch (queue->
qid) {
666 rt2x00pci_register_read(rt2x00dev,
TXCSR0, ®);
668 rt2x00pci_register_write(rt2x00dev,
TXCSR0, reg);
671 rt2x00pci_register_read(rt2x00dev,
TXCSR0, ®);
673 rt2x00pci_register_write(rt2x00dev,
TXCSR0, reg);
676 rt2x00pci_register_read(rt2x00dev,
TXCSR0, ®);
678 rt2x00pci_register_write(rt2x00dev,
TXCSR0, reg);
685 static void rt2400pci_stop_queue(
struct data_queue *queue)
690 switch (queue->
qid) {
694 rt2x00pci_register_read(rt2x00dev,
TXCSR0, ®);
696 rt2x00pci_register_write(rt2x00dev,
TXCSR0, reg);
699 rt2x00pci_register_read(rt2x00dev,
RXCSR0, ®);
701 rt2x00pci_register_write(rt2x00dev,
RXCSR0, reg);
704 rt2x00pci_register_read(rt2x00dev,
CSR14, ®);
708 rt2x00pci_register_write(rt2x00dev,
CSR14, reg);
723 static bool rt2400pci_get_entry_state(
struct queue_entry *
entry)
728 if (entry->queue->qid ==
QID_RX) {
729 rt2x00_desc_read(entry_priv->
desc, 0, &word);
733 rt2x00_desc_read(entry_priv->
desc, 0, &word);
740 static void rt2400pci_clear_entry(
struct queue_entry *entry)
746 if (entry->queue->qid ==
QID_RX) {
747 rt2x00_desc_read(entry_priv->
desc, 2, &word);
749 rt2x00_desc_write(entry_priv->
desc, 2, word);
751 rt2x00_desc_read(entry_priv->
desc, 1, &word);
753 rt2x00_desc_write(entry_priv->
desc, 1, word);
755 rt2x00_desc_read(entry_priv->
desc, 0, &word);
757 rt2x00_desc_write(entry_priv->
desc, 0, word);
759 rt2x00_desc_read(entry_priv->
desc, 0, &word);
762 rt2x00_desc_write(entry_priv->
desc, 0, word);
766 static int rt2400pci_init_queues(
struct rt2x00_dev *rt2x00dev)
774 rt2x00pci_register_read(rt2x00dev,
TXCSR2, ®);
779 rt2x00pci_register_write(rt2x00dev,
TXCSR2, reg);
781 entry_priv = rt2x00dev->
tx[1].entries[0].priv_data;
782 rt2x00pci_register_read(rt2x00dev,
TXCSR3, ®);
785 rt2x00pci_register_write(rt2x00dev,
TXCSR3, reg);
787 entry_priv = rt2x00dev->
tx[0].entries[0].priv_data;
788 rt2x00pci_register_read(rt2x00dev,
TXCSR5, ®);
791 rt2x00pci_register_write(rt2x00dev,
TXCSR5, reg);
793 entry_priv = rt2x00dev->
atim->entries[0].priv_data;
794 rt2x00pci_register_read(rt2x00dev,
TXCSR4, ®);
797 rt2x00pci_register_write(rt2x00dev,
TXCSR4, reg);
799 entry_priv = rt2x00dev->
bcn->entries[0].priv_data;
800 rt2x00pci_register_read(rt2x00dev,
TXCSR6, ®);
803 rt2x00pci_register_write(rt2x00dev,
TXCSR6, reg);
805 rt2x00pci_register_read(rt2x00dev,
RXCSR1, ®);
808 rt2x00pci_register_write(rt2x00dev,
RXCSR1, reg);
810 entry_priv = rt2x00dev->
rx->entries[0].priv_data;
811 rt2x00pci_register_read(rt2x00dev,
RXCSR2, ®);
814 rt2x00pci_register_write(rt2x00dev,
RXCSR2, reg);
819 static int rt2400pci_init_registers(
struct rt2x00_dev *rt2x00dev)
823 rt2x00pci_register_write(rt2x00dev,
PSCSR0, 0x00020002);
824 rt2x00pci_register_write(rt2x00dev,
PSCSR1, 0x00000002);
825 rt2x00pci_register_write(rt2x00dev,
PSCSR2, 0x00023f20);
826 rt2x00pci_register_write(rt2x00dev,
PSCSR3, 0x00000002);
828 rt2x00pci_register_read(rt2x00dev,
TIMECSR, ®);
832 rt2x00pci_register_write(rt2x00dev,
TIMECSR, reg);
834 rt2x00pci_register_read(rt2x00dev,
CSR9, ®);
836 (rt2x00dev->
rx->data_size / 128));
837 rt2x00pci_register_write(rt2x00dev,
CSR9, reg);
839 rt2x00pci_register_read(rt2x00dev,
CSR14, ®);
848 rt2x00pci_register_write(rt2x00dev,
CSR14, reg);
850 rt2x00pci_register_write(rt2x00dev,
CNT3, 0x3f080000);
852 rt2x00pci_register_read(rt2x00dev,
ARCSR0, ®);
857 rt2x00pci_register_write(rt2x00dev,
ARCSR0, reg);
859 rt2x00pci_register_read(rt2x00dev,
RXCSR3, ®);
866 rt2x00pci_register_write(rt2x00dev,
RXCSR3, reg);
868 rt2x00pci_register_write(rt2x00dev,
PWRCSR0, 0x3f3b3100);
870 if (rt2x00dev->
ops->lib->set_device_state(rt2x00dev,
STATE_AWAKE))
873 rt2x00pci_register_write(rt2x00dev,
MACCSR0, 0x00217223);
874 rt2x00pci_register_write(rt2x00dev,
MACCSR1, 0x00235518);
876 rt2x00pci_register_read(rt2x00dev,
MACCSR2, ®);
878 rt2x00pci_register_write(rt2x00dev,
MACCSR2, reg);
880 rt2x00pci_register_read(rt2x00dev,
RALINKCSR, ®);
885 rt2x00pci_register_write(rt2x00dev,
RALINKCSR, reg);
887 rt2x00pci_register_read(rt2x00dev,
CSR1, ®);
891 rt2x00pci_register_write(rt2x00dev,
CSR1, reg);
893 rt2x00pci_register_read(rt2x00dev,
CSR1, ®);
896 rt2x00pci_register_write(rt2x00dev,
CSR1, reg);
903 rt2x00pci_register_read(rt2x00dev,
CNT0, ®);
904 rt2x00pci_register_read(rt2x00dev,
CNT4, ®);
909 static int rt2400pci_wait_bbp_ready(
struct rt2x00_dev *rt2x00dev)
915 rt2400pci_bbp_read(rt2x00dev, 0, &value);
916 if ((value != 0xff) && (value != 0x00))
921 ERROR(rt2x00dev,
"BBP register access failed, aborting.\n");
925 static int rt2400pci_init_bbp(
struct rt2x00_dev *rt2x00dev)
932 if (
unlikely(rt2400pci_wait_bbp_ready(rt2x00dev)))
935 rt2400pci_bbp_write(rt2x00dev, 1, 0x00);
936 rt2400pci_bbp_write(rt2x00dev, 3, 0x27);
937 rt2400pci_bbp_write(rt2x00dev, 4, 0x08);
938 rt2400pci_bbp_write(rt2x00dev, 10, 0x0f);
939 rt2400pci_bbp_write(rt2x00dev, 15, 0x72);
940 rt2400pci_bbp_write(rt2x00dev, 16, 0x74);
941 rt2400pci_bbp_write(rt2x00dev, 17, 0x20);
942 rt2400pci_bbp_write(rt2x00dev, 18, 0x72);
943 rt2400pci_bbp_write(rt2x00dev, 19, 0x0b);
944 rt2400pci_bbp_write(rt2x00dev, 20, 0x00);
945 rt2400pci_bbp_write(rt2x00dev, 28, 0x11);
946 rt2400pci_bbp_write(rt2x00dev, 29, 0x04);
947 rt2400pci_bbp_write(rt2x00dev, 30, 0x21);
948 rt2400pci_bbp_write(rt2x00dev, 31, 0x00);
953 if (eeprom != 0xffff && eeprom != 0x0000) {
956 rt2400pci_bbp_write(rt2x00dev, reg_id, value);
966 static void rt2400pci_toggle_irq(
struct rt2x00_dev *rt2x00dev,
978 rt2x00pci_register_read(rt2x00dev,
CSR7, ®);
979 rt2x00pci_register_write(rt2x00dev,
CSR7, reg);
988 rt2x00pci_register_read(rt2x00dev,
CSR8, ®);
994 rt2x00pci_register_write(rt2x00dev,
CSR8, reg);
996 spin_unlock_irqrestore(&rt2x00dev->
irqmask_lock, flags);
1009 static int rt2400pci_enable_radio(
struct rt2x00_dev *rt2x00dev)
1014 if (
unlikely(rt2400pci_init_queues(rt2x00dev) ||
1015 rt2400pci_init_registers(rt2x00dev) ||
1016 rt2400pci_init_bbp(rt2x00dev)))
1022 static void rt2400pci_disable_radio(
struct rt2x00_dev *rt2x00dev)
1027 rt2x00pci_register_write(rt2x00dev,
PWRCSR0, 0);
1030 static int rt2400pci_set_state(
struct rt2x00_dev *rt2x00dev,
1041 rt2x00pci_register_read(rt2x00dev,
PWRCSR1, ®);
1046 rt2x00pci_register_write(rt2x00dev,
PWRCSR1, reg);
1054 rt2x00pci_register_read(rt2x00dev,
PWRCSR1, ®2);
1057 if (bbp_state == state && rf_state == state)
1059 rt2x00pci_register_write(rt2x00dev,
PWRCSR1, reg);
1066 static int rt2400pci_set_device_state(
struct rt2x00_dev *rt2x00dev,
1073 retval = rt2400pci_enable_radio(rt2x00dev);
1076 rt2400pci_disable_radio(rt2x00dev);
1080 rt2400pci_toggle_irq(rt2x00dev, state);
1086 retval = rt2400pci_set_state(rt2x00dev, state);
1094 ERROR(rt2x00dev,
"Device failed to enter state %d (%d).\n",
1103 static void rt2400pci_write_tx_desc(
struct queue_entry *entry,
1114 rt2x00_desc_read(txd, 1, &word);
1116 rt2x00_desc_write(txd, 1, word);
1118 rt2x00_desc_read(txd, 2, &word);
1121 rt2x00_desc_write(txd, 2, word);
1123 rt2x00_desc_read(txd, 3, &word);
1130 rt2x00_desc_write(txd, 3, word);
1132 rt2x00_desc_read(txd, 4, &word);
1134 txdesc->
u.
plcp.length_low);
1138 txdesc->
u.
plcp.length_high);
1141 rt2x00_desc_write(txd, 4, word);
1148 rt2x00_desc_read(txd, 0, &word);
1162 rt2x00_desc_write(txd, 0, word);
1167 skbdesc->
desc = txd;
1174 static void rt2400pci_write_beacon(
struct queue_entry *entry,
1177 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1184 rt2x00pci_register_read(rt2x00dev,
CSR14, ®);
1186 rt2x00pci_register_write(rt2x00dev,
CSR14, reg);
1193 rt2400pci_write_tx_desc(entry, txdesc);
1204 rt2x00pci_register_write(rt2x00dev,
CSR14, reg);
1210 static void rt2400pci_fill_rxdone(
struct queue_entry *entry,
1213 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1223 rt2x00_desc_read(entry_priv->
desc, 0, &word0);
1224 rt2x00_desc_read(entry_priv->
desc, 2, &word2);
1225 rt2x00_desc_read(entry_priv->
desc, 3, &word3);
1226 rt2x00_desc_read(entry_priv->
desc, 4, &word4);
1242 tsf = rt2x00dev->
ops->hw->get_tsf(rt2x00dev->
hw,
NULL);
1246 if ((
u32)tsf <= rx_low)
1257 entry->queue->rt2x00dev->rssi_offset;
1268 static void rt2400pci_txdone(
struct rt2x00_dev *rt2x00dev,
1271 struct data_queue *queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
1273 struct queue_entry *
entry;
1277 while (!rt2x00queue_empty(queue)) {
1279 entry_priv = entry->priv_data;
1280 rt2x00_desc_read(entry_priv->
desc, 0, &word);
1307 static inline void rt2400pci_enable_interrupt(
struct rt2x00_dev *rt2x00dev,
1318 rt2x00pci_register_read(rt2x00dev,
CSR8, ®);
1320 rt2x00pci_register_write(rt2x00dev,
CSR8, reg);
1325 static void rt2400pci_txstatus_tasklet(
unsigned long data)
1333 rt2400pci_txdone(rt2x00dev,
QID_ATIM);
1343 rt2x00pci_register_read(rt2x00dev,
CSR8, ®);
1347 rt2x00pci_register_write(rt2x00dev,
CSR8, reg);
1353 static void rt2400pci_tbtt_tasklet(
unsigned long data)
1361 static void rt2400pci_rxdone_tasklet(
unsigned long data)
1367 rt2400pci_enable_interrupt(rt2x00dev,
CSR8_RXDONE);
1370 static irqreturn_t rt2400pci_interrupt(
int irq,
void *dev_instance)
1379 rt2x00pci_register_read(rt2x00dev,
CSR7, ®);
1380 rt2x00pci_register_write(rt2x00dev,
CSR7, reg);
1417 rt2x00pci_register_read(rt2x00dev,
CSR8, ®);
1419 rt2x00pci_register_write(rt2x00dev,
CSR8, reg);
1431 static int rt2400pci_validate_eeprom(
struct rt2x00_dev *rt2x00dev)
1438 rt2x00pci_register_read(rt2x00dev,
CSR21, ®);
1440 eeprom.data = rt2x00dev;
1441 eeprom.register_read = rt2400pci_eepromregister_read;
1442 eeprom.register_write = rt2400pci_eepromregister_write;
1445 eeprom.reg_data_in = 0;
1446 eeprom.reg_data_out = 0;
1447 eeprom.reg_data_clock = 0;
1448 eeprom.reg_chip_select = 0;
1457 if (!is_valid_ether_addr(mac)) {
1458 eth_random_addr(mac);
1459 EEPROM(rt2x00dev,
"MAC: %pM\n", mac);
1463 if (word == 0xffff) {
1464 ERROR(rt2x00dev,
"Invalid EEPROM data detected.\n");
1471 static int rt2400pci_init_eeprom(
struct rt2x00_dev *rt2x00dev)
1486 rt2x00pci_register_read(rt2x00dev,
CSR0, ®);
1487 rt2x00_set_chip(rt2x00dev,
RT2460, value,
1490 if (!rt2x00_rf(rt2x00dev,
RF2420) && !rt2x00_rf(rt2x00dev,
RF2421)) {
1491 ERROR(rt2x00dev,
"Invalid RF chipset detected.\n");
1517 #ifdef CONFIG_RT2X00_LIB_LEDS
1520 rt2400pci_init_led(rt2x00dev, &rt2x00dev->led_radio,
LED_TYPE_RADIO);
1524 rt2400pci_init_led(rt2x00dev, &rt2x00dev->led_qual,
1547 static const struct rf_channel rf_vals_b[] = {
1548 { 1, 0x00022058, 0x000c1fda, 0x00000101, 0 },
1549 { 2, 0x00022058, 0x000c1fee, 0x00000101, 0 },
1550 { 3, 0x00022058, 0x000c2002, 0x00000101, 0 },
1551 { 4, 0x00022058, 0x000c2016, 0x00000101, 0 },
1552 { 5, 0x00022058, 0x000c202a, 0x00000101, 0 },
1553 { 6, 0x00022058, 0x000c203e, 0x00000101, 0 },
1554 { 7, 0x00022058, 0x000c2052, 0x00000101, 0 },
1555 { 8, 0x00022058, 0x000c2066, 0x00000101, 0 },
1556 { 9, 0x00022058, 0x000c207a, 0x00000101, 0 },
1557 { 10, 0x00022058, 0x000c208e, 0x00000101, 0 },
1558 { 11, 0x00022058, 0x000c20a2, 0x00000101, 0 },
1559 { 12, 0x00022058, 0x000c20b6, 0x00000101, 0 },
1560 { 13, 0x00022058, 0x000c20ca, 0x00000101, 0 },
1561 { 14, 0x00022058, 0x000c20fa, 0x00000101, 0 },
1564 static int rt2400pci_probe_hw_mode(
struct rt2x00_dev *rt2x00dev)
1579 SET_IEEE80211_DEV(rt2x00dev->
hw, rt2x00dev->
dev);
1580 SET_IEEE80211_PERM_ADDR(rt2x00dev->
hw,
1581 rt2x00_eeprom_addr(rt2x00dev,
1603 for (i = 0; i < 14; i++) {
1611 static int rt2400pci_probe_hw(
struct rt2x00_dev *rt2x00dev)
1619 retval = rt2400pci_validate_eeprom(rt2x00dev);
1623 retval = rt2400pci_init_eeprom(rt2x00dev);
1631 rt2x00pci_register_read(rt2x00dev,
GPIOCSR, ®);
1633 rt2x00pci_register_write(rt2x00dev,
GPIOCSR, reg);
1638 retval = rt2400pci_probe_hw_mode(rt2x00dev);
1680 rt2400pci_config_cw(rt2x00dev,
1681 rt2x00dev->
tx->cw_min, rt2x00dev->
tx->cw_max);
1693 rt2x00pci_register_read(rt2x00dev,
CSR17, ®);
1695 rt2x00pci_register_read(rt2x00dev,
CSR16, ®);
1701 static int rt2400pci_tx_last_beacon(
struct ieee80211_hw *hw)
1706 rt2x00pci_register_read(rt2x00dev,
CSR15, ®);
1710 static const struct ieee80211_ops rt2400pci_mac80211_ops = {
1722 .conf_tx = rt2400pci_conf_tx,
1723 .get_tsf = rt2400pci_get_tsf,
1724 .tx_last_beacon = rt2400pci_tx_last_beacon,
1734 .irq_handler = rt2400pci_interrupt,
1735 .txstatus_tasklet = rt2400pci_txstatus_tasklet,
1736 .tbtt_tasklet = rt2400pci_tbtt_tasklet,
1737 .rxdone_tasklet = rt2400pci_rxdone_tasklet,
1738 .probe_hw = rt2400pci_probe_hw,
1741 .get_entry_state = rt2400pci_get_entry_state,
1742 .clear_entry = rt2400pci_clear_entry,
1743 .set_device_state = rt2400pci_set_device_state,
1744 .rfkill_poll = rt2400pci_rfkill_poll,
1745 .link_stats = rt2400pci_link_stats,
1746 .reset_tuner = rt2400pci_reset_tuner,
1747 .link_tuner = rt2400pci_link_tuner,
1748 .start_queue = rt2400pci_start_queue,
1749 .kick_queue = rt2400pci_kick_queue,
1750 .stop_queue = rt2400pci_stop_queue,
1752 .write_tx_desc = rt2400pci_write_tx_desc,
1753 .write_beacon = rt2400pci_write_beacon,
1754 .fill_rxdone = rt2400pci_fill_rxdone,
1755 .config_filter = rt2400pci_config_filter,
1756 .config_intf = rt2400pci_config_intf,
1757 .config_erp = rt2400pci_config_erp,
1758 .config_ant = rt2400pci_config_ant,
1759 .config = rt2400pci_config,
1790 static const struct rt2x00_ops rt2400pci_ops = {
1791 .name = KBUILD_MODNAME,
1796 .extra_tx_headroom = 0,
1797 .rx = &rt2400pci_queue_rx,
1798 .tx = &rt2400pci_queue_tx,
1799 .bcn = &rt2400pci_queue_bcn,
1800 .atim = &rt2400pci_queue_atim,
1801 .lib = &rt2400pci_rt2x00_ops,
1802 .hw = &rt2400pci_mac80211_ops,
1803 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
1804 .debugfs = &rt2400pci_rt2x00debug,
1830 static struct pci_driver rt2400pci_driver = {
1831 .name = KBUILD_MODNAME,
1832 .id_table = rt2400pci_device_table,
1833 .probe = rt2400pci_probe,