diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 481 |
1 files changed, 309 insertions, 172 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 5063e01410e5..937f9e8bf05f 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * These indirect registers work with busy bits, | 46 | * These indirect registers work with busy bits, |
47 | * and we will try maximal REGISTER_BUSY_COUNT times to access | 47 | * and we will try maximal REGISTER_BUSY_COUNT times to access |
48 | * the register while taking a REGISTER_BUSY_DELAY us delay | 48 | * the register while taking a REGISTER_BUSY_DELAY us delay |
49 | * between each attampt. When the busy bit is still set at that time, | 49 | * between each attempt. When the busy bit is still set at that time, |
50 | * the access attempt is considered to have failed, | 50 | * the access attempt is considered to have failed, |
51 | * and we will print an error. | 51 | * and we will print an error. |
52 | */ | 52 | */ |
@@ -305,9 +305,7 @@ static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev, | |||
305 | * Enable synchronisation. | 305 | * Enable synchronisation. |
306 | */ | 306 | */ |
307 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | 307 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); |
308 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
309 | rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); | 308 | rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); |
310 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
311 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 309 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
312 | } | 310 | } |
313 | 311 | ||
@@ -321,7 +319,8 @@ static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev, | |||
321 | } | 319 | } |
322 | 320 | ||
323 | static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev, | 321 | static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev, |
324 | struct rt2x00lib_erp *erp) | 322 | struct rt2x00lib_erp *erp, |
323 | u32 changed) | ||
325 | { | 324 | { |
326 | int preamble_mask; | 325 | int preamble_mask; |
327 | u32 reg; | 326 | u32 reg; |
@@ -329,59 +328,72 @@ static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev, | |||
329 | /* | 328 | /* |
330 | * When short preamble is enabled, we should set bit 0x08 | 329 | * When short preamble is enabled, we should set bit 0x08 |
331 | */ | 330 | */ |
332 | preamble_mask = erp->short_preamble << 3; | 331 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { |
333 | 332 | preamble_mask = erp->short_preamble << 3; | |
334 | rt2x00pci_register_read(rt2x00dev, TXCSR1, ®); | 333 | |
335 | rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x1ff); | 334 | rt2x00pci_register_read(rt2x00dev, TXCSR1, ®); |
336 | rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0x13a); | 335 | rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x1ff); |
337 | rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER); | 336 | rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0x13a); |
338 | rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); | 337 | rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER); |
339 | rt2x00pci_register_write(rt2x00dev, TXCSR1, reg); | 338 | rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); |
340 | 339 | rt2x00pci_register_write(rt2x00dev, TXCSR1, reg); | |
341 | rt2x00pci_register_read(rt2x00dev, ARCSR2, ®); | 340 | |
342 | rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00); | 341 | rt2x00pci_register_read(rt2x00dev, ARCSR2, ®); |
343 | rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04); | 342 | rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00); |
344 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 10)); | 343 | rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04); |
345 | rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); | 344 | rt2x00_set_field32(®, ARCSR2_LENGTH, |
346 | 345 | GET_DURATION(ACK_SIZE, 10)); | |
347 | rt2x00pci_register_read(rt2x00dev, ARCSR3, ®); | 346 | rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); |
348 | rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask); | 347 | |
349 | rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04); | 348 | rt2x00pci_register_read(rt2x00dev, ARCSR3, ®); |
350 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 20)); | 349 | rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask); |
351 | rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); | 350 | rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04); |
352 | 351 | rt2x00_set_field32(®, ARCSR2_LENGTH, | |
353 | rt2x00pci_register_read(rt2x00dev, ARCSR4, ®); | 352 | GET_DURATION(ACK_SIZE, 20)); |
354 | rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask); | 353 | rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); |
355 | rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04); | 354 | |
356 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 55)); | 355 | rt2x00pci_register_read(rt2x00dev, ARCSR4, ®); |
357 | rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); | 356 | rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask); |
358 | 357 | rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04); | |
359 | rt2x00pci_register_read(rt2x00dev, ARCSR5, ®); | 358 | rt2x00_set_field32(®, ARCSR2_LENGTH, |
360 | rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask); | 359 | GET_DURATION(ACK_SIZE, 55)); |
361 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); | 360 | rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); |
362 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 110)); | 361 | |
363 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); | 362 | rt2x00pci_register_read(rt2x00dev, ARCSR5, ®); |
364 | 363 | rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask); | |
365 | rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); | 364 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); |
365 | rt2x00_set_field32(®, ARCSR2_LENGTH, | ||
366 | GET_DURATION(ACK_SIZE, 110)); | ||
367 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); | ||
368 | } | ||
366 | 369 | ||
367 | rt2x00pci_register_read(rt2x00dev, CSR11, ®); | 370 | if (changed & BSS_CHANGED_BASIC_RATES) |
368 | rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); | 371 | rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); |
369 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); | ||
370 | 372 | ||
371 | rt2x00pci_register_read(rt2x00dev, CSR12, ®); | 373 | if (changed & BSS_CHANGED_ERP_SLOT) { |
372 | rt2x00_set_field32(®, CSR12_BEACON_INTERVAL, erp->beacon_int * 16); | 374 | rt2x00pci_register_read(rt2x00dev, CSR11, ®); |
373 | rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION, erp->beacon_int * 16); | 375 | rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); |
374 | rt2x00pci_register_write(rt2x00dev, CSR12, reg); | 376 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); |
375 | 377 | ||
376 | rt2x00pci_register_read(rt2x00dev, CSR18, ®); | 378 | rt2x00pci_register_read(rt2x00dev, CSR18, ®); |
377 | rt2x00_set_field32(®, CSR18_SIFS, erp->sifs); | 379 | rt2x00_set_field32(®, CSR18_SIFS, erp->sifs); |
378 | rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); | 380 | rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); |
379 | rt2x00pci_register_write(rt2x00dev, CSR18, reg); | 381 | rt2x00pci_register_write(rt2x00dev, CSR18, reg); |
380 | 382 | ||
381 | rt2x00pci_register_read(rt2x00dev, CSR19, ®); | 383 | rt2x00pci_register_read(rt2x00dev, CSR19, ®); |
382 | rt2x00_set_field32(®, CSR19_DIFS, erp->difs); | 384 | rt2x00_set_field32(®, CSR19_DIFS, erp->difs); |
383 | rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); | 385 | rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); |
384 | rt2x00pci_register_write(rt2x00dev, CSR19, reg); | 386 | rt2x00pci_register_write(rt2x00dev, CSR19, reg); |
387 | } | ||
388 | |||
389 | if (changed & BSS_CHANGED_BEACON_INT) { | ||
390 | rt2x00pci_register_read(rt2x00dev, CSR12, ®); | ||
391 | rt2x00_set_field32(®, CSR12_BEACON_INTERVAL, | ||
392 | erp->beacon_int * 16); | ||
393 | rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION, | ||
394 | erp->beacon_int * 16); | ||
395 | rt2x00pci_register_write(rt2x00dev, CSR12, reg); | ||
396 | } | ||
385 | } | 397 | } |
386 | 398 | ||
387 | static void rt2400pci_config_ant(struct rt2x00_dev *rt2x00dev, | 399 | static void rt2400pci_config_ant(struct rt2x00_dev *rt2x00dev, |
@@ -619,6 +631,98 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev, | |||
619 | } | 631 | } |
620 | 632 | ||
621 | /* | 633 | /* |
634 | * Queue handlers. | ||
635 | */ | ||
636 | static void rt2400pci_start_queue(struct data_queue *queue) | ||
637 | { | ||
638 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
639 | u32 reg; | ||
640 | |||
641 | switch (queue->qid) { | ||
642 | case QID_RX: | ||
643 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
644 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); | ||
645 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
646 | break; | ||
647 | case QID_BEACON: | ||
648 | /* | ||
649 | * Allow the tbtt tasklet to be scheduled. | ||
650 | */ | ||
651 | tasklet_enable(&rt2x00dev->tbtt_tasklet); | ||
652 | |||
653 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
654 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
655 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
656 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
657 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
658 | break; | ||
659 | default: | ||
660 | break; | ||
661 | } | ||
662 | } | ||
663 | |||
664 | static void rt2400pci_kick_queue(struct data_queue *queue) | ||
665 | { | ||
666 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
667 | u32 reg; | ||
668 | |||
669 | switch (queue->qid) { | ||
670 | case QID_AC_VO: | ||
671 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
672 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); | ||
673 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
674 | break; | ||
675 | case QID_AC_VI: | ||
676 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
677 | rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); | ||
678 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
679 | break; | ||
680 | case QID_ATIM: | ||
681 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
682 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); | ||
683 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
684 | break; | ||
685 | default: | ||
686 | break; | ||
687 | } | ||
688 | } | ||
689 | |||
690 | static void rt2400pci_stop_queue(struct data_queue *queue) | ||
691 | { | ||
692 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
693 | u32 reg; | ||
694 | |||
695 | switch (queue->qid) { | ||
696 | case QID_AC_VO: | ||
697 | case QID_AC_VI: | ||
698 | case QID_ATIM: | ||
699 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
700 | rt2x00_set_field32(®, TXCSR0_ABORT, 1); | ||
701 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
702 | break; | ||
703 | case QID_RX: | ||
704 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
705 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); | ||
706 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
707 | break; | ||
708 | case QID_BEACON: | ||
709 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
710 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); | ||
711 | rt2x00_set_field32(®, CSR14_TBCN, 0); | ||
712 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | ||
713 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
714 | |||
715 | /* | ||
716 | * Wait for possibly running tbtt tasklets. | ||
717 | */ | ||
718 | tasklet_disable(&rt2x00dev->tbtt_tasklet); | ||
719 | break; | ||
720 | default: | ||
721 | break; | ||
722 | } | ||
723 | } | ||
724 | |||
725 | /* | ||
622 | * Initialization functions. | 726 | * Initialization functions. |
623 | */ | 727 | */ |
624 | static bool rt2400pci_get_entry_state(struct queue_entry *entry) | 728 | static bool rt2400pci_get_entry_state(struct queue_entry *entry) |
@@ -675,7 +779,7 @@ static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev) | |||
675 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); | 779 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); |
676 | rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); | 780 | rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); |
677 | rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); | 781 | rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); |
678 | rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->bcn[1].limit); | 782 | rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit); |
679 | rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); | 783 | rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); |
680 | rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); | 784 | rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); |
681 | 785 | ||
@@ -691,13 +795,13 @@ static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev) | |||
691 | entry_priv->desc_dma); | 795 | entry_priv->desc_dma); |
692 | rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); | 796 | rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); |
693 | 797 | ||
694 | entry_priv = rt2x00dev->bcn[1].entries[0].priv_data; | 798 | entry_priv = rt2x00dev->atim->entries[0].priv_data; |
695 | rt2x00pci_register_read(rt2x00dev, TXCSR4, ®); | 799 | rt2x00pci_register_read(rt2x00dev, TXCSR4, ®); |
696 | rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER, | 800 | rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER, |
697 | entry_priv->desc_dma); | 801 | entry_priv->desc_dma); |
698 | rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); | 802 | rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); |
699 | 803 | ||
700 | entry_priv = rt2x00dev->bcn[0].entries[0].priv_data; | 804 | entry_priv = rt2x00dev->bcn->entries[0].priv_data; |
701 | rt2x00pci_register_read(rt2x00dev, TXCSR6, ®); | 805 | rt2x00pci_register_read(rt2x00dev, TXCSR6, ®); |
702 | rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER, | 806 | rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER, |
703 | entry_priv->desc_dma); | 807 | entry_priv->desc_dma); |
@@ -864,24 +968,12 @@ static int rt2400pci_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
864 | /* | 968 | /* |
865 | * Device state switch handlers. | 969 | * Device state switch handlers. |
866 | */ | 970 | */ |
867 | static void rt2400pci_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
868 | enum dev_state state) | ||
869 | { | ||
870 | u32 reg; | ||
871 | |||
872 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
873 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, | ||
874 | (state == STATE_RADIO_RX_OFF) || | ||
875 | (state == STATE_RADIO_RX_OFF_LINK)); | ||
876 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
877 | } | ||
878 | |||
879 | static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | 971 | static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, |
880 | enum dev_state state) | 972 | enum dev_state state) |
881 | { | 973 | { |
882 | int mask = (state == STATE_RADIO_IRQ_OFF) || | 974 | int mask = (state == STATE_RADIO_IRQ_OFF); |
883 | (state == STATE_RADIO_IRQ_OFF_ISR); | ||
884 | u32 reg; | 975 | u32 reg; |
976 | unsigned long flags; | ||
885 | 977 | ||
886 | /* | 978 | /* |
887 | * When interrupts are being enabled, the interrupt registers | 979 | * When interrupts are being enabled, the interrupt registers |
@@ -890,12 +982,20 @@ static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | |||
890 | if (state == STATE_RADIO_IRQ_ON) { | 982 | if (state == STATE_RADIO_IRQ_ON) { |
891 | rt2x00pci_register_read(rt2x00dev, CSR7, ®); | 983 | rt2x00pci_register_read(rt2x00dev, CSR7, ®); |
892 | rt2x00pci_register_write(rt2x00dev, CSR7, reg); | 984 | rt2x00pci_register_write(rt2x00dev, CSR7, reg); |
985 | |||
986 | /* | ||
987 | * Enable tasklets. | ||
988 | */ | ||
989 | tasklet_enable(&rt2x00dev->txstatus_tasklet); | ||
990 | tasklet_enable(&rt2x00dev->rxdone_tasklet); | ||
893 | } | 991 | } |
894 | 992 | ||
895 | /* | 993 | /* |
896 | * Only toggle the interrupts bits we are going to use. | 994 | * Only toggle the interrupts bits we are going to use. |
897 | * Non-checked interrupt bits are disabled by default. | 995 | * Non-checked interrupt bits are disabled by default. |
898 | */ | 996 | */ |
997 | spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); | ||
998 | |||
899 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); | 999 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); |
900 | rt2x00_set_field32(®, CSR8_TBCN_EXPIRE, mask); | 1000 | rt2x00_set_field32(®, CSR8_TBCN_EXPIRE, mask); |
901 | rt2x00_set_field32(®, CSR8_TXDONE_TXRING, mask); | 1001 | rt2x00_set_field32(®, CSR8_TXDONE_TXRING, mask); |
@@ -903,6 +1003,17 @@ static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | |||
903 | rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, mask); | 1003 | rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, mask); |
904 | rt2x00_set_field32(®, CSR8_RXDONE, mask); | 1004 | rt2x00_set_field32(®, CSR8_RXDONE, mask); |
905 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); | 1005 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); |
1006 | |||
1007 | spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); | ||
1008 | |||
1009 | if (state == STATE_RADIO_IRQ_OFF) { | ||
1010 | /* | ||
1011 | * Ensure that all tasklets are finished before | ||
1012 | * disabling the interrupts. | ||
1013 | */ | ||
1014 | tasklet_disable(&rt2x00dev->txstatus_tasklet); | ||
1015 | tasklet_disable(&rt2x00dev->rxdone_tasklet); | ||
1016 | } | ||
906 | } | 1017 | } |
907 | 1018 | ||
908 | static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev) | 1019 | static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev) |
@@ -974,16 +1085,8 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
974 | case STATE_RADIO_OFF: | 1085 | case STATE_RADIO_OFF: |
975 | rt2400pci_disable_radio(rt2x00dev); | 1086 | rt2400pci_disable_radio(rt2x00dev); |
976 | break; | 1087 | break; |
977 | case STATE_RADIO_RX_ON: | ||
978 | case STATE_RADIO_RX_ON_LINK: | ||
979 | case STATE_RADIO_RX_OFF: | ||
980 | case STATE_RADIO_RX_OFF_LINK: | ||
981 | rt2400pci_toggle_rx(rt2x00dev, state); | ||
982 | break; | ||
983 | case STATE_RADIO_IRQ_ON: | 1088 | case STATE_RADIO_IRQ_ON: |
984 | case STATE_RADIO_IRQ_ON_ISR: | ||
985 | case STATE_RADIO_IRQ_OFF: | 1089 | case STATE_RADIO_IRQ_OFF: |
986 | case STATE_RADIO_IRQ_OFF_ISR: | ||
987 | rt2400pci_toggle_irq(rt2x00dev, state); | 1090 | rt2400pci_toggle_irq(rt2x00dev, state); |
988 | break; | 1091 | break; |
989 | case STATE_DEEP_SLEEP: | 1092 | case STATE_DEEP_SLEEP: |
@@ -1007,12 +1110,11 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1007 | /* | 1110 | /* |
1008 | * TX descriptor initialization | 1111 | * TX descriptor initialization |
1009 | */ | 1112 | */ |
1010 | static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1113 | static void rt2400pci_write_tx_desc(struct queue_entry *entry, |
1011 | struct sk_buff *skb, | ||
1012 | struct txentry_desc *txdesc) | 1114 | struct txentry_desc *txdesc) |
1013 | { | 1115 | { |
1014 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1116 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1015 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1117 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1016 | __le32 *txd = entry_priv->desc; | 1118 | __le32 *txd = entry_priv->desc; |
1017 | u32 word; | 1119 | u32 word; |
1018 | 1120 | ||
@@ -1029,19 +1131,21 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1029 | rt2x00_desc_write(txd, 2, word); | 1131 | rt2x00_desc_write(txd, 2, word); |
1030 | 1132 | ||
1031 | rt2x00_desc_read(txd, 3, &word); | 1133 | rt2x00_desc_read(txd, 3, &word); |
1032 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL, txdesc->signal); | 1134 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL, txdesc->u.plcp.signal); |
1033 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_REGNUM, 5); | 1135 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_REGNUM, 5); |
1034 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_BUSY, 1); | 1136 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_BUSY, 1); |
1035 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE, txdesc->service); | 1137 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE, txdesc->u.plcp.service); |
1036 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_REGNUM, 6); | 1138 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_REGNUM, 6); |
1037 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_BUSY, 1); | 1139 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_BUSY, 1); |
1038 | rt2x00_desc_write(txd, 3, word); | 1140 | rt2x00_desc_write(txd, 3, word); |
1039 | 1141 | ||
1040 | rt2x00_desc_read(txd, 4, &word); | 1142 | rt2x00_desc_read(txd, 4, &word); |
1041 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_LOW, txdesc->length_low); | 1143 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_LOW, |
1144 | txdesc->u.plcp.length_low); | ||
1042 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_REGNUM, 8); | 1145 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_REGNUM, 8); |
1043 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_BUSY, 1); | 1146 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_BUSY, 1); |
1044 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_HIGH, txdesc->length_high); | 1147 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_HIGH, |
1148 | txdesc->u.plcp.length_high); | ||
1045 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_REGNUM, 7); | 1149 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_REGNUM, 7); |
1046 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); | 1150 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); |
1047 | rt2x00_desc_write(txd, 4, word); | 1151 | rt2x00_desc_write(txd, 4, word); |
@@ -1062,7 +1166,7 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1062 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | 1166 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); |
1063 | rt2x00_set_field32(&word, TXD_W0_RTS, | 1167 | rt2x00_set_field32(&word, TXD_W0_RTS, |
1064 | test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); | 1168 | test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); |
1065 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | 1169 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->u.plcp.ifs); |
1066 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, | 1170 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, |
1067 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); | 1171 | test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); |
1068 | rt2x00_desc_write(txd, 0, word); | 1172 | rt2x00_desc_write(txd, 0, word); |
@@ -1091,12 +1195,12 @@ static void rt2400pci_write_beacon(struct queue_entry *entry, | |||
1091 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | 1195 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); |
1092 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1196 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1093 | 1197 | ||
1094 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); | 1198 | rt2x00queue_map_txskb(entry); |
1095 | 1199 | ||
1096 | /* | 1200 | /* |
1097 | * Write the TX descriptor for the beacon. | 1201 | * Write the TX descriptor for the beacon. |
1098 | */ | 1202 | */ |
1099 | rt2400pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1203 | rt2400pci_write_tx_desc(entry, txdesc); |
1100 | 1204 | ||
1101 | /* | 1205 | /* |
1102 | * Dump beacon to userspace through debugfs. | 1206 | * Dump beacon to userspace through debugfs. |
@@ -1106,38 +1210,10 @@ static void rt2400pci_write_beacon(struct queue_entry *entry, | |||
1106 | /* | 1210 | /* |
1107 | * Enable beaconing again. | 1211 | * Enable beaconing again. |
1108 | */ | 1212 | */ |
1109 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1110 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1111 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | 1213 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); |
1112 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1214 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1113 | } | 1215 | } |
1114 | 1216 | ||
1115 | static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
1116 | const enum data_queue_qid queue) | ||
1117 | { | ||
1118 | u32 reg; | ||
1119 | |||
1120 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
1121 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | ||
1122 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | ||
1123 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue == QID_ATIM)); | ||
1124 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
1125 | } | ||
1126 | |||
1127 | static void rt2400pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
1128 | const enum data_queue_qid qid) | ||
1129 | { | ||
1130 | u32 reg; | ||
1131 | |||
1132 | if (qid == QID_BEACON) { | ||
1133 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | ||
1134 | } else { | ||
1135 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
1136 | rt2x00_set_field32(®, TXCSR0_ABORT, 1); | ||
1137 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
1138 | } | ||
1139 | } | ||
1140 | |||
1141 | /* | 1217 | /* |
1142 | * RX control handlers | 1218 | * RX control handlers |
1143 | */ | 1219 | */ |
@@ -1202,7 +1278,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry, | |||
1202 | static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, | 1278 | static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, |
1203 | const enum data_queue_qid queue_idx) | 1279 | const enum data_queue_qid queue_idx) |
1204 | { | 1280 | { |
1205 | struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); | 1281 | struct data_queue *queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); |
1206 | struct queue_entry_priv_pci *entry_priv; | 1282 | struct queue_entry_priv_pci *entry_priv; |
1207 | struct queue_entry *entry; | 1283 | struct queue_entry *entry; |
1208 | struct txdone_entry_desc txdesc; | 1284 | struct txdone_entry_desc txdesc; |
@@ -1238,57 +1314,70 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, | |||
1238 | } | 1314 | } |
1239 | } | 1315 | } |
1240 | 1316 | ||
1241 | static irqreturn_t rt2400pci_interrupt_thread(int irq, void *dev_instance) | 1317 | static inline void rt2400pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, |
1318 | struct rt2x00_field32 irq_field) | ||
1242 | { | 1319 | { |
1243 | struct rt2x00_dev *rt2x00dev = dev_instance; | 1320 | u32 reg; |
1244 | u32 reg = rt2x00dev->irqvalue[0]; | ||
1245 | 1321 | ||
1246 | /* | 1322 | /* |
1247 | * Handle interrupts, walk through all bits | 1323 | * Enable a single interrupt. The interrupt mask register |
1248 | * and run the tasks, the bits are checked in order of | 1324 | * access needs locking. |
1249 | * priority. | ||
1250 | */ | 1325 | */ |
1326 | spin_lock_irq(&rt2x00dev->irqmask_lock); | ||
1251 | 1327 | ||
1252 | /* | 1328 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); |
1253 | * 1 - Beacon timer expired interrupt. | 1329 | rt2x00_set_field32(®, irq_field, 0); |
1254 | */ | 1330 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); |
1255 | if (rt2x00_get_field32(reg, CSR7_TBCN_EXPIRE)) | ||
1256 | rt2x00lib_beacondone(rt2x00dev); | ||
1257 | 1331 | ||
1258 | /* | 1332 | spin_unlock_irq(&rt2x00dev->irqmask_lock); |
1259 | * 2 - Rx ring done interrupt. | 1333 | } |
1260 | */ | ||
1261 | if (rt2x00_get_field32(reg, CSR7_RXDONE)) | ||
1262 | rt2x00pci_rxdone(rt2x00dev); | ||
1263 | 1334 | ||
1264 | /* | 1335 | static void rt2400pci_txstatus_tasklet(unsigned long data) |
1265 | * 3 - Atim ring transmit done interrupt. | 1336 | { |
1266 | */ | 1337 | struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; |
1267 | if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING)) | 1338 | u32 reg; |
1268 | rt2400pci_txdone(rt2x00dev, QID_ATIM); | ||
1269 | 1339 | ||
1270 | /* | 1340 | /* |
1271 | * 4 - Priority ring transmit done interrupt. | 1341 | * Handle all tx queues. |
1272 | */ | 1342 | */ |
1273 | if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) | 1343 | rt2400pci_txdone(rt2x00dev, QID_ATIM); |
1274 | rt2400pci_txdone(rt2x00dev, QID_AC_BE); | 1344 | rt2400pci_txdone(rt2x00dev, QID_AC_VO); |
1345 | rt2400pci_txdone(rt2x00dev, QID_AC_VI); | ||
1275 | 1346 | ||
1276 | /* | 1347 | /* |
1277 | * 5 - Tx ring transmit done interrupt. | 1348 | * Enable all TXDONE interrupts again. |
1278 | */ | 1349 | */ |
1279 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) | 1350 | spin_lock_irq(&rt2x00dev->irqmask_lock); |
1280 | rt2400pci_txdone(rt2x00dev, QID_AC_BK); | ||
1281 | 1351 | ||
1282 | /* Enable interrupts again. */ | 1352 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); |
1283 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 1353 | rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0); |
1284 | STATE_RADIO_IRQ_ON_ISR); | 1354 | rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, 0); |
1285 | return IRQ_HANDLED; | 1355 | rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); |
1356 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); | ||
1357 | |||
1358 | spin_unlock_irq(&rt2x00dev->irqmask_lock); | ||
1359 | } | ||
1360 | |||
1361 | static void rt2400pci_tbtt_tasklet(unsigned long data) | ||
1362 | { | ||
1363 | struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; | ||
1364 | rt2x00lib_beacondone(rt2x00dev); | ||
1365 | rt2400pci_enable_interrupt(rt2x00dev, CSR8_TBCN_EXPIRE); | ||
1366 | } | ||
1367 | |||
1368 | static void rt2400pci_rxdone_tasklet(unsigned long data) | ||
1369 | { | ||
1370 | struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; | ||
1371 | if (rt2x00pci_rxdone(rt2x00dev)) | ||
1372 | tasklet_schedule(&rt2x00dev->rxdone_tasklet); | ||
1373 | else | ||
1374 | rt2400pci_enable_interrupt(rt2x00dev, CSR8_RXDONE); | ||
1286 | } | 1375 | } |
1287 | 1376 | ||
1288 | static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance) | 1377 | static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance) |
1289 | { | 1378 | { |
1290 | struct rt2x00_dev *rt2x00dev = dev_instance; | 1379 | struct rt2x00_dev *rt2x00dev = dev_instance; |
1291 | u32 reg; | 1380 | u32 reg, mask; |
1292 | 1381 | ||
1293 | /* | 1382 | /* |
1294 | * Get the interrupt sources & saved to local variable. | 1383 | * Get the interrupt sources & saved to local variable. |
@@ -1303,14 +1392,44 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance) | |||
1303 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | 1392 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
1304 | return IRQ_HANDLED; | 1393 | return IRQ_HANDLED; |
1305 | 1394 | ||
1306 | /* Store irqvalues for use in the interrupt thread. */ | 1395 | mask = reg; |
1307 | rt2x00dev->irqvalue[0] = reg; | 1396 | |
1397 | /* | ||
1398 | * Schedule tasklets for interrupt handling. | ||
1399 | */ | ||
1400 | if (rt2x00_get_field32(reg, CSR7_TBCN_EXPIRE)) | ||
1401 | tasklet_hi_schedule(&rt2x00dev->tbtt_tasklet); | ||
1402 | |||
1403 | if (rt2x00_get_field32(reg, CSR7_RXDONE)) | ||
1404 | tasklet_schedule(&rt2x00dev->rxdone_tasklet); | ||
1405 | |||
1406 | if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING) || | ||
1407 | rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING) || | ||
1408 | rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) { | ||
1409 | tasklet_schedule(&rt2x00dev->txstatus_tasklet); | ||
1410 | /* | ||
1411 | * Mask out all txdone interrupts. | ||
1412 | */ | ||
1413 | rt2x00_set_field32(&mask, CSR8_TXDONE_TXRING, 1); | ||
1414 | rt2x00_set_field32(&mask, CSR8_TXDONE_ATIMRING, 1); | ||
1415 | rt2x00_set_field32(&mask, CSR8_TXDONE_PRIORING, 1); | ||
1416 | } | ||
1417 | |||
1418 | /* | ||
1419 | * Disable all interrupts for which a tasklet was scheduled right now, | ||
1420 | * the tasklet will reenable the appropriate interrupts. | ||
1421 | */ | ||
1422 | spin_lock(&rt2x00dev->irqmask_lock); | ||
1423 | |||
1424 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); | ||
1425 | reg |= mask; | ||
1426 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); | ||
1427 | |||
1428 | spin_unlock(&rt2x00dev->irqmask_lock); | ||
1429 | |||
1308 | 1430 | ||
1309 | /* Disable interrupts, will be enabled again in the interrupt thread. */ | ||
1310 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | ||
1311 | STATE_RADIO_IRQ_OFF_ISR); | ||
1312 | 1431 | ||
1313 | return IRQ_WAKE_THREAD; | 1432 | return IRQ_HANDLED; |
1314 | } | 1433 | } |
1315 | 1434 | ||
1316 | /* | 1435 | /* |
@@ -1417,13 +1536,13 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1417 | * Detect if this device has an hardware controlled radio. | 1536 | * Detect if this device has an hardware controlled radio. |
1418 | */ | 1537 | */ |
1419 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1538 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1420 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1539 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); |
1421 | 1540 | ||
1422 | /* | 1541 | /* |
1423 | * Check if the BBP tuning should be enabled. | 1542 | * Check if the BBP tuning should be enabled. |
1424 | */ | 1543 | */ |
1425 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING)) | 1544 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING)) |
1426 | __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); | 1545 | __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); |
1427 | 1546 | ||
1428 | return 0; | 1547 | return 0; |
1429 | } | 1548 | } |
@@ -1481,15 +1600,17 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1481 | /* | 1600 | /* |
1482 | * Create channel information array | 1601 | * Create channel information array |
1483 | */ | 1602 | */ |
1484 | info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); | 1603 | info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); |
1485 | if (!info) | 1604 | if (!info) |
1486 | return -ENOMEM; | 1605 | return -ENOMEM; |
1487 | 1606 | ||
1488 | spec->channels_info = info; | 1607 | spec->channels_info = info; |
1489 | 1608 | ||
1490 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1609 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1491 | for (i = 0; i < 14; i++) | 1610 | for (i = 0; i < 14; i++) { |
1492 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1611 | info[i].max_power = TXPOWER_FROM_DEV(MAX_TXPOWER); |
1612 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1613 | } | ||
1493 | 1614 | ||
1494 | return 0; | 1615 | return 0; |
1495 | } | 1616 | } |
@@ -1519,8 +1640,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1519 | /* | 1640 | /* |
1520 | * This device requires the atim queue and DMA-mapped skbs. | 1641 | * This device requires the atim queue and DMA-mapped skbs. |
1521 | */ | 1642 | */ |
1522 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); | 1643 | __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags); |
1523 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | 1644 | __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags); |
1645 | __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags); | ||
1524 | 1646 | ||
1525 | /* | 1647 | /* |
1526 | * Set the rssi offset. | 1648 | * Set the rssi offset. |
@@ -1597,11 +1719,17 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = { | |||
1597 | .get_tsf = rt2400pci_get_tsf, | 1719 | .get_tsf = rt2400pci_get_tsf, |
1598 | .tx_last_beacon = rt2400pci_tx_last_beacon, | 1720 | .tx_last_beacon = rt2400pci_tx_last_beacon, |
1599 | .rfkill_poll = rt2x00mac_rfkill_poll, | 1721 | .rfkill_poll = rt2x00mac_rfkill_poll, |
1722 | .flush = rt2x00mac_flush, | ||
1723 | .set_antenna = rt2x00mac_set_antenna, | ||
1724 | .get_antenna = rt2x00mac_get_antenna, | ||
1725 | .get_ringparam = rt2x00mac_get_ringparam, | ||
1600 | }; | 1726 | }; |
1601 | 1727 | ||
1602 | static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | 1728 | static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { |
1603 | .irq_handler = rt2400pci_interrupt, | 1729 | .irq_handler = rt2400pci_interrupt, |
1604 | .irq_handler_thread = rt2400pci_interrupt_thread, | 1730 | .txstatus_tasklet = rt2400pci_txstatus_tasklet, |
1731 | .tbtt_tasklet = rt2400pci_tbtt_tasklet, | ||
1732 | .rxdone_tasklet = rt2400pci_rxdone_tasklet, | ||
1605 | .probe_hw = rt2400pci_probe_hw, | 1733 | .probe_hw = rt2400pci_probe_hw, |
1606 | .initialize = rt2x00pci_initialize, | 1734 | .initialize = rt2x00pci_initialize, |
1607 | .uninitialize = rt2x00pci_uninitialize, | 1735 | .uninitialize = rt2x00pci_uninitialize, |
@@ -1612,10 +1740,12 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | |||
1612 | .link_stats = rt2400pci_link_stats, | 1740 | .link_stats = rt2400pci_link_stats, |
1613 | .reset_tuner = rt2400pci_reset_tuner, | 1741 | .reset_tuner = rt2400pci_reset_tuner, |
1614 | .link_tuner = rt2400pci_link_tuner, | 1742 | .link_tuner = rt2400pci_link_tuner, |
1743 | .start_queue = rt2400pci_start_queue, | ||
1744 | .kick_queue = rt2400pci_kick_queue, | ||
1745 | .stop_queue = rt2400pci_stop_queue, | ||
1746 | .flush_queue = rt2x00pci_flush_queue, | ||
1615 | .write_tx_desc = rt2400pci_write_tx_desc, | 1747 | .write_tx_desc = rt2400pci_write_tx_desc, |
1616 | .write_beacon = rt2400pci_write_beacon, | 1748 | .write_beacon = rt2400pci_write_beacon, |
1617 | .kick_tx_queue = rt2400pci_kick_tx_queue, | ||
1618 | .kill_tx_queue = rt2400pci_kill_tx_queue, | ||
1619 | .fill_rxdone = rt2400pci_fill_rxdone, | 1749 | .fill_rxdone = rt2400pci_fill_rxdone, |
1620 | .config_filter = rt2400pci_config_filter, | 1750 | .config_filter = rt2400pci_config_filter, |
1621 | .config_intf = rt2400pci_config_intf, | 1751 | .config_intf = rt2400pci_config_intf, |
@@ -1625,28 +1755,28 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | |||
1625 | }; | 1755 | }; |
1626 | 1756 | ||
1627 | static const struct data_queue_desc rt2400pci_queue_rx = { | 1757 | static const struct data_queue_desc rt2400pci_queue_rx = { |
1628 | .entry_num = RX_ENTRIES, | 1758 | .entry_num = 24, |
1629 | .data_size = DATA_FRAME_SIZE, | 1759 | .data_size = DATA_FRAME_SIZE, |
1630 | .desc_size = RXD_DESC_SIZE, | 1760 | .desc_size = RXD_DESC_SIZE, |
1631 | .priv_size = sizeof(struct queue_entry_priv_pci), | 1761 | .priv_size = sizeof(struct queue_entry_priv_pci), |
1632 | }; | 1762 | }; |
1633 | 1763 | ||
1634 | static const struct data_queue_desc rt2400pci_queue_tx = { | 1764 | static const struct data_queue_desc rt2400pci_queue_tx = { |
1635 | .entry_num = TX_ENTRIES, | 1765 | .entry_num = 24, |
1636 | .data_size = DATA_FRAME_SIZE, | 1766 | .data_size = DATA_FRAME_SIZE, |
1637 | .desc_size = TXD_DESC_SIZE, | 1767 | .desc_size = TXD_DESC_SIZE, |
1638 | .priv_size = sizeof(struct queue_entry_priv_pci), | 1768 | .priv_size = sizeof(struct queue_entry_priv_pci), |
1639 | }; | 1769 | }; |
1640 | 1770 | ||
1641 | static const struct data_queue_desc rt2400pci_queue_bcn = { | 1771 | static const struct data_queue_desc rt2400pci_queue_bcn = { |
1642 | .entry_num = BEACON_ENTRIES, | 1772 | .entry_num = 1, |
1643 | .data_size = MGMT_FRAME_SIZE, | 1773 | .data_size = MGMT_FRAME_SIZE, |
1644 | .desc_size = TXD_DESC_SIZE, | 1774 | .desc_size = TXD_DESC_SIZE, |
1645 | .priv_size = sizeof(struct queue_entry_priv_pci), | 1775 | .priv_size = sizeof(struct queue_entry_priv_pci), |
1646 | }; | 1776 | }; |
1647 | 1777 | ||
1648 | static const struct data_queue_desc rt2400pci_queue_atim = { | 1778 | static const struct data_queue_desc rt2400pci_queue_atim = { |
1649 | .entry_num = ATIM_ENTRIES, | 1779 | .entry_num = 8, |
1650 | .data_size = DATA_FRAME_SIZE, | 1780 | .data_size = DATA_FRAME_SIZE, |
1651 | .desc_size = TXD_DESC_SIZE, | 1781 | .desc_size = TXD_DESC_SIZE, |
1652 | .priv_size = sizeof(struct queue_entry_priv_pci), | 1782 | .priv_size = sizeof(struct queue_entry_priv_pci), |
@@ -1675,10 +1805,11 @@ static const struct rt2x00_ops rt2400pci_ops = { | |||
1675 | * RT2400pci module information. | 1805 | * RT2400pci module information. |
1676 | */ | 1806 | */ |
1677 | static DEFINE_PCI_DEVICE_TABLE(rt2400pci_device_table) = { | 1807 | static DEFINE_PCI_DEVICE_TABLE(rt2400pci_device_table) = { |
1678 | { PCI_DEVICE(0x1814, 0x0101), PCI_DEVICE_DATA(&rt2400pci_ops) }, | 1808 | { PCI_DEVICE(0x1814, 0x0101) }, |
1679 | { 0, } | 1809 | { 0, } |
1680 | }; | 1810 | }; |
1681 | 1811 | ||
1812 | |||
1682 | MODULE_AUTHOR(DRV_PROJECT); | 1813 | MODULE_AUTHOR(DRV_PROJECT); |
1683 | MODULE_VERSION(DRV_VERSION); | 1814 | MODULE_VERSION(DRV_VERSION); |
1684 | MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver."); | 1815 | MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver."); |
@@ -1686,10 +1817,16 @@ MODULE_SUPPORTED_DEVICE("Ralink RT2460 PCI & PCMCIA chipset based cards"); | |||
1686 | MODULE_DEVICE_TABLE(pci, rt2400pci_device_table); | 1817 | MODULE_DEVICE_TABLE(pci, rt2400pci_device_table); |
1687 | MODULE_LICENSE("GPL"); | 1818 | MODULE_LICENSE("GPL"); |
1688 | 1819 | ||
1820 | static int rt2400pci_probe(struct pci_dev *pci_dev, | ||
1821 | const struct pci_device_id *id) | ||
1822 | { | ||
1823 | return rt2x00pci_probe(pci_dev, &rt2400pci_ops); | ||
1824 | } | ||
1825 | |||
1689 | static struct pci_driver rt2400pci_driver = { | 1826 | static struct pci_driver rt2400pci_driver = { |
1690 | .name = KBUILD_MODNAME, | 1827 | .name = KBUILD_MODNAME, |
1691 | .id_table = rt2400pci_device_table, | 1828 | .id_table = rt2400pci_device_table, |
1692 | .probe = rt2x00pci_probe, | 1829 | .probe = rt2400pci_probe, |
1693 | .remove = __devexit_p(rt2x00pci_remove), | 1830 | .remove = __devexit_p(rt2x00pci_remove), |
1694 | .suspend = rt2x00pci_suspend, | 1831 | .suspend = rt2x00pci_suspend, |
1695 | .resume = rt2x00pci_resume, | 1832 | .resume = rt2x00pci_resume, |