diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-12-22 14:27:21 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-22 14:27:21 -0500 |
commit | 63e35cd9bd4c8ae085c8b9a70554595b529c4100 (patch) | |
tree | 68e771e0035d5f3ee394a3d86885631a2610bba5 /drivers/net/wireless/rt2x00 | |
parent | 503b1a529a6b62b31904bab4699752c523cf76b2 (diff) | |
parent | 3d986b25b5faa50ba6afd94f60f270b6c3061e5e (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-core.h
Diffstat (limited to 'drivers/net/wireless/rt2x00')
25 files changed, 1329 insertions, 667 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 9ec6691adf0d..54ca49ad3472 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -633,6 +633,88 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev, | |||
633 | } | 633 | } |
634 | 634 | ||
635 | /* | 635 | /* |
636 | * Queue handlers. | ||
637 | */ | ||
638 | static void rt2400pci_start_queue(struct data_queue *queue) | ||
639 | { | ||
640 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
641 | u32 reg; | ||
642 | |||
643 | switch (queue->qid) { | ||
644 | case QID_RX: | ||
645 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
646 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); | ||
647 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
648 | break; | ||
649 | case QID_BEACON: | ||
650 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
651 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
652 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
653 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
654 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
655 | break; | ||
656 | default: | ||
657 | break; | ||
658 | } | ||
659 | } | ||
660 | |||
661 | static void rt2400pci_kick_queue(struct data_queue *queue) | ||
662 | { | ||
663 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
664 | u32 reg; | ||
665 | |||
666 | switch (queue->qid) { | ||
667 | case QID_AC_VO: | ||
668 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
669 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); | ||
670 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
671 | break; | ||
672 | case QID_AC_VI: | ||
673 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
674 | rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); | ||
675 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
676 | break; | ||
677 | case QID_ATIM: | ||
678 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
679 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); | ||
680 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
681 | break; | ||
682 | default: | ||
683 | break; | ||
684 | } | ||
685 | } | ||
686 | |||
687 | static void rt2400pci_stop_queue(struct data_queue *queue) | ||
688 | { | ||
689 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
690 | u32 reg; | ||
691 | |||
692 | switch (queue->qid) { | ||
693 | case QID_AC_VO: | ||
694 | case QID_AC_VI: | ||
695 | case QID_ATIM: | ||
696 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
697 | rt2x00_set_field32(®, TXCSR0_ABORT, 1); | ||
698 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
699 | break; | ||
700 | case QID_RX: | ||
701 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
702 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); | ||
703 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
704 | break; | ||
705 | case QID_BEACON: | ||
706 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
707 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); | ||
708 | rt2x00_set_field32(®, CSR14_TBCN, 0); | ||
709 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | ||
710 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
711 | break; | ||
712 | default: | ||
713 | break; | ||
714 | } | ||
715 | } | ||
716 | |||
717 | /* | ||
636 | * Initialization functions. | 718 | * Initialization functions. |
637 | */ | 719 | */ |
638 | static bool rt2400pci_get_entry_state(struct queue_entry *entry) | 720 | static bool rt2400pci_get_entry_state(struct queue_entry *entry) |
@@ -878,17 +960,6 @@ static int rt2400pci_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
878 | /* | 960 | /* |
879 | * Device state switch handlers. | 961 | * Device state switch handlers. |
880 | */ | 962 | */ |
881 | static void rt2400pci_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
882 | enum dev_state state) | ||
883 | { | ||
884 | u32 reg; | ||
885 | |||
886 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
887 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, | ||
888 | (state == STATE_RADIO_RX_OFF)); | ||
889 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
890 | } | ||
891 | |||
892 | static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | 963 | static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, |
893 | enum dev_state state) | 964 | enum dev_state state) |
894 | { | 965 | { |
@@ -987,10 +1058,6 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
987 | case STATE_RADIO_OFF: | 1058 | case STATE_RADIO_OFF: |
988 | rt2400pci_disable_radio(rt2x00dev); | 1059 | rt2400pci_disable_radio(rt2x00dev); |
989 | break; | 1060 | break; |
990 | case STATE_RADIO_RX_ON: | ||
991 | case STATE_RADIO_RX_OFF: | ||
992 | rt2400pci_toggle_rx(rt2x00dev, state); | ||
993 | break; | ||
994 | case STATE_RADIO_IRQ_ON: | 1061 | case STATE_RADIO_IRQ_ON: |
995 | case STATE_RADIO_IRQ_ON_ISR: | 1062 | case STATE_RADIO_IRQ_ON_ISR: |
996 | case STATE_RADIO_IRQ_OFF: | 1063 | case STATE_RADIO_IRQ_OFF: |
@@ -1122,32 +1189,6 @@ static void rt2400pci_write_beacon(struct queue_entry *entry, | |||
1122 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1189 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1123 | } | 1190 | } |
1124 | 1191 | ||
1125 | static void rt2400pci_kick_tx_queue(struct data_queue *queue) | ||
1126 | { | ||
1127 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1128 | u32 reg; | ||
1129 | |||
1130 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
1131 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE)); | ||
1132 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK)); | ||
1133 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM)); | ||
1134 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
1135 | } | ||
1136 | |||
1137 | static void rt2400pci_kill_tx_queue(struct data_queue *queue) | ||
1138 | { | ||
1139 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1140 | u32 reg; | ||
1141 | |||
1142 | if (queue->qid == QID_BEACON) { | ||
1143 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | ||
1144 | } else { | ||
1145 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
1146 | rt2x00_set_field32(®, TXCSR0_ABORT, 1); | ||
1147 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
1148 | } | ||
1149 | } | ||
1150 | |||
1151 | /* | 1192 | /* |
1152 | * RX control handlers | 1193 | * RX control handlers |
1153 | */ | 1194 | */ |
@@ -1281,13 +1322,13 @@ static irqreturn_t rt2400pci_interrupt_thread(int irq, void *dev_instance) | |||
1281 | * 4 - Priority ring transmit done interrupt. | 1322 | * 4 - Priority ring transmit done interrupt. |
1282 | */ | 1323 | */ |
1283 | if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) | 1324 | if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) |
1284 | rt2400pci_txdone(rt2x00dev, QID_AC_BE); | 1325 | rt2400pci_txdone(rt2x00dev, QID_AC_VO); |
1285 | 1326 | ||
1286 | /* | 1327 | /* |
1287 | * 5 - Tx ring transmit done interrupt. | 1328 | * 5 - Tx ring transmit done interrupt. |
1288 | */ | 1329 | */ |
1289 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) | 1330 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) |
1290 | rt2400pci_txdone(rt2x00dev, QID_AC_BK); | 1331 | rt2400pci_txdone(rt2x00dev, QID_AC_VI); |
1291 | 1332 | ||
1292 | /* Enable interrupts again. */ | 1333 | /* Enable interrupts again. */ |
1293 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 1334 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, |
@@ -1625,10 +1666,11 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | |||
1625 | .link_stats = rt2400pci_link_stats, | 1666 | .link_stats = rt2400pci_link_stats, |
1626 | .reset_tuner = rt2400pci_reset_tuner, | 1667 | .reset_tuner = rt2400pci_reset_tuner, |
1627 | .link_tuner = rt2400pci_link_tuner, | 1668 | .link_tuner = rt2400pci_link_tuner, |
1669 | .start_queue = rt2400pci_start_queue, | ||
1670 | .kick_queue = rt2400pci_kick_queue, | ||
1671 | .stop_queue = rt2400pci_stop_queue, | ||
1628 | .write_tx_desc = rt2400pci_write_tx_desc, | 1672 | .write_tx_desc = rt2400pci_write_tx_desc, |
1629 | .write_beacon = rt2400pci_write_beacon, | 1673 | .write_beacon = rt2400pci_write_beacon, |
1630 | .kick_tx_queue = rt2400pci_kick_tx_queue, | ||
1631 | .kill_tx_queue = rt2400pci_kill_tx_queue, | ||
1632 | .fill_rxdone = rt2400pci_fill_rxdone, | 1674 | .fill_rxdone = rt2400pci_fill_rxdone, |
1633 | .config_filter = rt2400pci_config_filter, | 1675 | .config_filter = rt2400pci_config_filter, |
1634 | .config_intf = rt2400pci_config_intf, | 1676 | .config_intf = rt2400pci_config_intf, |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 3e7f20346243..a9ff26a27724 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -723,6 +723,88 @@ dynamic_cca_tune: | |||
723 | } | 723 | } |
724 | 724 | ||
725 | /* | 725 | /* |
726 | * Queue handlers. | ||
727 | */ | ||
728 | static void rt2500pci_start_queue(struct data_queue *queue) | ||
729 | { | ||
730 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
731 | u32 reg; | ||
732 | |||
733 | switch (queue->qid) { | ||
734 | case QID_RX: | ||
735 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
736 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); | ||
737 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
738 | break; | ||
739 | case QID_BEACON: | ||
740 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
741 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
742 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
743 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
744 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
745 | break; | ||
746 | default: | ||
747 | break; | ||
748 | } | ||
749 | } | ||
750 | |||
751 | static void rt2500pci_kick_queue(struct data_queue *queue) | ||
752 | { | ||
753 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
754 | u32 reg; | ||
755 | |||
756 | switch (queue->qid) { | ||
757 | case QID_AC_VO: | ||
758 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
759 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); | ||
760 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
761 | break; | ||
762 | case QID_AC_VI: | ||
763 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
764 | rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); | ||
765 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
766 | break; | ||
767 | case QID_ATIM: | ||
768 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
769 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); | ||
770 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
771 | break; | ||
772 | default: | ||
773 | break; | ||
774 | } | ||
775 | } | ||
776 | |||
777 | static void rt2500pci_stop_queue(struct data_queue *queue) | ||
778 | { | ||
779 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
780 | u32 reg; | ||
781 | |||
782 | switch (queue->qid) { | ||
783 | case QID_AC_VO: | ||
784 | case QID_AC_VI: | ||
785 | case QID_ATIM: | ||
786 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
787 | rt2x00_set_field32(®, TXCSR0_ABORT, 1); | ||
788 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
789 | break; | ||
790 | case QID_RX: | ||
791 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
792 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); | ||
793 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
794 | break; | ||
795 | case QID_BEACON: | ||
796 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
797 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); | ||
798 | rt2x00_set_field32(®, CSR14_TBCN, 0); | ||
799 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | ||
800 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
801 | break; | ||
802 | default: | ||
803 | break; | ||
804 | } | ||
805 | } | ||
806 | |||
807 | /* | ||
726 | * Initialization functions. | 808 | * Initialization functions. |
727 | */ | 809 | */ |
728 | static bool rt2500pci_get_entry_state(struct queue_entry *entry) | 810 | static bool rt2500pci_get_entry_state(struct queue_entry *entry) |
@@ -1033,17 +1115,6 @@ static int rt2500pci_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
1033 | /* | 1115 | /* |
1034 | * Device state switch handlers. | 1116 | * Device state switch handlers. |
1035 | */ | 1117 | */ |
1036 | static void rt2500pci_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
1037 | enum dev_state state) | ||
1038 | { | ||
1039 | u32 reg; | ||
1040 | |||
1041 | rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); | ||
1042 | rt2x00_set_field32(®, RXCSR0_DISABLE_RX, | ||
1043 | (state == STATE_RADIO_RX_OFF)); | ||
1044 | rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); | ||
1045 | } | ||
1046 | |||
1047 | static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | 1118 | static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, |
1048 | enum dev_state state) | 1119 | enum dev_state state) |
1049 | { | 1120 | { |
@@ -1142,10 +1213,6 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1142 | case STATE_RADIO_OFF: | 1213 | case STATE_RADIO_OFF: |
1143 | rt2500pci_disable_radio(rt2x00dev); | 1214 | rt2500pci_disable_radio(rt2x00dev); |
1144 | break; | 1215 | break; |
1145 | case STATE_RADIO_RX_ON: | ||
1146 | case STATE_RADIO_RX_OFF: | ||
1147 | rt2500pci_toggle_rx(rt2x00dev, state); | ||
1148 | break; | ||
1149 | case STATE_RADIO_IRQ_ON: | 1216 | case STATE_RADIO_IRQ_ON: |
1150 | case STATE_RADIO_IRQ_ON_ISR: | 1217 | case STATE_RADIO_IRQ_ON_ISR: |
1151 | case STATE_RADIO_IRQ_OFF: | 1218 | case STATE_RADIO_IRQ_OFF: |
@@ -1276,32 +1343,6 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1276 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1343 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1277 | } | 1344 | } |
1278 | 1345 | ||
1279 | static void rt2500pci_kick_tx_queue(struct data_queue *queue) | ||
1280 | { | ||
1281 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1282 | u32 reg; | ||
1283 | |||
1284 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
1285 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE)); | ||
1286 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK)); | ||
1287 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM)); | ||
1288 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
1289 | } | ||
1290 | |||
1291 | static void rt2500pci_kill_tx_queue(struct data_queue *queue) | ||
1292 | { | ||
1293 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1294 | u32 reg; | ||
1295 | |||
1296 | if (queue->qid == QID_BEACON) { | ||
1297 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | ||
1298 | } else { | ||
1299 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | ||
1300 | rt2x00_set_field32(®, TXCSR0_ABORT, 1); | ||
1301 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | ||
1302 | } | ||
1303 | } | ||
1304 | |||
1305 | /* | 1346 | /* |
1306 | * RX control handlers | 1347 | * RX control handlers |
1307 | */ | 1348 | */ |
@@ -1414,13 +1455,13 @@ static irqreturn_t rt2500pci_interrupt_thread(int irq, void *dev_instance) | |||
1414 | * 4 - Priority ring transmit done interrupt. | 1455 | * 4 - Priority ring transmit done interrupt. |
1415 | */ | 1456 | */ |
1416 | if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) | 1457 | if (rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING)) |
1417 | rt2500pci_txdone(rt2x00dev, QID_AC_BE); | 1458 | rt2500pci_txdone(rt2x00dev, QID_AC_VO); |
1418 | 1459 | ||
1419 | /* | 1460 | /* |
1420 | * 5 - Tx ring transmit done interrupt. | 1461 | * 5 - Tx ring transmit done interrupt. |
1421 | */ | 1462 | */ |
1422 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) | 1463 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) |
1423 | rt2500pci_txdone(rt2x00dev, QID_AC_BK); | 1464 | rt2500pci_txdone(rt2x00dev, QID_AC_VI); |
1424 | 1465 | ||
1425 | /* Enable interrupts again. */ | 1466 | /* Enable interrupts again. */ |
1426 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 1467 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, |
@@ -1922,10 +1963,11 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | |||
1922 | .link_stats = rt2500pci_link_stats, | 1963 | .link_stats = rt2500pci_link_stats, |
1923 | .reset_tuner = rt2500pci_reset_tuner, | 1964 | .reset_tuner = rt2500pci_reset_tuner, |
1924 | .link_tuner = rt2500pci_link_tuner, | 1965 | .link_tuner = rt2500pci_link_tuner, |
1966 | .start_queue = rt2500pci_start_queue, | ||
1967 | .kick_queue = rt2500pci_kick_queue, | ||
1968 | .stop_queue = rt2500pci_stop_queue, | ||
1925 | .write_tx_desc = rt2500pci_write_tx_desc, | 1969 | .write_tx_desc = rt2500pci_write_tx_desc, |
1926 | .write_beacon = rt2500pci_write_beacon, | 1970 | .write_beacon = rt2500pci_write_beacon, |
1927 | .kick_tx_queue = rt2500pci_kick_tx_queue, | ||
1928 | .kill_tx_queue = rt2500pci_kill_tx_queue, | ||
1929 | .fill_rxdone = rt2500pci_fill_rxdone, | 1971 | .fill_rxdone = rt2500pci_fill_rxdone, |
1930 | .config_filter = rt2500pci_config_filter, | 1972 | .config_filter = rt2500pci_config_filter, |
1931 | .config_intf = rt2500pci_config_intf, | 1973 | .config_intf = rt2500pci_config_intf, |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 8152fec31753..6b3b1de46792 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -739,6 +739,55 @@ static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev, | |||
739 | } | 739 | } |
740 | 740 | ||
741 | /* | 741 | /* |
742 | * Queue handlers. | ||
743 | */ | ||
744 | static void rt2500usb_start_queue(struct data_queue *queue) | ||
745 | { | ||
746 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
747 | u16 reg; | ||
748 | |||
749 | switch (queue->qid) { | ||
750 | case QID_RX: | ||
751 | rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); | ||
752 | rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX, 0); | ||
753 | rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); | ||
754 | break; | ||
755 | case QID_BEACON: | ||
756 | rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); | ||
757 | rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); | ||
758 | rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); | ||
759 | rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); | ||
760 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
761 | break; | ||
762 | default: | ||
763 | break; | ||
764 | } | ||
765 | } | ||
766 | |||
767 | static void rt2500usb_stop_queue(struct data_queue *queue) | ||
768 | { | ||
769 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
770 | u16 reg; | ||
771 | |||
772 | switch (queue->qid) { | ||
773 | case QID_RX: | ||
774 | rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); | ||
775 | rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX, 1); | ||
776 | rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); | ||
777 | break; | ||
778 | case QID_BEACON: | ||
779 | rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); | ||
780 | rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 0); | ||
781 | rt2x00_set_field16(®, TXRX_CSR19_TBCN, 0); | ||
782 | rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 0); | ||
783 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
784 | break; | ||
785 | default: | ||
786 | break; | ||
787 | } | ||
788 | } | ||
789 | |||
790 | /* | ||
742 | * Initialization functions. | 791 | * Initialization functions. |
743 | */ | 792 | */ |
744 | static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) | 793 | static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) |
@@ -931,17 +980,6 @@ static int rt2500usb_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
931 | /* | 980 | /* |
932 | * Device state switch handlers. | 981 | * Device state switch handlers. |
933 | */ | 982 | */ |
934 | static void rt2500usb_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
935 | enum dev_state state) | ||
936 | { | ||
937 | u16 reg; | ||
938 | |||
939 | rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); | ||
940 | rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX, | ||
941 | (state == STATE_RADIO_RX_OFF)); | ||
942 | rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); | ||
943 | } | ||
944 | |||
945 | static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev) | 983 | static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev) |
946 | { | 984 | { |
947 | /* | 985 | /* |
@@ -1017,10 +1055,6 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1017 | case STATE_RADIO_OFF: | 1055 | case STATE_RADIO_OFF: |
1018 | rt2500usb_disable_radio(rt2x00dev); | 1056 | rt2500usb_disable_radio(rt2x00dev); |
1019 | break; | 1057 | break; |
1020 | case STATE_RADIO_RX_ON: | ||
1021 | case STATE_RADIO_RX_OFF: | ||
1022 | rt2500usb_toggle_rx(rt2x00dev, state); | ||
1023 | break; | ||
1024 | case STATE_RADIO_IRQ_ON: | 1058 | case STATE_RADIO_IRQ_ON: |
1025 | case STATE_RADIO_IRQ_ON_ISR: | 1059 | case STATE_RADIO_IRQ_ON_ISR: |
1026 | case STATE_RADIO_IRQ_OFF: | 1060 | case STATE_RADIO_IRQ_OFF: |
@@ -1203,14 +1237,6 @@ static int rt2500usb_get_tx_data_len(struct queue_entry *entry) | |||
1203 | return length; | 1237 | return length; |
1204 | } | 1238 | } |
1205 | 1239 | ||
1206 | static void rt2500usb_kill_tx_queue(struct data_queue *queue) | ||
1207 | { | ||
1208 | if (queue->qid == QID_BEACON) | ||
1209 | rt2500usb_register_write(queue->rt2x00dev, TXRX_CSR19, 0); | ||
1210 | |||
1211 | rt2x00usb_kill_tx_queue(queue); | ||
1212 | } | ||
1213 | |||
1214 | /* | 1240 | /* |
1215 | * RX control handlers | 1241 | * RX control handlers |
1216 | */ | 1242 | */ |
@@ -1811,11 +1837,13 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1811 | .link_stats = rt2500usb_link_stats, | 1837 | .link_stats = rt2500usb_link_stats, |
1812 | .reset_tuner = rt2500usb_reset_tuner, | 1838 | .reset_tuner = rt2500usb_reset_tuner, |
1813 | .watchdog = rt2x00usb_watchdog, | 1839 | .watchdog = rt2x00usb_watchdog, |
1840 | .start_queue = rt2500usb_start_queue, | ||
1841 | .kick_queue = rt2x00usb_kick_queue, | ||
1842 | .stop_queue = rt2500usb_stop_queue, | ||
1843 | .flush_queue = rt2x00usb_flush_queue, | ||
1814 | .write_tx_desc = rt2500usb_write_tx_desc, | 1844 | .write_tx_desc = rt2500usb_write_tx_desc, |
1815 | .write_beacon = rt2500usb_write_beacon, | 1845 | .write_beacon = rt2500usb_write_beacon, |
1816 | .get_tx_data_len = rt2500usb_get_tx_data_len, | 1846 | .get_tx_data_len = rt2500usb_get_tx_data_len, |
1817 | .kick_tx_queue = rt2x00usb_kick_tx_queue, | ||
1818 | .kill_tx_queue = rt2500usb_kill_tx_queue, | ||
1819 | .fill_rxdone = rt2500usb_fill_rxdone, | 1847 | .fill_rxdone = rt2500usb_fill_rxdone, |
1820 | .config_shared_key = rt2500usb_config_key, | 1848 | .config_shared_key = rt2500usb_config_key, |
1821 | .config_pairwise_key = rt2500usb_config_key, | 1849 | .config_pairwise_key = rt2500usb_config_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index a81c4371835b..4c55e8525cad 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -46,8 +46,11 @@ | |||
46 | * RF2020 2.4G B/G | 46 | * RF2020 2.4G B/G |
47 | * RF3021 2.4G 1T2R | 47 | * RF3021 2.4G 1T2R |
48 | * RF3022 2.4G 2T2R | 48 | * RF3022 2.4G 2T2R |
49 | * RF3052 2.4G 2T2R | 49 | * RF3052 2.4G/5G 2T2R |
50 | * RF3320 2.4G 1T1R | 50 | * RF2853 2.4G/5G 3T3R |
51 | * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) | ||
52 | * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) | ||
53 | * RF3853 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) | ||
51 | */ | 54 | */ |
52 | #define RF2820 0x0001 | 55 | #define RF2820 0x0001 |
53 | #define RF2850 0x0002 | 56 | #define RF2850 0x0002 |
@@ -58,7 +61,10 @@ | |||
58 | #define RF3021 0x0007 | 61 | #define RF3021 0x0007 |
59 | #define RF3022 0x0008 | 62 | #define RF3022 0x0008 |
60 | #define RF3052 0x0009 | 63 | #define RF3052 0x0009 |
64 | #define RF2853 0x000a | ||
61 | #define RF3320 0x000b | 65 | #define RF3320 0x000b |
66 | #define RF3322 0x000c | ||
67 | #define RF3853 0x000d | ||
62 | 68 | ||
63 | /* | 69 | /* |
64 | * Chipset revisions. | 70 | * Chipset revisions. |
@@ -207,10 +213,10 @@ | |||
207 | 213 | ||
208 | /* | 214 | /* |
209 | * WMM_AIFSN_CFG: Aifsn for each EDCA AC | 215 | * WMM_AIFSN_CFG: Aifsn for each EDCA AC |
210 | * AIFSN0: AC_BE | 216 | * AIFSN0: AC_VO |
211 | * AIFSN1: AC_BK | 217 | * AIFSN1: AC_VI |
212 | * AIFSN2: AC_VI | 218 | * AIFSN2: AC_BE |
213 | * AIFSN3: AC_VO | 219 | * AIFSN3: AC_BK |
214 | */ | 220 | */ |
215 | #define WMM_AIFSN_CFG 0x0214 | 221 | #define WMM_AIFSN_CFG 0x0214 |
216 | #define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f) | 222 | #define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f) |
@@ -220,10 +226,10 @@ | |||
220 | 226 | ||
221 | /* | 227 | /* |
222 | * WMM_CWMIN_CSR: CWmin for each EDCA AC | 228 | * WMM_CWMIN_CSR: CWmin for each EDCA AC |
223 | * CWMIN0: AC_BE | 229 | * CWMIN0: AC_VO |
224 | * CWMIN1: AC_BK | 230 | * CWMIN1: AC_VI |
225 | * CWMIN2: AC_VI | 231 | * CWMIN2: AC_BE |
226 | * CWMIN3: AC_VO | 232 | * CWMIN3: AC_BK |
227 | */ | 233 | */ |
228 | #define WMM_CWMIN_CFG 0x0218 | 234 | #define WMM_CWMIN_CFG 0x0218 |
229 | #define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f) | 235 | #define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f) |
@@ -233,10 +239,10 @@ | |||
233 | 239 | ||
234 | /* | 240 | /* |
235 | * WMM_CWMAX_CSR: CWmax for each EDCA AC | 241 | * WMM_CWMAX_CSR: CWmax for each EDCA AC |
236 | * CWMAX0: AC_BE | 242 | * CWMAX0: AC_VO |
237 | * CWMAX1: AC_BK | 243 | * CWMAX1: AC_VI |
238 | * CWMAX2: AC_VI | 244 | * CWMAX2: AC_BE |
239 | * CWMAX3: AC_VO | 245 | * CWMAX3: AC_BK |
240 | */ | 246 | */ |
241 | #define WMM_CWMAX_CFG 0x021c | 247 | #define WMM_CWMAX_CFG 0x021c |
242 | #define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f) | 248 | #define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f) |
@@ -245,18 +251,18 @@ | |||
245 | #define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000) | 251 | #define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000) |
246 | 252 | ||
247 | /* | 253 | /* |
248 | * AC_TXOP0: AC_BK/AC_BE TXOP register | 254 | * AC_TXOP0: AC_VO/AC_VI TXOP register |
249 | * AC0TXOP: AC_BK in unit of 32us | 255 | * AC0TXOP: AC_VO in unit of 32us |
250 | * AC1TXOP: AC_BE in unit of 32us | 256 | * AC1TXOP: AC_VI in unit of 32us |
251 | */ | 257 | */ |
252 | #define WMM_TXOP0_CFG 0x0220 | 258 | #define WMM_TXOP0_CFG 0x0220 |
253 | #define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff) | 259 | #define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff) |
254 | #define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000) | 260 | #define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000) |
255 | 261 | ||
256 | /* | 262 | /* |
257 | * AC_TXOP1: AC_VO/AC_VI TXOP register | 263 | * AC_TXOP1: AC_BE/AC_BK TXOP register |
258 | * AC2TXOP: AC_VI in unit of 32us | 264 | * AC2TXOP: AC_BE in unit of 32us |
259 | * AC3TXOP: AC_VO in unit of 32us | 265 | * AC3TXOP: AC_BK in unit of 32us |
260 | */ | 266 | */ |
261 | #define WMM_TXOP1_CFG 0x0224 | 267 | #define WMM_TXOP1_CFG 0x0224 |
262 | #define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff) | 268 | #define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff) |
@@ -282,7 +288,7 @@ | |||
282 | #define MCU_CMD_CFG 0x022c | 288 | #define MCU_CMD_CFG 0x022c |
283 | 289 | ||
284 | /* | 290 | /* |
285 | * AC_BK register offsets | 291 | * AC_VO register offsets |
286 | */ | 292 | */ |
287 | #define TX_BASE_PTR0 0x0230 | 293 | #define TX_BASE_PTR0 0x0230 |
288 | #define TX_MAX_CNT0 0x0234 | 294 | #define TX_MAX_CNT0 0x0234 |
@@ -290,7 +296,7 @@ | |||
290 | #define TX_DTX_IDX0 0x023c | 296 | #define TX_DTX_IDX0 0x023c |
291 | 297 | ||
292 | /* | 298 | /* |
293 | * AC_BE register offsets | 299 | * AC_VI register offsets |
294 | */ | 300 | */ |
295 | #define TX_BASE_PTR1 0x0240 | 301 | #define TX_BASE_PTR1 0x0240 |
296 | #define TX_MAX_CNT1 0x0244 | 302 | #define TX_MAX_CNT1 0x0244 |
@@ -298,7 +304,7 @@ | |||
298 | #define TX_DTX_IDX1 0x024c | 304 | #define TX_DTX_IDX1 0x024c |
299 | 305 | ||
300 | /* | 306 | /* |
301 | * AC_VI register offsets | 307 | * AC_BE register offsets |
302 | */ | 308 | */ |
303 | #define TX_BASE_PTR2 0x0250 | 309 | #define TX_BASE_PTR2 0x0250 |
304 | #define TX_MAX_CNT2 0x0254 | 310 | #define TX_MAX_CNT2 0x0254 |
@@ -306,7 +312,7 @@ | |||
306 | #define TX_DTX_IDX2 0x025c | 312 | #define TX_DTX_IDX2 0x025c |
307 | 313 | ||
308 | /* | 314 | /* |
309 | * AC_VO register offsets | 315 | * AC_BK register offsets |
310 | */ | 316 | */ |
311 | #define TX_BASE_PTR3 0x0260 | 317 | #define TX_BASE_PTR3 0x0260 |
312 | #define TX_MAX_CNT3 0x0264 | 318 | #define TX_MAX_CNT3 0x0264 |
@@ -699,8 +705,18 @@ | |||
699 | 705 | ||
700 | /* | 706 | /* |
701 | * CH_TIME_CFG: count as channel busy | 707 | * CH_TIME_CFG: count as channel busy |
708 | * EIFS_BUSY: Count EIFS as channel busy | ||
709 | * NAV_BUSY: Count NAS as channel busy | ||
710 | * RX_BUSY: Count RX as channel busy | ||
711 | * TX_BUSY: Count TX as channel busy | ||
712 | * TMR_EN: Enable channel statistics timer | ||
702 | */ | 713 | */ |
703 | #define CH_TIME_CFG 0x110c | 714 | #define CH_TIME_CFG 0x110c |
715 | #define CH_TIME_CFG_EIFS_BUSY FIELD32(0x00000010) | ||
716 | #define CH_TIME_CFG_NAV_BUSY FIELD32(0x00000008) | ||
717 | #define CH_TIME_CFG_RX_BUSY FIELD32(0x00000004) | ||
718 | #define CH_TIME_CFG_TX_BUSY FIELD32(0x00000002) | ||
719 | #define CH_TIME_CFG_TMR_EN FIELD32(0x00000001) | ||
704 | 720 | ||
705 | /* | 721 | /* |
706 | * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us | 722 | * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us |
@@ -1841,32 +1857,51 @@ struct mac_iveiv_entry { | |||
1841 | #define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) | 1857 | #define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) |
1842 | 1858 | ||
1843 | /* | 1859 | /* |
1844 | * EEPROM ANTENNA config | 1860 | * EEPROM NIC Configuration 0 |
1845 | * RXPATH: 1: 1R, 2: 2R, 3: 3R | 1861 | * RXPATH: 1: 1R, 2: 2R, 3: 3R |
1846 | * TXPATH: 1: 1T, 2: 2T | 1862 | * TXPATH: 1: 1T, 2: 2T, 3: 3T |
1847 | */ | 1863 | * RF_TYPE: RFIC type |
1848 | #define EEPROM_ANTENNA 0x001a | 1864 | */ |
1849 | #define EEPROM_ANTENNA_RXPATH FIELD16(0x000f) | 1865 | #define EEPROM_NIC_CONF0 0x001a |
1850 | #define EEPROM_ANTENNA_TXPATH FIELD16(0x00f0) | 1866 | #define EEPROM_NIC_CONF0_RXPATH FIELD16(0x000f) |
1851 | #define EEPROM_ANTENNA_RF_TYPE FIELD16(0x0f00) | 1867 | #define EEPROM_NIC_CONF0_TXPATH FIELD16(0x00f0) |
1852 | 1868 | #define EEPROM_NIC_CONF0_RF_TYPE FIELD16(0x0f00) | |
1853 | /* | 1869 | |
1854 | * EEPROM NIC config | 1870 | /* |
1855 | * CARDBUS_ACCEL: 0 - enable, 1 - disable | 1871 | * EEPROM NIC Configuration 1 |
1856 | */ | 1872 | * HW_RADIO: 0: disable, 1: enable |
1857 | #define EEPROM_NIC 0x001b | 1873 | * EXTERNAL_TX_ALC: 0: disable, 1: enable |
1858 | #define EEPROM_NIC_HW_RADIO FIELD16(0x0001) | 1874 | * EXTERNAL_LNA_2G: 0: disable, 1: enable |
1859 | #define EEPROM_NIC_DYNAMIC_TX_AGC FIELD16(0x0002) | 1875 | * EXTERNAL_LNA_5G: 0: disable, 1: enable |
1860 | #define EEPROM_NIC_EXTERNAL_LNA_BG FIELD16(0x0004) | 1876 | * CARDBUS_ACCEL: 0: enable, 1: disable |
1861 | #define EEPROM_NIC_EXTERNAL_LNA_A FIELD16(0x0008) | 1877 | * BW40M_SB_2G: 0: disable, 1: enable |
1862 | #define EEPROM_NIC_CARDBUS_ACCEL FIELD16(0x0010) | 1878 | * BW40M_SB_5G: 0: disable, 1: enable |
1863 | #define EEPROM_NIC_BW40M_SB_BG FIELD16(0x0020) | 1879 | * WPS_PBC: 0: disable, 1: enable |
1864 | #define EEPROM_NIC_BW40M_SB_A FIELD16(0x0040) | 1880 | * BW40M_2G: 0: enable, 1: disable |
1865 | #define EEPROM_NIC_WPS_PBC FIELD16(0x0080) | 1881 | * BW40M_5G: 0: enable, 1: disable |
1866 | #define EEPROM_NIC_BW40M_BG FIELD16(0x0100) | 1882 | * BROADBAND_EXT_LNA: 0: disable, 1: enable |
1867 | #define EEPROM_NIC_BW40M_A FIELD16(0x0200) | 1883 | * ANT_DIVERSITY: 00: Disable, 01: Diversity, |
1868 | #define EEPROM_NIC_ANT_DIVERSITY FIELD16(0x0800) | 1884 | * 10: Main antenna, 11: Aux antenna |
1869 | #define EEPROM_NIC_DAC_TEST FIELD16(0x8000) | 1885 | * INTERNAL_TX_ALC: 0: disable, 1: enable |
1886 | * BT_COEXIST: 0: disable, 1: enable | ||
1887 | * DAC_TEST: 0: disable, 1: enable | ||
1888 | */ | ||
1889 | #define EEPROM_NIC_CONF1 0x001b | ||
1890 | #define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001) | ||
1891 | #define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002) | ||
1892 | #define EEPROM_NIC_CONF1_EXTERNAL_LNA_2G FIELD16(0x0004) | ||
1893 | #define EEPROM_NIC_CONF1_EXTERNAL_LNA_5G FIELD16(0x0008) | ||
1894 | #define EEPROM_NIC_CONF1_CARDBUS_ACCEL FIELD16(0x0010) | ||
1895 | #define EEPROM_NIC_CONF1_BW40M_SB_2G FIELD16(0x0020) | ||
1896 | #define EEPROM_NIC_CONF1_BW40M_SB_5G FIELD16(0x0040) | ||
1897 | #define EEPROM_NIC_CONF1_WPS_PBC FIELD16(0x0080) | ||
1898 | #define EEPROM_NIC_CONF1_BW40M_2G FIELD16(0x0100) | ||
1899 | #define EEPROM_NIC_CONF1_BW40M_5G FIELD16(0x0200) | ||
1900 | #define EEPROM_NIC_CONF1_BROADBAND_EXT_LNA FIELD16(0x400) | ||
1901 | #define EEPROM_NIC_CONF1_ANT_DIVERSITY FIELD16(0x1800) | ||
1902 | #define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000) | ||
1903 | #define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000) | ||
1904 | #define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000) | ||
1870 | 1905 | ||
1871 | /* | 1906 | /* |
1872 | * EEPROM frequency | 1907 | * EEPROM frequency |
@@ -1888,9 +1923,9 @@ struct mac_iveiv_entry { | |||
1888 | * POLARITY_GPIO_4: Polarity GPIO4 setting. | 1923 | * POLARITY_GPIO_4: Polarity GPIO4 setting. |
1889 | * LED_MODE: Led mode. | 1924 | * LED_MODE: Led mode. |
1890 | */ | 1925 | */ |
1891 | #define EEPROM_LED1 0x001e | 1926 | #define EEPROM_LED_AG_CONF 0x001e |
1892 | #define EEPROM_LED2 0x001f | 1927 | #define EEPROM_LED_ACT_CONF 0x001f |
1893 | #define EEPROM_LED3 0x0020 | 1928 | #define EEPROM_LED_POLARITY 0x0020 |
1894 | #define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001) | 1929 | #define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001) |
1895 | #define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) | 1930 | #define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) |
1896 | #define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) | 1931 | #define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) |
@@ -1902,6 +1937,17 @@ struct mac_iveiv_entry { | |||
1902 | #define EEPROM_LED_LED_MODE FIELD16(0x1f00) | 1937 | #define EEPROM_LED_LED_MODE FIELD16(0x1f00) |
1903 | 1938 | ||
1904 | /* | 1939 | /* |
1940 | * EEPROM NIC Configuration 2 | ||
1941 | * RX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream | ||
1942 | * TX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream | ||
1943 | * CRYSTAL: 00: Reserved, 01: One crystal, 10: Two crystal, 11: Reserved | ||
1944 | */ | ||
1945 | #define EEPROM_NIC_CONF2 0x0021 | ||
1946 | #define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f) | ||
1947 | #define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0) | ||
1948 | #define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600) | ||
1949 | |||
1950 | /* | ||
1905 | * EEPROM LNA | 1951 | * EEPROM LNA |
1906 | */ | 1952 | */ |
1907 | #define EEPROM_LNA 0x0022 | 1953 | #define EEPROM_LNA 0x0022 |
@@ -1951,7 +1997,7 @@ struct mac_iveiv_entry { | |||
1951 | 1997 | ||
1952 | /* | 1998 | /* |
1953 | * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. | 1999 | * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. |
1954 | * This is delta in 40MHZ. | 2000 | * This is delta in 40MHZ. |
1955 | * VALUE: Tx Power dalta value (MAX=4) | 2001 | * VALUE: Tx Power dalta value (MAX=4) |
1956 | * TYPE: 1: Plus the delta value, 0: minus the delta value | 2002 | * TYPE: 1: Plus the delta value, 0: minus the delta value |
1957 | * TXPOWER: Enable: | 2003 | * TXPOWER: Enable: |
@@ -2007,9 +2053,9 @@ struct mac_iveiv_entry { | |||
2007 | #define MCU_CURRENT 0x36 | 2053 | #define MCU_CURRENT 0x36 |
2008 | #define MCU_LED 0x50 | 2054 | #define MCU_LED 0x50 |
2009 | #define MCU_LED_STRENGTH 0x51 | 2055 | #define MCU_LED_STRENGTH 0x51 |
2010 | #define MCU_LED_1 0x52 | 2056 | #define MCU_LED_AG_CONF 0x52 |
2011 | #define MCU_LED_2 0x53 | 2057 | #define MCU_LED_ACT_CONF 0x53 |
2012 | #define MCU_LED_3 0x54 | 2058 | #define MCU_LED_LED_POLARITY 0x54 |
2013 | #define MCU_RADAR 0x60 | 2059 | #define MCU_RADAR 0x60 |
2014 | #define MCU_BOOT_SIGNAL 0x72 | 2060 | #define MCU_BOOT_SIGNAL 0x72 |
2015 | #define MCU_BBP_SIGNAL 0x80 | 2061 | #define MCU_BBP_SIGNAL 0x80 |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 75631614aba3..54917a281398 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -772,6 +772,7 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
772 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 772 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
773 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 773 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
774 | unsigned int beacon_base; | 774 | unsigned int beacon_base; |
775 | unsigned int padding_len; | ||
775 | u32 reg; | 776 | u32 reg; |
776 | 777 | ||
777 | /* | 778 | /* |
@@ -806,11 +807,13 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | |||
806 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); | 807 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); |
807 | 808 | ||
808 | /* | 809 | /* |
809 | * Write entire beacon with TXWI to register. | 810 | * Write entire beacon with TXWI and padding to register. |
810 | */ | 811 | */ |
812 | padding_len = roundup(entry->skb->len, 4) - entry->skb->len; | ||
813 | skb_pad(entry->skb, padding_len); | ||
811 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 814 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
812 | rt2800_register_multiwrite(rt2x00dev, beacon_base, | 815 | rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, |
813 | entry->skb->data, entry->skb->len); | 816 | entry->skb->len + padding_len); |
814 | 817 | ||
815 | /* | 818 | /* |
816 | * Enable beaconing again. | 819 | * Enable beaconing again. |
@@ -1625,6 +1628,13 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
1625 | } | 1628 | } |
1626 | 1629 | ||
1627 | msleep(1); | 1630 | msleep(1); |
1631 | |||
1632 | /* | ||
1633 | * Clear channel statistic counters | ||
1634 | */ | ||
1635 | rt2800_register_read(rt2x00dev, CH_IDLE_STA, ®); | ||
1636 | rt2800_register_read(rt2x00dev, CH_BUSY_STA, ®); | ||
1637 | rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, ®); | ||
1628 | } | 1638 | } |
1629 | 1639 | ||
1630 | static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, | 1640 | static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, |
@@ -1930,8 +1940,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1930 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | 1940 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || |
1931 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || | 1941 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || |
1932 | rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { | 1942 | rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { |
1933 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); | 1943 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); |
1934 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_DAC_TEST)) | 1944 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) |
1935 | rt2800_register_write(rt2x00dev, TX_SW_CFG2, | 1945 | rt2800_register_write(rt2x00dev, TX_SW_CFG2, |
1936 | 0x0000002c); | 1946 | 0x0000002c); |
1937 | else | 1947 | else |
@@ -2259,6 +2269,17 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
2259 | rt2x00_set_field32(®, INT_TIMER_CFG_PRE_TBTT_TIMER, 6 << 4); | 2269 | rt2x00_set_field32(®, INT_TIMER_CFG_PRE_TBTT_TIMER, 6 << 4); |
2260 | rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg); | 2270 | rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg); |
2261 | 2271 | ||
2272 | /* | ||
2273 | * Set up channel statistics timer | ||
2274 | */ | ||
2275 | rt2800_register_read(rt2x00dev, CH_TIME_CFG, ®); | ||
2276 | rt2x00_set_field32(®, CH_TIME_CFG_EIFS_BUSY, 1); | ||
2277 | rt2x00_set_field32(®, CH_TIME_CFG_NAV_BUSY, 1); | ||
2278 | rt2x00_set_field32(®, CH_TIME_CFG_RX_BUSY, 1); | ||
2279 | rt2x00_set_field32(®, CH_TIME_CFG_TX_BUSY, 1); | ||
2280 | rt2x00_set_field32(®, CH_TIME_CFG_TMR_EN, 1); | ||
2281 | rt2800_register_write(rt2x00dev, CH_TIME_CFG, reg); | ||
2282 | |||
2262 | return 0; | 2283 | return 0; |
2263 | } | 2284 | } |
2264 | 2285 | ||
@@ -2376,10 +2397,10 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
2376 | rt2x00_rt(rt2x00dev, RT3390)) { | 2397 | rt2x00_rt(rt2x00dev, RT3390)) { |
2377 | rt2800_bbp_read(rt2x00dev, 138, &value); | 2398 | rt2800_bbp_read(rt2x00dev, 138, &value); |
2378 | 2399 | ||
2379 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 2400 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); |
2380 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1) | 2401 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) |
2381 | value |= 0x20; | 2402 | value |= 0x20; |
2382 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) | 2403 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) |
2383 | value &= ~0x02; | 2404 | value &= ~0x02; |
2384 | 2405 | ||
2385 | rt2800_bbp_write(rt2x00dev, 138, value); | 2406 | rt2800_bbp_write(rt2x00dev, 138, value); |
@@ -2591,8 +2612,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2591 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | 2612 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); |
2592 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | 2613 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || |
2593 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { | 2614 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { |
2594 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); | 2615 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); |
2595 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_DAC_TEST)) | 2616 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) |
2596 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); | 2617 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); |
2597 | else | 2618 | else |
2598 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); | 2619 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); |
@@ -2665,10 +2686,10 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2665 | if (rt2x00_rt(rt2x00dev, RT3090)) { | 2686 | if (rt2x00_rt(rt2x00dev, RT3090)) { |
2666 | rt2800_bbp_read(rt2x00dev, 138, &bbp); | 2687 | rt2800_bbp_read(rt2x00dev, 138, &bbp); |
2667 | 2688 | ||
2668 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 2689 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); |
2669 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) == 1) | 2690 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) |
2670 | rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); | 2691 | rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); |
2671 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) == 1) | 2692 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) |
2672 | rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1); | 2693 | rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1); |
2673 | 2694 | ||
2674 | rt2800_bbp_write(rt2x00dev, 138, bbp); | 2695 | rt2800_bbp_write(rt2x00dev, 138, bbp); |
@@ -2767,16 +2788,16 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
2767 | /* | 2788 | /* |
2768 | * Initialize LED control | 2789 | * Initialize LED control |
2769 | */ | 2790 | */ |
2770 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word); | 2791 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_AG_CONF, &word); |
2771 | rt2800_mcu_request(rt2x00dev, MCU_LED_1, 0xff, | 2792 | rt2800_mcu_request(rt2x00dev, MCU_LED_AG_CONF, 0xff, |
2772 | word & 0xff, (word >> 8) & 0xff); | 2793 | word & 0xff, (word >> 8) & 0xff); |
2773 | 2794 | ||
2774 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED2, &word); | 2795 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_ACT_CONF, &word); |
2775 | rt2800_mcu_request(rt2x00dev, MCU_LED_2, 0xff, | 2796 | rt2800_mcu_request(rt2x00dev, MCU_LED_ACT_CONF, 0xff, |
2776 | word & 0xff, (word >> 8) & 0xff); | 2797 | word & 0xff, (word >> 8) & 0xff); |
2777 | 2798 | ||
2778 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED3, &word); | 2799 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_POLARITY, &word); |
2779 | rt2800_mcu_request(rt2x00dev, MCU_LED_3, 0xff, | 2800 | rt2800_mcu_request(rt2x00dev, MCU_LED_LED_POLARITY, 0xff, |
2780 | word & 0xff, (word >> 8) & 0xff); | 2801 | word & 0xff, (word >> 8) & 0xff); |
2781 | 2802 | ||
2782 | return 0; | 2803 | return 0; |
@@ -2870,38 +2891,41 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2870 | EEPROM(rt2x00dev, "MAC: %pM\n", mac); | 2891 | EEPROM(rt2x00dev, "MAC: %pM\n", mac); |
2871 | } | 2892 | } |
2872 | 2893 | ||
2873 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); | 2894 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &word); |
2874 | if (word == 0xffff) { | 2895 | if (word == 0xffff) { |
2875 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); | 2896 | rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 2); |
2876 | rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1); | 2897 | rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1); |
2877 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); | 2898 | rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820); |
2878 | rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); | 2899 | rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); |
2879 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); | 2900 | EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); |
2880 | } else if (rt2x00_rt(rt2x00dev, RT2860) || | 2901 | } else if (rt2x00_rt(rt2x00dev, RT2860) || |
2881 | rt2x00_rt(rt2x00dev, RT2872)) { | 2902 | rt2x00_rt(rt2x00dev, RT2872)) { |
2882 | /* | 2903 | /* |
2883 | * There is a max of 2 RX streams for RT28x0 series | 2904 | * There is a max of 2 RX streams for RT28x0 series |
2884 | */ | 2905 | */ |
2885 | if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2) | 2906 | if (rt2x00_get_field16(word, EEPROM_NIC_CONF0_RXPATH) > 2) |
2886 | rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); | 2907 | rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 2); |
2887 | rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); | 2908 | rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); |
2888 | } | 2909 | } |
2889 | 2910 | ||
2890 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); | 2911 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &word); |
2891 | if (word == 0xffff) { | 2912 | if (word == 0xffff) { |
2892 | rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0); | 2913 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_HW_RADIO, 0); |
2893 | rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0); | 2914 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_TX_ALC, 0); |
2894 | rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0); | 2915 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G, 0); |
2895 | rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0); | 2916 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G, 0); |
2896 | rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0); | 2917 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_CARDBUS_ACCEL, 0); |
2897 | rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0); | 2918 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_SB_2G, 0); |
2898 | rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0); | 2919 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_SB_5G, 0); |
2899 | rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0); | 2920 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_WPS_PBC, 0); |
2900 | rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0); | 2921 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_2G, 0); |
2901 | rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0); | 2922 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_5G, 0); |
2902 | rt2x00_set_field16(&word, EEPROM_NIC_ANT_DIVERSITY, 0); | 2923 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BROADBAND_EXT_LNA, 0); |
2903 | rt2x00_set_field16(&word, EEPROM_NIC_DAC_TEST, 0); | 2924 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_ANT_DIVERSITY, 0); |
2904 | rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); | 2925 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_INTERNAL_TX_ALC, 0); |
2926 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BT_COEXIST, 0); | ||
2927 | rt2x00_set_field16(&word, EEPROM_NIC_CONF1_DAC_TEST, 0); | ||
2928 | rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF1, word); | ||
2905 | EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); | 2929 | EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); |
2906 | } | 2930 | } |
2907 | 2931 | ||
@@ -2916,9 +2940,9 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2916 | LED_MODE_TXRX_ACTIVITY); | 2940 | LED_MODE_TXRX_ACTIVITY); |
2917 | rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0); | 2941 | rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0); |
2918 | rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); | 2942 | rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); |
2919 | rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555); | 2943 | rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_AG_CONF, 0x5555); |
2920 | rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221); | 2944 | rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_ACT_CONF, 0x2221); |
2921 | rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8); | 2945 | rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_POLARITY, 0xa9f8); |
2922 | EEPROM(rt2x00dev, "Led Mode: 0x%04x\n", word); | 2946 | EEPROM(rt2x00dev, "Led Mode: 0x%04x\n", word); |
2923 | } | 2947 | } |
2924 | 2948 | ||
@@ -2982,12 +3006,12 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2982 | /* | 3006 | /* |
2983 | * Read EEPROM word for configuration. | 3007 | * Read EEPROM word for configuration. |
2984 | */ | 3008 | */ |
2985 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 3009 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); |
2986 | 3010 | ||
2987 | /* | 3011 | /* |
2988 | * Identify RF chipset. | 3012 | * Identify RF chipset. |
2989 | */ | 3013 | */ |
2990 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 3014 | value = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); |
2991 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | 3015 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); |
2992 | 3016 | ||
2993 | rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), | 3017 | rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), |
@@ -3023,9 +3047,9 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
3023 | * Identify default antenna configuration. | 3047 | * Identify default antenna configuration. |
3024 | */ | 3048 | */ |
3025 | rt2x00dev->default_ant.tx = | 3049 | rt2x00dev->default_ant.tx = |
3026 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH); | 3050 | rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH); |
3027 | rt2x00dev->default_ant.rx = | 3051 | rt2x00dev->default_ant.rx = |
3028 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH); | 3052 | rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH); |
3029 | 3053 | ||
3030 | /* | 3054 | /* |
3031 | * Read frequency offset and RF programming sequence. | 3055 | * Read frequency offset and RF programming sequence. |
@@ -3036,17 +3060,17 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
3036 | /* | 3060 | /* |
3037 | * Read external LNA informations. | 3061 | * Read external LNA informations. |
3038 | */ | 3062 | */ |
3039 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); | 3063 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); |
3040 | 3064 | ||
3041 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A)) | 3065 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G)) |
3042 | __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); | 3066 | __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); |
3043 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG)) | 3067 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G)) |
3044 | __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); | 3068 | __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); |
3045 | 3069 | ||
3046 | /* | 3070 | /* |
3047 | * Detect if this device has an hardware controlled radio. | 3071 | * Detect if this device has an hardware controlled radio. |
3048 | */ | 3072 | */ |
3049 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO)) | 3073 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO)) |
3050 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 3074 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
3051 | 3075 | ||
3052 | /* | 3076 | /* |
@@ -3258,7 +3282,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
3258 | rt2x00dev->hw->max_report_rates = 7; | 3282 | rt2x00dev->hw->max_report_rates = 7; |
3259 | rt2x00dev->hw->max_rate_tries = 1; | 3283 | rt2x00dev->hw->max_rate_tries = 1; |
3260 | 3284 | ||
3261 | rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); | 3285 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); |
3262 | 3286 | ||
3263 | /* | 3287 | /* |
3264 | * Initialize hw_mode information. | 3288 | * Initialize hw_mode information. |
@@ -3302,11 +3326,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
3302 | IEEE80211_HT_CAP_SGI_20 | | 3326 | IEEE80211_HT_CAP_SGI_20 | |
3303 | IEEE80211_HT_CAP_SGI_40; | 3327 | IEEE80211_HT_CAP_SGI_40; |
3304 | 3328 | ||
3305 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) >= 2) | 3329 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) >= 2) |
3306 | spec->ht.cap |= IEEE80211_HT_CAP_TX_STBC; | 3330 | spec->ht.cap |= IEEE80211_HT_CAP_TX_STBC; |
3307 | 3331 | ||
3308 | spec->ht.cap |= | 3332 | spec->ht.cap |= |
3309 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH) << | 3333 | rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) << |
3310 | IEEE80211_HT_CAP_RX_STBC_SHIFT; | 3334 | IEEE80211_HT_CAP_RX_STBC_SHIFT; |
3311 | 3335 | ||
3312 | spec->ht.ampdu_factor = 3; | 3336 | spec->ht.ampdu_factor = 3; |
@@ -3314,10 +3338,10 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
3314 | spec->ht.mcs.tx_params = | 3338 | spec->ht.mcs.tx_params = |
3315 | IEEE80211_HT_MCS_TX_DEFINED | | 3339 | IEEE80211_HT_MCS_TX_DEFINED | |
3316 | IEEE80211_HT_MCS_TX_RX_DIFF | | 3340 | IEEE80211_HT_MCS_TX_RX_DIFF | |
3317 | ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) << | 3341 | ((rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) - 1) << |
3318 | IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); | 3342 | IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); |
3319 | 3343 | ||
3320 | switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) { | 3344 | switch (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH)) { |
3321 | case 3: | 3345 | case 3: |
3322 | spec->ht.mcs.rx_mask[2] = 0xff; | 3346 | spec->ht.mcs.rx_mask[2] = 0xff; |
3323 | case 2: | 3347 | case 2: |
@@ -3536,6 +3560,37 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
3536 | } | 3560 | } |
3537 | EXPORT_SYMBOL_GPL(rt2800_ampdu_action); | 3561 | EXPORT_SYMBOL_GPL(rt2800_ampdu_action); |
3538 | 3562 | ||
3563 | int rt2800_get_survey(struct ieee80211_hw *hw, int idx, | ||
3564 | struct survey_info *survey) | ||
3565 | { | ||
3566 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
3567 | struct ieee80211_conf *conf = &hw->conf; | ||
3568 | u32 idle, busy, busy_ext; | ||
3569 | |||
3570 | if (idx != 0) | ||
3571 | return -ENOENT; | ||
3572 | |||
3573 | survey->channel = conf->channel; | ||
3574 | |||
3575 | rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle); | ||
3576 | rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy); | ||
3577 | rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, &busy_ext); | ||
3578 | |||
3579 | if (idle || busy) { | ||
3580 | survey->filled = SURVEY_INFO_CHANNEL_TIME | | ||
3581 | SURVEY_INFO_CHANNEL_TIME_BUSY | | ||
3582 | SURVEY_INFO_CHANNEL_TIME_EXT_BUSY; | ||
3583 | |||
3584 | survey->channel_time = (idle + busy) / 1000; | ||
3585 | survey->channel_time_busy = busy / 1000; | ||
3586 | survey->channel_time_ext_busy = busy_ext / 1000; | ||
3587 | } | ||
3588 | |||
3589 | return 0; | ||
3590 | |||
3591 | } | ||
3592 | EXPORT_SYMBOL_GPL(rt2800_get_survey); | ||
3593 | |||
3539 | MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz"); | 3594 | MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz"); |
3540 | MODULE_VERSION(DRV_VERSION); | 3595 | MODULE_VERSION(DRV_VERSION); |
3541 | MODULE_DESCRIPTION("Ralink RT2800 library"); | 3596 | MODULE_DESCRIPTION("Ralink RT2800 library"); |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index 81cbc92e7857..e3c995a9dec4 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -199,5 +199,7 @@ u64 rt2800_get_tsf(struct ieee80211_hw *hw); | |||
199 | int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 199 | int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
200 | enum ieee80211_ampdu_mlme_action action, | 200 | enum ieee80211_ampdu_mlme_action action, |
201 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 201 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
202 | int rt2800_get_survey(struct ieee80211_hw *hw, int idx, | ||
203 | struct survey_info *survey); | ||
202 | 204 | ||
203 | #endif /* RT2800LIB_H */ | 205 | #endif /* RT2800LIB_H */ |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index b989b0d3ed49..baa1468a56a8 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -186,6 +186,77 @@ static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | |||
186 | #endif /* CONFIG_PCI */ | 186 | #endif /* CONFIG_PCI */ |
187 | 187 | ||
188 | /* | 188 | /* |
189 | * Queue handlers. | ||
190 | */ | ||
191 | static void rt2800pci_start_queue(struct data_queue *queue) | ||
192 | { | ||
193 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
194 | u32 reg; | ||
195 | |||
196 | switch (queue->qid) { | ||
197 | case QID_RX: | ||
198 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
199 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); | ||
200 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
201 | break; | ||
202 | case QID_BEACON: | ||
203 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
204 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
205 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
206 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
207 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
208 | break; | ||
209 | default: | ||
210 | break; | ||
211 | }; | ||
212 | } | ||
213 | |||
214 | static void rt2800pci_kick_queue(struct data_queue *queue) | ||
215 | { | ||
216 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
217 | struct queue_entry *entry; | ||
218 | |||
219 | switch (queue->qid) { | ||
220 | case QID_AC_VO: | ||
221 | case QID_AC_VI: | ||
222 | case QID_AC_BE: | ||
223 | case QID_AC_BK: | ||
224 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
225 | rt2800_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), entry->entry_idx); | ||
226 | break; | ||
227 | case QID_MGMT: | ||
228 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
229 | rt2800_register_write(rt2x00dev, TX_CTX_IDX(5), entry->entry_idx); | ||
230 | break; | ||
231 | default: | ||
232 | break; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | static void rt2800pci_stop_queue(struct data_queue *queue) | ||
237 | { | ||
238 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
239 | u32 reg; | ||
240 | |||
241 | switch (queue->qid) { | ||
242 | case QID_RX: | ||
243 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
244 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); | ||
245 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
246 | break; | ||
247 | case QID_BEACON: | ||
248 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
249 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0); | ||
250 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0); | ||
251 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); | ||
252 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
253 | break; | ||
254 | default: | ||
255 | break; | ||
256 | } | ||
257 | } | ||
258 | |||
259 | /* | ||
189 | * Firmware functions | 260 | * Firmware functions |
190 | */ | 261 | */ |
191 | static char *rt2800pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 262 | static char *rt2800pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
@@ -323,17 +394,6 @@ static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev) | |||
323 | /* | 394 | /* |
324 | * Device state switch handlers. | 395 | * Device state switch handlers. |
325 | */ | 396 | */ |
326 | static void rt2800pci_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
327 | enum dev_state state) | ||
328 | { | ||
329 | u32 reg; | ||
330 | |||
331 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
332 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, | ||
333 | (state == STATE_RADIO_RX_ON)); | ||
334 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
335 | } | ||
336 | |||
337 | static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | 397 | static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev, |
338 | enum dev_state state) | 398 | enum dev_state state) |
339 | { | 399 | { |
@@ -477,10 +537,6 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
477 | rt2800pci_disable_radio(rt2x00dev); | 537 | rt2800pci_disable_radio(rt2x00dev); |
478 | rt2800pci_set_state(rt2x00dev, STATE_SLEEP); | 538 | rt2800pci_set_state(rt2x00dev, STATE_SLEEP); |
479 | break; | 539 | break; |
480 | case STATE_RADIO_RX_ON: | ||
481 | case STATE_RADIO_RX_OFF: | ||
482 | rt2800pci_toggle_rx(rt2x00dev, state); | ||
483 | break; | ||
484 | case STATE_RADIO_IRQ_ON: | 540 | case STATE_RADIO_IRQ_ON: |
485 | case STATE_RADIO_IRQ_ON_ISR: | 541 | case STATE_RADIO_IRQ_ON_ISR: |
486 | case STATE_RADIO_IRQ_OFF: | 542 | case STATE_RADIO_IRQ_OFF: |
@@ -566,41 +622,6 @@ static void rt2800pci_write_tx_desc(struct queue_entry *entry, | |||
566 | } | 622 | } |
567 | 623 | ||
568 | /* | 624 | /* |
569 | * TX data initialization | ||
570 | */ | ||
571 | static void rt2800pci_kick_tx_queue(struct data_queue *queue) | ||
572 | { | ||
573 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
574 | struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
575 | unsigned int qidx; | ||
576 | |||
577 | if (queue->qid == QID_MGMT) | ||
578 | qidx = 5; | ||
579 | else | ||
580 | qidx = queue->qid; | ||
581 | |||
582 | rt2800_register_write(rt2x00dev, TX_CTX_IDX(qidx), entry->entry_idx); | ||
583 | } | ||
584 | |||
585 | static void rt2800pci_kill_tx_queue(struct data_queue *queue) | ||
586 | { | ||
587 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
588 | u32 reg; | ||
589 | |||
590 | if (queue->qid == QID_BEACON) { | ||
591 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, 0); | ||
592 | return; | ||
593 | } | ||
594 | |||
595 | rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, ®); | ||
596 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, (queue->qid == QID_AC_BE)); | ||
597 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, (queue->qid == QID_AC_BK)); | ||
598 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, (queue->qid == QID_AC_VI)); | ||
599 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, (queue->qid == QID_AC_VO)); | ||
600 | rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg); | ||
601 | } | ||
602 | |||
603 | /* | ||
604 | * RX control handlers | 625 | * RX control handlers |
605 | */ | 626 | */ |
606 | static void rt2800pci_fill_rxdone(struct queue_entry *entry, | 627 | static void rt2800pci_fill_rxdone(struct queue_entry *entry, |
@@ -682,7 +703,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
682 | * this tx status. | 703 | * this tx status. |
683 | */ | 704 | */ |
684 | WARNING(rt2x00dev, "Got TX status report with " | 705 | WARNING(rt2x00dev, "Got TX status report with " |
685 | "unexpected pid %u, dropping", qid); | 706 | "unexpected pid %u, dropping\n", qid); |
686 | break; | 707 | break; |
687 | } | 708 | } |
688 | 709 | ||
@@ -693,7 +714,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
693 | * processing here and drop the tx status | 714 | * processing here and drop the tx status |
694 | */ | 715 | */ |
695 | WARNING(rt2x00dev, "Got TX status for an unavailable " | 716 | WARNING(rt2x00dev, "Got TX status for an unavailable " |
696 | "queue %u, dropping", qid); | 717 | "queue %u, dropping\n", qid); |
697 | break; | 718 | break; |
698 | } | 719 | } |
699 | 720 | ||
@@ -703,7 +724,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
703 | * and drop the tx status. | 724 | * and drop the tx status. |
704 | */ | 725 | */ |
705 | WARNING(rt2x00dev, "Got TX status for an empty " | 726 | WARNING(rt2x00dev, "Got TX status for an empty " |
706 | "queue %u, dropping", qid); | 727 | "queue %u, dropping\n", qid); |
707 | break; | 728 | break; |
708 | } | 729 | } |
709 | 730 | ||
@@ -944,6 +965,7 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = { | |||
944 | .rfkill_poll = rt2x00mac_rfkill_poll, | 965 | .rfkill_poll = rt2x00mac_rfkill_poll, |
945 | .ampdu_action = rt2800_ampdu_action, | 966 | .ampdu_action = rt2800_ampdu_action, |
946 | .flush = rt2x00mac_flush, | 967 | .flush = rt2x00mac_flush, |
968 | .get_survey = rt2800_get_survey, | ||
947 | }; | 969 | }; |
948 | 970 | ||
949 | static const struct rt2800_ops rt2800pci_rt2800_ops = { | 971 | static const struct rt2800_ops rt2800pci_rt2800_ops = { |
@@ -976,11 +998,12 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { | |||
976 | .link_stats = rt2800_link_stats, | 998 | .link_stats = rt2800_link_stats, |
977 | .reset_tuner = rt2800_reset_tuner, | 999 | .reset_tuner = rt2800_reset_tuner, |
978 | .link_tuner = rt2800_link_tuner, | 1000 | .link_tuner = rt2800_link_tuner, |
1001 | .start_queue = rt2800pci_start_queue, | ||
1002 | .kick_queue = rt2800pci_kick_queue, | ||
1003 | .stop_queue = rt2800pci_stop_queue, | ||
979 | .write_tx_desc = rt2800pci_write_tx_desc, | 1004 | .write_tx_desc = rt2800pci_write_tx_desc, |
980 | .write_tx_data = rt2800_write_tx_data, | 1005 | .write_tx_data = rt2800_write_tx_data, |
981 | .write_beacon = rt2800_write_beacon, | 1006 | .write_beacon = rt2800_write_beacon, |
982 | .kick_tx_queue = rt2800pci_kick_tx_queue, | ||
983 | .kill_tx_queue = rt2800pci_kill_tx_queue, | ||
984 | .fill_rxdone = rt2800pci_fill_rxdone, | 1007 | .fill_rxdone = rt2800pci_fill_rxdone, |
985 | .config_shared_key = rt2800_config_shared_key, | 1008 | .config_shared_key = rt2800_config_shared_key, |
986 | .config_pairwise_key = rt2800_config_pairwise_key, | 1009 | .config_pairwise_key = rt2800_config_pairwise_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 935b76d3ce4f..3e0205ddf7b4 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -50,6 +50,55 @@ module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); | |||
50 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); | 50 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Queue handlers. | ||
54 | */ | ||
55 | static void rt2800usb_start_queue(struct data_queue *queue) | ||
56 | { | ||
57 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
58 | u32 reg; | ||
59 | |||
60 | switch (queue->qid) { | ||
61 | case QID_RX: | ||
62 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
63 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); | ||
64 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
65 | break; | ||
66 | case QID_BEACON: | ||
67 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
68 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
69 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
70 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
71 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
72 | break; | ||
73 | default: | ||
74 | break; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | static void rt2800usb_stop_queue(struct data_queue *queue) | ||
79 | { | ||
80 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
81 | u32 reg; | ||
82 | |||
83 | switch (queue->qid) { | ||
84 | case QID_RX: | ||
85 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
86 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); | ||
87 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
88 | break; | ||
89 | case QID_BEACON: | ||
90 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
91 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0); | ||
92 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0); | ||
93 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); | ||
94 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
95 | break; | ||
96 | default: | ||
97 | break; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | /* | ||
53 | * Firmware functions | 102 | * Firmware functions |
54 | */ | 103 | */ |
55 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 104 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
@@ -107,17 +156,6 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
107 | /* | 156 | /* |
108 | * Device state switch handlers. | 157 | * Device state switch handlers. |
109 | */ | 158 | */ |
110 | static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
111 | enum dev_state state) | ||
112 | { | ||
113 | u32 reg; | ||
114 | |||
115 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
116 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, | ||
117 | (state == STATE_RADIO_RX_ON)); | ||
118 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
119 | } | ||
120 | |||
121 | static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) | 159 | static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) |
122 | { | 160 | { |
123 | u32 reg; | 161 | u32 reg; |
@@ -214,10 +252,6 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
214 | rt2800usb_disable_radio(rt2x00dev); | 252 | rt2800usb_disable_radio(rt2x00dev); |
215 | rt2800usb_set_state(rt2x00dev, STATE_SLEEP); | 253 | rt2800usb_set_state(rt2x00dev, STATE_SLEEP); |
216 | break; | 254 | break; |
217 | case STATE_RADIO_RX_ON: | ||
218 | case STATE_RADIO_RX_OFF: | ||
219 | rt2800usb_toggle_rx(rt2x00dev, state); | ||
220 | break; | ||
221 | case STATE_RADIO_IRQ_ON: | 255 | case STATE_RADIO_IRQ_ON: |
222 | case STATE_RADIO_IRQ_ON_ISR: | 256 | case STATE_RADIO_IRQ_ON_ISR: |
223 | case STATE_RADIO_IRQ_OFF: | 257 | case STATE_RADIO_IRQ_OFF: |
@@ -253,7 +287,7 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev) | |||
253 | rt2800_register_read(rt2x00dev, TXRXQ_PCNT, ®); | 287 | rt2800_register_read(rt2x00dev, TXRXQ_PCNT, ®); |
254 | if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) { | 288 | if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) { |
255 | WARNING(rt2x00dev, "TX HW queue 0 timed out," | 289 | WARNING(rt2x00dev, "TX HW queue 0 timed out," |
256 | " invoke forced kick"); | 290 | " invoke forced kick\n"); |
257 | 291 | ||
258 | rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40012); | 292 | rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40012); |
259 | 293 | ||
@@ -269,7 +303,7 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev) | |||
269 | rt2800_register_read(rt2x00dev, TXRXQ_PCNT, ®); | 303 | rt2800_register_read(rt2x00dev, TXRXQ_PCNT, ®); |
270 | if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) { | 304 | if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) { |
271 | WARNING(rt2x00dev, "TX HW queue 1 timed out," | 305 | WARNING(rt2x00dev, "TX HW queue 1 timed out," |
272 | " invoke forced kick"); | 306 | " invoke forced kick\n"); |
273 | 307 | ||
274 | rt2800_register_write(rt2x00dev, PBF_CFG, 0xf4000a); | 308 | rt2800_register_write(rt2x00dev, PBF_CFG, 0xf4000a); |
275 | 309 | ||
@@ -389,14 +423,6 @@ static void rt2800usb_work_txdone(struct work_struct *work) | |||
389 | } | 423 | } |
390 | } | 424 | } |
391 | 425 | ||
392 | static void rt2800usb_kill_tx_queue(struct data_queue *queue) | ||
393 | { | ||
394 | if (queue->qid == QID_BEACON) | ||
395 | rt2x00usb_register_write(queue->rt2x00dev, BCN_TIME_CFG, 0); | ||
396 | |||
397 | rt2x00usb_kill_tx_queue(queue); | ||
398 | } | ||
399 | |||
400 | /* | 426 | /* |
401 | * RX control handlers | 427 | * RX control handlers |
402 | */ | 428 | */ |
@@ -562,6 +588,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = { | |||
562 | .rfkill_poll = rt2x00mac_rfkill_poll, | 588 | .rfkill_poll = rt2x00mac_rfkill_poll, |
563 | .ampdu_action = rt2800_ampdu_action, | 589 | .ampdu_action = rt2800_ampdu_action, |
564 | .flush = rt2x00mac_flush, | 590 | .flush = rt2x00mac_flush, |
591 | .get_survey = rt2800_get_survey, | ||
565 | }; | 592 | }; |
566 | 593 | ||
567 | static const struct rt2800_ops rt2800usb_rt2800_ops = { | 594 | static const struct rt2800_ops rt2800usb_rt2800_ops = { |
@@ -591,12 +618,14 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | |||
591 | .reset_tuner = rt2800_reset_tuner, | 618 | .reset_tuner = rt2800_reset_tuner, |
592 | .link_tuner = rt2800_link_tuner, | 619 | .link_tuner = rt2800_link_tuner, |
593 | .watchdog = rt2800usb_watchdog, | 620 | .watchdog = rt2800usb_watchdog, |
621 | .start_queue = rt2800usb_start_queue, | ||
622 | .kick_queue = rt2x00usb_kick_queue, | ||
623 | .stop_queue = rt2800usb_stop_queue, | ||
624 | .flush_queue = rt2x00usb_flush_queue, | ||
594 | .write_tx_desc = rt2800usb_write_tx_desc, | 625 | .write_tx_desc = rt2800usb_write_tx_desc, |
595 | .write_tx_data = rt2800usb_write_tx_data, | 626 | .write_tx_data = rt2800usb_write_tx_data, |
596 | .write_beacon = rt2800_write_beacon, | 627 | .write_beacon = rt2800_write_beacon, |
597 | .get_tx_data_len = rt2800usb_get_tx_data_len, | 628 | .get_tx_data_len = rt2800usb_get_tx_data_len, |
598 | .kick_tx_queue = rt2x00usb_kick_tx_queue, | ||
599 | .kill_tx_queue = rt2800usb_kill_tx_queue, | ||
600 | .fill_rxdone = rt2800usb_fill_rxdone, | 629 | .fill_rxdone = rt2800usb_fill_rxdone, |
601 | .config_shared_key = rt2800_config_shared_key, | 630 | .config_shared_key = rt2800_config_shared_key, |
602 | .config_pairwise_key = rt2800_config_pairwise_key, | 631 | .config_pairwise_key = rt2800_config_pairwise_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index e72117f3fdf5..c254d5a62c7d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -66,7 +66,7 @@ | |||
66 | 66 | ||
67 | #ifdef CONFIG_RT2X00_DEBUG | 67 | #ifdef CONFIG_RT2X00_DEBUG |
68 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ | 68 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ |
69 | DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, ##__args); | 69 | DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, ##__args) |
70 | #else | 70 | #else |
71 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ | 71 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ |
72 | do { } while (0) | 72 | do { } while (0) |
@@ -567,7 +567,15 @@ struct rt2x00lib_ops { | |||
567 | struct link_qual *qual); | 567 | struct link_qual *qual); |
568 | void (*link_tuner) (struct rt2x00_dev *rt2x00dev, | 568 | void (*link_tuner) (struct rt2x00_dev *rt2x00dev, |
569 | struct link_qual *qual, const u32 count); | 569 | struct link_qual *qual, const u32 count); |
570 | |||
571 | /* | ||
572 | * Data queue handlers. | ||
573 | */ | ||
570 | void (*watchdog) (struct rt2x00_dev *rt2x00dev); | 574 | void (*watchdog) (struct rt2x00_dev *rt2x00dev); |
575 | void (*start_queue) (struct data_queue *queue); | ||
576 | void (*kick_queue) (struct data_queue *queue); | ||
577 | void (*stop_queue) (struct data_queue *queue); | ||
578 | void (*flush_queue) (struct data_queue *queue); | ||
571 | 579 | ||
572 | /* | 580 | /* |
573 | * TX control handlers | 581 | * TX control handlers |
@@ -579,8 +587,6 @@ struct rt2x00lib_ops { | |||
579 | void (*write_beacon) (struct queue_entry *entry, | 587 | void (*write_beacon) (struct queue_entry *entry, |
580 | struct txentry_desc *txdesc); | 588 | struct txentry_desc *txdesc); |
581 | int (*get_tx_data_len) (struct queue_entry *entry); | 589 | int (*get_tx_data_len) (struct queue_entry *entry); |
582 | void (*kick_tx_queue) (struct data_queue *queue); | ||
583 | void (*kill_tx_queue) (struct data_queue *queue); | ||
584 | 590 | ||
585 | /* | 591 | /* |
586 | * RX control handlers | 592 | * RX control handlers |
@@ -1068,6 +1074,78 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | |||
1068 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, | 1074 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, |
1069 | enum queue_index index); | 1075 | enum queue_index index); |
1070 | 1076 | ||
1077 | /** | ||
1078 | * rt2x00queue_pause_queue - Pause a data queue | ||
1079 | * @queue: Pointer to &struct data_queue. | ||
1080 | * | ||
1081 | * This function will pause the data queue locally, preventing | ||
1082 | * new frames to be added to the queue (while the hardware is | ||
1083 | * still allowed to run). | ||
1084 | */ | ||
1085 | void rt2x00queue_pause_queue(struct data_queue *queue); | ||
1086 | |||
1087 | /** | ||
1088 | * rt2x00queue_unpause_queue - unpause a data queue | ||
1089 | * @queue: Pointer to &struct data_queue. | ||
1090 | * | ||
1091 | * This function will unpause the data queue locally, allowing | ||
1092 | * new frames to be added to the queue again. | ||
1093 | */ | ||
1094 | void rt2x00queue_unpause_queue(struct data_queue *queue); | ||
1095 | |||
1096 | /** | ||
1097 | * rt2x00queue_start_queue - Start a data queue | ||
1098 | * @queue: Pointer to &struct data_queue. | ||
1099 | * | ||
1100 | * This function will start handling all pending frames in the queue. | ||
1101 | */ | ||
1102 | void rt2x00queue_start_queue(struct data_queue *queue); | ||
1103 | |||
1104 | /** | ||
1105 | * rt2x00queue_stop_queue - Halt a data queue | ||
1106 | * @queue: Pointer to &struct data_queue. | ||
1107 | * | ||
1108 | * This function will stop all pending frames in the queue. | ||
1109 | */ | ||
1110 | void rt2x00queue_stop_queue(struct data_queue *queue); | ||
1111 | |||
1112 | /** | ||
1113 | * rt2x00queue_flush_queue - Flush a data queue | ||
1114 | * @queue: Pointer to &struct data_queue. | ||
1115 | * @drop: True to drop all pending frames. | ||
1116 | * | ||
1117 | * This function will flush the queue. After this call | ||
1118 | * the queue is guarenteed to be empty. | ||
1119 | */ | ||
1120 | void rt2x00queue_flush_queue(struct data_queue *queue, bool drop); | ||
1121 | |||
1122 | /** | ||
1123 | * rt2x00queue_start_queues - Start all data queues | ||
1124 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
1125 | * | ||
1126 | * This function will loop through all available queues to start them | ||
1127 | */ | ||
1128 | void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev); | ||
1129 | |||
1130 | /** | ||
1131 | * rt2x00queue_stop_queues - Halt all data queues | ||
1132 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
1133 | * | ||
1134 | * This function will loop through all available queues to stop | ||
1135 | * any pending frames. | ||
1136 | */ | ||
1137 | void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev); | ||
1138 | |||
1139 | /** | ||
1140 | * rt2x00queue_flush_queues - Flush all data queues | ||
1141 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
1142 | * @drop: True to drop all pending frames. | ||
1143 | * | ||
1144 | * This function will loop through all available queues to flush | ||
1145 | * any pending frames. | ||
1146 | */ | ||
1147 | void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop); | ||
1148 | |||
1071 | /* | 1149 | /* |
1072 | * Debugfs handlers. | 1150 | * Debugfs handlers. |
1073 | */ | 1151 | */ |
@@ -1093,6 +1171,7 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
1093 | */ | 1171 | */ |
1094 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); | 1172 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); |
1095 | void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); | 1173 | void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); |
1174 | void rt2x00lib_dmastart(struct queue_entry *entry); | ||
1096 | void rt2x00lib_dmadone(struct queue_entry *entry); | 1175 | void rt2x00lib_dmadone(struct queue_entry *entry); |
1097 | void rt2x00lib_txdone(struct queue_entry *entry, | 1176 | void rt2x00lib_txdone(struct queue_entry *entry, |
1098 | struct txdone_entry_desc *txdesc); | 1177 | struct txdone_entry_desc *txdesc); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index a238e908c854..70ca9379833b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -146,8 +146,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
146 | * else the changes will be ignored by the device. | 146 | * else the changes will be ignored by the device. |
147 | */ | 147 | */ |
148 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | 148 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
149 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 149 | rt2x00queue_stop_queue(rt2x00dev->rx); |
150 | STATE_RADIO_RX_OFF); | ||
151 | 150 | ||
152 | /* | 151 | /* |
153 | * Write new antenna setup to device and reset the link tuner. | 152 | * Write new antenna setup to device and reset the link tuner. |
@@ -161,8 +160,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
161 | memcpy(active, &config, sizeof(config)); | 160 | memcpy(active, &config, sizeof(config)); |
162 | 161 | ||
163 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | 162 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
164 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 163 | rt2x00queue_start_queue(rt2x00dev->rx); |
165 | STATE_RADIO_RX_ON); | ||
166 | } | 164 | } |
167 | 165 | ||
168 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | 166 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 64dfb1f6823e..c92db3264741 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -339,12 +339,13 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file, | |||
339 | return -ENOMEM; | 339 | return -ENOMEM; |
340 | 340 | ||
341 | temp = data + | 341 | temp = data + |
342 | sprintf(data, "qid\tcount\tlimit\tlength\tindex\tdma done\tdone\n"); | 342 | sprintf(data, "qid\tflags\t\tcount\tlimit\tlength\tindex\tdma done\tdone\n"); |
343 | 343 | ||
344 | queue_for_each(intf->rt2x00dev, queue) { | 344 | queue_for_each(intf->rt2x00dev, queue) { |
345 | spin_lock_irqsave(&queue->index_lock, irqflags); | 345 | spin_lock_irqsave(&queue->index_lock, irqflags); |
346 | 346 | ||
347 | temp += sprintf(temp, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", queue->qid, | 347 | temp += sprintf(temp, "%d\t0x%.8x\t%d\t%d\t%d\t%d\t%d\t\t%d\n", |
348 | queue->qid, (unsigned int)queue->flags, | ||
348 | queue->count, queue->limit, queue->length, | 349 | queue->count, queue->limit, queue->length, |
349 | queue->index[Q_INDEX], | 350 | queue->index[Q_INDEX], |
350 | queue->index[Q_INDEX_DMA_DONE], | 351 | queue->index[Q_INDEX_DMA_DONE], |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index bd3afc92f434..fa74acdd271f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -66,9 +66,9 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
66 | set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags); | 66 | set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Enable RX. | 69 | * Enable queues. |
70 | */ | 70 | */ |
71 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_ON); | 71 | rt2x00queue_start_queues(rt2x00dev); |
72 | rt2x00link_start_tuner(rt2x00dev); | 72 | rt2x00link_start_tuner(rt2x00dev); |
73 | 73 | ||
74 | /* | 74 | /* |
@@ -76,11 +76,6 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
76 | */ | 76 | */ |
77 | rt2x00link_start_watchdog(rt2x00dev); | 77 | rt2x00link_start_watchdog(rt2x00dev); |
78 | 78 | ||
79 | /* | ||
80 | * Start the TX queues. | ||
81 | */ | ||
82 | ieee80211_wake_queues(rt2x00dev->hw); | ||
83 | |||
84 | return 0; | 79 | return 0; |
85 | } | 80 | } |
86 | 81 | ||
@@ -90,21 +85,16 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
90 | return; | 85 | return; |
91 | 86 | ||
92 | /* | 87 | /* |
93 | * Stop the TX queues in mac80211. | ||
94 | */ | ||
95 | ieee80211_stop_queues(rt2x00dev->hw); | ||
96 | rt2x00queue_stop_queues(rt2x00dev); | ||
97 | |||
98 | /* | ||
99 | * Stop watchdog monitoring. | 88 | * Stop watchdog monitoring. |
100 | */ | 89 | */ |
101 | rt2x00link_stop_watchdog(rt2x00dev); | 90 | rt2x00link_stop_watchdog(rt2x00dev); |
102 | 91 | ||
103 | /* | 92 | /* |
104 | * Disable RX. | 93 | * Stop all queues |
105 | */ | 94 | */ |
106 | rt2x00link_stop_tuner(rt2x00dev); | 95 | rt2x00link_stop_tuner(rt2x00dev); |
107 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_OFF); | 96 | rt2x00queue_stop_queues(rt2x00dev); |
97 | rt2x00queue_flush_queues(rt2x00dev, true); | ||
108 | 98 | ||
109 | /* | 99 | /* |
110 | * Disable radio. | 100 | * Disable radio. |
@@ -236,8 +226,16 @@ void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev) | |||
236 | } | 226 | } |
237 | EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt); | 227 | EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt); |
238 | 228 | ||
229 | void rt2x00lib_dmastart(struct queue_entry *entry) | ||
230 | { | ||
231 | set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | ||
232 | rt2x00queue_index_inc(entry->queue, Q_INDEX); | ||
233 | } | ||
234 | EXPORT_SYMBOL_GPL(rt2x00lib_dmastart); | ||
235 | |||
239 | void rt2x00lib_dmadone(struct queue_entry *entry) | 236 | void rt2x00lib_dmadone(struct queue_entry *entry) |
240 | { | 237 | { |
238 | set_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags); | ||
241 | clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | 239 | clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
242 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DMA_DONE); | 240 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DMA_DONE); |
243 | } | 241 | } |
@@ -249,7 +247,6 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
249 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 247 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
250 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 248 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
251 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 249 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
252 | enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); | ||
253 | unsigned int header_length, i; | 250 | unsigned int header_length, i; |
254 | u8 rate_idx, rate_flags, retry_rates; | 251 | u8 rate_idx, rate_flags, retry_rates; |
255 | u8 skbdesc_flags = skbdesc->flags; | 252 | u8 skbdesc_flags = skbdesc->flags; |
@@ -403,7 +400,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
403 | * is reenabled when the txdone handler has finished. | 400 | * is reenabled when the txdone handler has finished. |
404 | */ | 401 | */ |
405 | if (!rt2x00queue_threshold(entry->queue)) | 402 | if (!rt2x00queue_threshold(entry->queue)) |
406 | ieee80211_wake_queue(rt2x00dev->hw, qid); | 403 | rt2x00queue_unpause_queue(entry->queue); |
407 | } | 404 | } |
408 | EXPORT_SYMBOL_GPL(rt2x00lib_txdone); | 405 | EXPORT_SYMBOL_GPL(rt2x00lib_txdone); |
409 | 406 | ||
@@ -566,10 +563,8 @@ submit_entry: | |||
566 | entry->flags = 0; | 563 | entry->flags = 0; |
567 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); | 564 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); |
568 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && | 565 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && |
569 | test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) { | 566 | test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
570 | rt2x00dev->ops->lib->clear_entry(entry); | 567 | rt2x00dev->ops->lib->clear_entry(entry); |
571 | rt2x00queue_index_inc(entry->queue, Q_INDEX); | ||
572 | } | ||
573 | } | 568 | } |
574 | EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); | 569 | EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); |
575 | 570 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 2cf68f82674b..a105c500627b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -178,15 +178,6 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
178 | void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); | 178 | void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * rt2x00queue_stop_queues - Halt all data queues | ||
182 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
183 | * | ||
184 | * This function will loop through all available queues to stop | ||
185 | * any pending outgoing frames. | ||
186 | */ | ||
187 | void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev); | ||
188 | |||
189 | /** | ||
190 | * rt2x00queue_init_queues - Initialize all data queues | 181 | * rt2x00queue_init_queues - Initialize all data queues |
191 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | 182 | * @rt2x00dev: Pointer to &struct rt2x00_dev. |
192 | * | 183 | * |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 829bf4be9bc3..4cac7ad60f47 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -104,7 +104,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
104 | struct rt2x00_dev *rt2x00dev = hw->priv; | 104 | struct rt2x00_dev *rt2x00dev = hw->priv; |
105 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 105 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
106 | enum data_queue_qid qid = skb_get_queue_mapping(skb); | 106 | enum data_queue_qid qid = skb_get_queue_mapping(skb); |
107 | struct data_queue *queue; | 107 | struct data_queue *queue = NULL; |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * Mac80211 might be calling this function while we are trying | 110 | * Mac80211 might be calling this function while we are trying |
@@ -153,7 +153,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
153 | goto exit_fail; | 153 | goto exit_fail; |
154 | 154 | ||
155 | if (rt2x00queue_threshold(queue)) | 155 | if (rt2x00queue_threshold(queue)) |
156 | ieee80211_stop_queue(rt2x00dev->hw, qid); | 156 | rt2x00queue_pause_queue(queue); |
157 | 157 | ||
158 | return NETDEV_TX_OK; | 158 | return NETDEV_TX_OK; |
159 | 159 | ||
@@ -352,7 +352,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed) | |||
352 | * if for any reason the link tuner must be reset, this will be | 352 | * if for any reason the link tuner must be reset, this will be |
353 | * handled by rt2x00lib_config(). | 353 | * handled by rt2x00lib_config(). |
354 | */ | 354 | */ |
355 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_OFF); | 355 | rt2x00queue_stop_queue(rt2x00dev->rx); |
356 | 356 | ||
357 | /* | 357 | /* |
358 | * When we've just turned on the radio, we want to reprogram | 358 | * When we've just turned on the radio, we want to reprogram |
@@ -370,7 +370,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed) | |||
370 | rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant); | 370 | rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant); |
371 | 371 | ||
372 | /* Turn RX back on */ | 372 | /* Turn RX back on */ |
373 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_ON); | 373 | rt2x00queue_start_queue(rt2x00dev->rx); |
374 | 374 | ||
375 | return 0; | 375 | return 0; |
376 | } | 376 | } |
@@ -718,36 +718,8 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop) | |||
718 | { | 718 | { |
719 | struct rt2x00_dev *rt2x00dev = hw->priv; | 719 | struct rt2x00_dev *rt2x00dev = hw->priv; |
720 | struct data_queue *queue; | 720 | struct data_queue *queue; |
721 | unsigned int i = 0; | ||
722 | |||
723 | ieee80211_stop_queues(hw); | ||
724 | |||
725 | /* | ||
726 | * Run over all queues to kick them, this will force | ||
727 | * any pending frames to be transmitted. | ||
728 | */ | ||
729 | tx_queue_for_each(rt2x00dev, queue) { | ||
730 | rt2x00dev->ops->lib->kick_tx_queue(queue); | ||
731 | } | ||
732 | |||
733 | /** | ||
734 | * All queues have been kicked, now wait for each queue | ||
735 | * to become empty. With a bit of luck, we only have to wait | ||
736 | * for the first queue to become empty, because while waiting | ||
737 | * for the that queue, the other queues will have transmitted | ||
738 | * all their frames as well (since they were already kicked). | ||
739 | */ | ||
740 | tx_queue_for_each(rt2x00dev, queue) { | ||
741 | for (i = 0; i < 10; i++) { | ||
742 | if (rt2x00queue_empty(queue)) | ||
743 | break; | ||
744 | msleep(100); | ||
745 | } | ||
746 | |||
747 | if (!rt2x00queue_empty(queue)) | ||
748 | WARNING(rt2x00dev, "Failed to flush queue %d", queue->qid); | ||
749 | } | ||
750 | 721 | ||
751 | ieee80211_wake_queues(hw); | 722 | tx_queue_for_each(rt2x00dev, queue) |
723 | rt2x00queue_flush_queue(queue, drop); | ||
752 | } | 724 | } |
753 | EXPORT_SYMBOL_GPL(rt2x00mac_flush); | 725 | EXPORT_SYMBOL_GPL(rt2x00mac_flush); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 868ca19b13ea..28e6ff1a6694 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -82,6 +82,13 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
82 | skbdesc->desc_len = entry->queue->desc_size; | 82 | skbdesc->desc_len = entry->queue->desc_size; |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * DMA is already done, notify rt2x00lib that | ||
86 | * it finished successfully. | ||
87 | */ | ||
88 | rt2x00lib_dmastart(entry); | ||
89 | rt2x00lib_dmadone(entry); | ||
90 | |||
91 | /* | ||
85 | * Send the frame to rt2x00lib for further processing. | 92 | * Send the frame to rt2x00lib for further processing. |
86 | */ | 93 | */ |
87 | rt2x00lib_rxdone(entry); | 94 | rt2x00lib_rxdone(entry); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h index b854d62ff99b..746ce8fe8cf4 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.h +++ b/drivers/net/wireless/rt2x00/rt2x00pci.h | |||
@@ -64,7 +64,7 @@ static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, | |||
64 | const void *value, | 64 | const void *value, |
65 | const u32 length) | 65 | const u32 length) |
66 | { | 66 | { |
67 | memcpy_toio(rt2x00dev->csr.base + offset, value, length); | 67 | __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); |
68 | } | 68 | } |
69 | 69 | ||
70 | /** | 70 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index a3d79c7a21c6..ca82b3a91697 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -199,15 +199,18 @@ void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) | |||
199 | 199 | ||
200 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) | 200 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) |
201 | { | 201 | { |
202 | unsigned int l2pad = L2PAD_SIZE(header_length); | 202 | /* |
203 | * L2 padding is only present if the skb contains more than just the | ||
204 | * IEEE 802.11 header. | ||
205 | */ | ||
206 | unsigned int l2pad = (skb->len > header_length) ? | ||
207 | L2PAD_SIZE(header_length) : 0; | ||
203 | 208 | ||
204 | if (!l2pad) | 209 | if (!l2pad) |
205 | return; | 210 | return; |
206 | 211 | ||
207 | memmove(skb->data + header_length, skb->data + header_length + l2pad, | 212 | memmove(skb->data + l2pad, skb->data, header_length); |
208 | skb->len - header_length - l2pad); | 213 | skb_pull(skb, l2pad); |
209 | |||
210 | skb_trim(skb, skb->len - l2pad); | ||
211 | } | 214 | } |
212 | 215 | ||
213 | static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry, | 216 | static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry, |
@@ -468,7 +471,7 @@ static void rt2x00queue_kick_tx_queue(struct data_queue *queue, | |||
468 | */ | 471 | */ |
469 | if (rt2x00queue_threshold(queue) || | 472 | if (rt2x00queue_threshold(queue) || |
470 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) | 473 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) |
471 | queue->rt2x00dev->ops->lib->kick_tx_queue(queue); | 474 | queue->rt2x00dev->ops->lib->kick_queue(queue); |
472 | } | 475 | } |
473 | 476 | ||
474 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | 477 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, |
@@ -582,7 +585,7 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
582 | rt2x00queue_free_skb(intf->beacon); | 585 | rt2x00queue_free_skb(intf->beacon); |
583 | 586 | ||
584 | if (!enable_beacon) { | 587 | if (!enable_beacon) { |
585 | rt2x00dev->ops->lib->kill_tx_queue(intf->beacon->queue); | 588 | rt2x00queue_stop_queue(intf->beacon->queue); |
586 | mutex_unlock(&intf->beacon_skb_mutex); | 589 | mutex_unlock(&intf->beacon_skb_mutex); |
587 | return 0; | 590 | return 0; |
588 | } | 591 | } |
@@ -735,6 +738,210 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index) | |||
735 | spin_unlock_irqrestore(&queue->index_lock, irqflags); | 738 | spin_unlock_irqrestore(&queue->index_lock, irqflags); |
736 | } | 739 | } |
737 | 740 | ||
741 | void rt2x00queue_pause_queue(struct data_queue *queue) | ||
742 | { | ||
743 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
744 | !test_bit(QUEUE_STARTED, &queue->flags) || | ||
745 | test_and_set_bit(QUEUE_PAUSED, &queue->flags)) | ||
746 | return; | ||
747 | |||
748 | switch (queue->qid) { | ||
749 | case QID_AC_VO: | ||
750 | case QID_AC_VI: | ||
751 | case QID_AC_BE: | ||
752 | case QID_AC_BK: | ||
753 | /* | ||
754 | * For TX queues, we have to disable the queue | ||
755 | * inside mac80211. | ||
756 | */ | ||
757 | ieee80211_stop_queue(queue->rt2x00dev->hw, queue->qid); | ||
758 | break; | ||
759 | default: | ||
760 | break; | ||
761 | } | ||
762 | } | ||
763 | EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); | ||
764 | |||
765 | void rt2x00queue_unpause_queue(struct data_queue *queue) | ||
766 | { | ||
767 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
768 | !test_bit(QUEUE_STARTED, &queue->flags) || | ||
769 | !test_and_clear_bit(QUEUE_PAUSED, &queue->flags)) | ||
770 | return; | ||
771 | |||
772 | switch (queue->qid) { | ||
773 | case QID_AC_VO: | ||
774 | case QID_AC_VI: | ||
775 | case QID_AC_BE: | ||
776 | case QID_AC_BK: | ||
777 | /* | ||
778 | * For TX queues, we have to enable the queue | ||
779 | * inside mac80211. | ||
780 | */ | ||
781 | ieee80211_wake_queue(queue->rt2x00dev->hw, queue->qid); | ||
782 | break; | ||
783 | case QID_RX: | ||
784 | /* | ||
785 | * For RX we need to kick the queue now in order to | ||
786 | * receive frames. | ||
787 | */ | ||
788 | queue->rt2x00dev->ops->lib->kick_queue(queue); | ||
789 | default: | ||
790 | break; | ||
791 | } | ||
792 | } | ||
793 | EXPORT_SYMBOL_GPL(rt2x00queue_unpause_queue); | ||
794 | |||
795 | void rt2x00queue_start_queue(struct data_queue *queue) | ||
796 | { | ||
797 | mutex_lock(&queue->status_lock); | ||
798 | |||
799 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
800 | test_and_set_bit(QUEUE_STARTED, &queue->flags)) { | ||
801 | mutex_unlock(&queue->status_lock); | ||
802 | return; | ||
803 | } | ||
804 | |||
805 | set_bit(QUEUE_PAUSED, &queue->flags); | ||
806 | |||
807 | queue->rt2x00dev->ops->lib->start_queue(queue); | ||
808 | |||
809 | rt2x00queue_unpause_queue(queue); | ||
810 | |||
811 | mutex_unlock(&queue->status_lock); | ||
812 | } | ||
813 | EXPORT_SYMBOL_GPL(rt2x00queue_start_queue); | ||
814 | |||
815 | void rt2x00queue_stop_queue(struct data_queue *queue) | ||
816 | { | ||
817 | mutex_lock(&queue->status_lock); | ||
818 | |||
819 | if (!test_and_clear_bit(QUEUE_STARTED, &queue->flags)) { | ||
820 | mutex_unlock(&queue->status_lock); | ||
821 | return; | ||
822 | } | ||
823 | |||
824 | rt2x00queue_pause_queue(queue); | ||
825 | |||
826 | queue->rt2x00dev->ops->lib->stop_queue(queue); | ||
827 | |||
828 | mutex_unlock(&queue->status_lock); | ||
829 | } | ||
830 | EXPORT_SYMBOL_GPL(rt2x00queue_stop_queue); | ||
831 | |||
832 | void rt2x00queue_flush_queue(struct data_queue *queue, bool drop) | ||
833 | { | ||
834 | unsigned int i; | ||
835 | bool started; | ||
836 | bool tx_queue = | ||
837 | (queue->qid == QID_AC_VO) || | ||
838 | (queue->qid == QID_AC_VI) || | ||
839 | (queue->qid == QID_AC_BE) || | ||
840 | (queue->qid == QID_AC_BK); | ||
841 | |||
842 | mutex_lock(&queue->status_lock); | ||
843 | |||
844 | /* | ||
845 | * If the queue has been started, we must stop it temporarily | ||
846 | * to prevent any new frames to be queued on the device. If | ||
847 | * we are not dropping the pending frames, the queue must | ||
848 | * only be stopped in the software and not the hardware, | ||
849 | * otherwise the queue will never become empty on its own. | ||
850 | */ | ||
851 | started = test_bit(QUEUE_STARTED, &queue->flags); | ||
852 | if (started) { | ||
853 | /* | ||
854 | * Pause the queue | ||
855 | */ | ||
856 | rt2x00queue_pause_queue(queue); | ||
857 | |||
858 | /* | ||
859 | * If we are not supposed to drop any pending | ||
860 | * frames, this means we must force a start (=kick) | ||
861 | * to the queue to make sure the hardware will | ||
862 | * start transmitting. | ||
863 | */ | ||
864 | if (!drop && tx_queue) | ||
865 | queue->rt2x00dev->ops->lib->kick_queue(queue); | ||
866 | } | ||
867 | |||
868 | /* | ||
869 | * Check if driver supports flushing, we can only guarentee | ||
870 | * full support for flushing if the driver is able | ||
871 | * to cancel all pending frames (drop = true). | ||
872 | */ | ||
873 | if (drop && queue->rt2x00dev->ops->lib->flush_queue) | ||
874 | queue->rt2x00dev->ops->lib->flush_queue(queue); | ||
875 | |||
876 | /* | ||
877 | * When we don't want to drop any frames, or when | ||
878 | * the driver doesn't fully flush the queue correcly, | ||
879 | * we must wait for the queue to become empty. | ||
880 | */ | ||
881 | for (i = 0; !rt2x00queue_empty(queue) && i < 100; i++) | ||
882 | msleep(10); | ||
883 | |||
884 | /* | ||
885 | * The queue flush has failed... | ||
886 | */ | ||
887 | if (unlikely(!rt2x00queue_empty(queue))) | ||
888 | WARNING(queue->rt2x00dev, "Queue %d failed to flush", queue->qid); | ||
889 | |||
890 | /* | ||
891 | * Restore the queue to the previous status | ||
892 | */ | ||
893 | if (started) | ||
894 | rt2x00queue_unpause_queue(queue); | ||
895 | |||
896 | mutex_unlock(&queue->status_lock); | ||
897 | } | ||
898 | EXPORT_SYMBOL_GPL(rt2x00queue_flush_queue); | ||
899 | |||
900 | void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev) | ||
901 | { | ||
902 | struct data_queue *queue; | ||
903 | |||
904 | /* | ||
905 | * rt2x00queue_start_queue will call ieee80211_wake_queue | ||
906 | * for each queue after is has been properly initialized. | ||
907 | */ | ||
908 | tx_queue_for_each(rt2x00dev, queue) | ||
909 | rt2x00queue_start_queue(queue); | ||
910 | |||
911 | rt2x00queue_start_queue(rt2x00dev->rx); | ||
912 | } | ||
913 | EXPORT_SYMBOL_GPL(rt2x00queue_start_queues); | ||
914 | |||
915 | void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev) | ||
916 | { | ||
917 | struct data_queue *queue; | ||
918 | |||
919 | /* | ||
920 | * rt2x00queue_stop_queue will call ieee80211_stop_queue | ||
921 | * as well, but we are completely shutting doing everything | ||
922 | * now, so it is much safer to stop all TX queues at once, | ||
923 | * and use rt2x00queue_stop_queue for cleaning up. | ||
924 | */ | ||
925 | ieee80211_stop_queues(rt2x00dev->hw); | ||
926 | |||
927 | tx_queue_for_each(rt2x00dev, queue) | ||
928 | rt2x00queue_stop_queue(queue); | ||
929 | |||
930 | rt2x00queue_stop_queue(rt2x00dev->rx); | ||
931 | } | ||
932 | EXPORT_SYMBOL_GPL(rt2x00queue_stop_queues); | ||
933 | |||
934 | void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop) | ||
935 | { | ||
936 | struct data_queue *queue; | ||
937 | |||
938 | tx_queue_for_each(rt2x00dev, queue) | ||
939 | rt2x00queue_flush_queue(queue, drop); | ||
940 | |||
941 | rt2x00queue_flush_queue(rt2x00dev->rx, drop); | ||
942 | } | ||
943 | EXPORT_SYMBOL_GPL(rt2x00queue_flush_queues); | ||
944 | |||
738 | static void rt2x00queue_reset(struct data_queue *queue) | 945 | static void rt2x00queue_reset(struct data_queue *queue) |
739 | { | 946 | { |
740 | unsigned long irqflags; | 947 | unsigned long irqflags; |
@@ -753,14 +960,6 @@ static void rt2x00queue_reset(struct data_queue *queue) | |||
753 | spin_unlock_irqrestore(&queue->index_lock, irqflags); | 960 | spin_unlock_irqrestore(&queue->index_lock, irqflags); |
754 | } | 961 | } |
755 | 962 | ||
756 | void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev) | ||
757 | { | ||
758 | struct data_queue *queue; | ||
759 | |||
760 | txall_queue_for_each(rt2x00dev, queue) | ||
761 | rt2x00dev->ops->lib->kill_tx_queue(queue); | ||
762 | } | ||
763 | |||
764 | void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) | 963 | void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) |
765 | { | 964 | { |
766 | struct data_queue *queue; | 965 | struct data_queue *queue; |
@@ -769,11 +968,8 @@ void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) | |||
769 | queue_for_each(rt2x00dev, queue) { | 968 | queue_for_each(rt2x00dev, queue) { |
770 | rt2x00queue_reset(queue); | 969 | rt2x00queue_reset(queue); |
771 | 970 | ||
772 | for (i = 0; i < queue->limit; i++) { | 971 | for (i = 0; i < queue->limit; i++) |
773 | rt2x00dev->ops->lib->clear_entry(&queue->entries[i]); | 972 | rt2x00dev->ops->lib->clear_entry(&queue->entries[i]); |
774 | if (queue->qid == QID_RX) | ||
775 | rt2x00queue_index_inc(queue, Q_INDEX); | ||
776 | } | ||
777 | } | 973 | } |
778 | } | 974 | } |
779 | 975 | ||
@@ -902,6 +1098,7 @@ void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
902 | static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev, | 1098 | static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev, |
903 | struct data_queue *queue, enum data_queue_qid qid) | 1099 | struct data_queue *queue, enum data_queue_qid qid) |
904 | { | 1100 | { |
1101 | mutex_init(&queue->status_lock); | ||
905 | spin_lock_init(&queue->index_lock); | 1102 | spin_lock_init(&queue->index_lock); |
906 | 1103 | ||
907 | queue->rt2x00dev = rt2x00dev; | 1104 | queue->rt2x00dev = rt2x00dev; |
@@ -944,7 +1141,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev) | |||
944 | /* | 1141 | /* |
945 | * Initialize queue parameters. | 1142 | * Initialize queue parameters. |
946 | * RX: qid = QID_RX | 1143 | * RX: qid = QID_RX |
947 | * TX: qid = QID_AC_BE + index | 1144 | * TX: qid = QID_AC_VO + index |
948 | * TX: cw_min: 2^5 = 32. | 1145 | * TX: cw_min: 2^5 = 32. |
949 | * TX: cw_max: 2^10 = 1024. | 1146 | * TX: cw_max: 2^10 = 1024. |
950 | * BCN: qid = QID_BEACON | 1147 | * BCN: qid = QID_BEACON |
@@ -952,7 +1149,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev) | |||
952 | */ | 1149 | */ |
953 | rt2x00queue_init(rt2x00dev, rt2x00dev->rx, QID_RX); | 1150 | rt2x00queue_init(rt2x00dev, rt2x00dev->rx, QID_RX); |
954 | 1151 | ||
955 | qid = QID_AC_BE; | 1152 | qid = QID_AC_VO; |
956 | tx_queue_for_each(rt2x00dev, queue) | 1153 | tx_queue_for_each(rt2x00dev, queue) |
957 | rt2x00queue_init(rt2x00dev, queue, qid++); | 1154 | rt2x00queue_init(rt2x00dev, queue, qid++); |
958 | 1155 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 29b051ac6401..fab8e2687f29 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -45,10 +45,10 @@ | |||
45 | /** | 45 | /** |
46 | * enum data_queue_qid: Queue identification | 46 | * enum data_queue_qid: Queue identification |
47 | * | 47 | * |
48 | * @QID_AC_VO: AC VO queue | ||
49 | * @QID_AC_VI: AC VI queue | ||
48 | * @QID_AC_BE: AC BE queue | 50 | * @QID_AC_BE: AC BE queue |
49 | * @QID_AC_BK: AC BK queue | 51 | * @QID_AC_BK: AC BK queue |
50 | * @QID_AC_VI: AC VI queue | ||
51 | * @QID_AC_VO: AC VO queue | ||
52 | * @QID_HCCA: HCCA queue | 52 | * @QID_HCCA: HCCA queue |
53 | * @QID_MGMT: MGMT queue (prio queue) | 53 | * @QID_MGMT: MGMT queue (prio queue) |
54 | * @QID_RX: RX queue | 54 | * @QID_RX: RX queue |
@@ -57,10 +57,10 @@ | |||
57 | * @QID_ATIM: Atim queue (value unspeficied, don't send it to device) | 57 | * @QID_ATIM: Atim queue (value unspeficied, don't send it to device) |
58 | */ | 58 | */ |
59 | enum data_queue_qid { | 59 | enum data_queue_qid { |
60 | QID_AC_BE = 0, | 60 | QID_AC_VO = 0, |
61 | QID_AC_BK = 1, | 61 | QID_AC_VI = 1, |
62 | QID_AC_VI = 2, | 62 | QID_AC_BE = 2, |
63 | QID_AC_VO = 3, | 63 | QID_AC_BK = 3, |
64 | QID_HCCA = 4, | 64 | QID_HCCA = 4, |
65 | QID_MGMT = 13, | 65 | QID_MGMT = 13, |
66 | QID_RX = 14, | 66 | QID_RX = 14, |
@@ -340,12 +340,16 @@ struct txentry_desc { | |||
340 | * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occured | 340 | * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occured |
341 | * while transfering the data to the hardware. No TX status report will | 341 | * while transfering the data to the hardware. No TX status report will |
342 | * be expected from the hardware. | 342 | * be expected from the hardware. |
343 | * @ENTRY_DATA_STATUS_PENDING: The entry has been send to the device and | ||
344 | * returned. It is now waiting for the status reporting before the | ||
345 | * entry can be reused again. | ||
343 | */ | 346 | */ |
344 | enum queue_entry_flags { | 347 | enum queue_entry_flags { |
345 | ENTRY_BCN_ASSIGNED, | 348 | ENTRY_BCN_ASSIGNED, |
346 | ENTRY_OWNER_DEVICE_DATA, | 349 | ENTRY_OWNER_DEVICE_DATA, |
347 | ENTRY_DATA_PENDING, | 350 | ENTRY_DATA_PENDING, |
348 | ENTRY_DATA_IO_FAILED | 351 | ENTRY_DATA_IO_FAILED, |
352 | ENTRY_DATA_STATUS_PENDING, | ||
349 | }; | 353 | }; |
350 | 354 | ||
351 | /** | 355 | /** |
@@ -392,12 +396,32 @@ enum queue_index { | |||
392 | }; | 396 | }; |
393 | 397 | ||
394 | /** | 398 | /** |
399 | * enum data_queue_flags: Status flags for data queues | ||
400 | * | ||
401 | * @QUEUE_STARTED: The queue has been started. Fox RX queues this means the | ||
402 | * device might be DMA'ing skbuffers. TX queues will accept skbuffers to | ||
403 | * be transmitted and beacon queues will start beaconing the configured | ||
404 | * beacons. | ||
405 | * @QUEUE_PAUSED: The queue has been started but is currently paused. | ||
406 | * When this bit is set, the queue has been stopped in mac80211, | ||
407 | * preventing new frames to be enqueued. However, a few frames | ||
408 | * might still appear shortly after the pausing... | ||
409 | */ | ||
410 | enum data_queue_flags { | ||
411 | QUEUE_STARTED, | ||
412 | QUEUE_PAUSED, | ||
413 | }; | ||
414 | |||
415 | /** | ||
395 | * struct data_queue: Data queue | 416 | * struct data_queue: Data queue |
396 | * | 417 | * |
397 | * @rt2x00dev: Pointer to main &struct rt2x00dev where this queue belongs to. | 418 | * @rt2x00dev: Pointer to main &struct rt2x00dev where this queue belongs to. |
398 | * @entries: Base address of the &struct queue_entry which are | 419 | * @entries: Base address of the &struct queue_entry which are |
399 | * part of this queue. | 420 | * part of this queue. |
400 | * @qid: The queue identification, see &enum data_queue_qid. | 421 | * @qid: The queue identification, see &enum data_queue_qid. |
422 | * @flags: Entry flags, see &enum queue_entry_flags. | ||
423 | * @status_lock: The mutex for protecting the start/stop/flush | ||
424 | * handling on this queue. | ||
401 | * @index_lock: Spinlock to protect index handling. Whenever @index, @index_done or | 425 | * @index_lock: Spinlock to protect index handling. Whenever @index, @index_done or |
402 | * @index_crypt needs to be changed this lock should be grabbed to prevent | 426 | * @index_crypt needs to be changed this lock should be grabbed to prevent |
403 | * index corruption due to concurrency. | 427 | * index corruption due to concurrency. |
@@ -421,8 +445,11 @@ struct data_queue { | |||
421 | struct queue_entry *entries; | 445 | struct queue_entry *entries; |
422 | 446 | ||
423 | enum data_queue_qid qid; | 447 | enum data_queue_qid qid; |
448 | unsigned long flags; | ||
424 | 449 | ||
450 | struct mutex status_lock; | ||
425 | spinlock_t index_lock; | 451 | spinlock_t index_lock; |
452 | |||
426 | unsigned int count; | 453 | unsigned int count; |
427 | unsigned short limit; | 454 | unsigned short limit; |
428 | unsigned short threshold; | 455 | unsigned short threshold; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h index ed71be95136d..e8259ae48ced 100644 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h | |||
@@ -83,8 +83,6 @@ enum dev_state { | |||
83 | */ | 83 | */ |
84 | STATE_RADIO_ON, | 84 | STATE_RADIO_ON, |
85 | STATE_RADIO_OFF, | 85 | STATE_RADIO_OFF, |
86 | STATE_RADIO_RX_ON, | ||
87 | STATE_RADIO_RX_OFF, | ||
88 | STATE_RADIO_IRQ_ON, | 86 | STATE_RADIO_IRQ_ON, |
89 | STATE_RADIO_IRQ_OFF, | 87 | STATE_RADIO_IRQ_OFF, |
90 | STATE_RADIO_IRQ_ON_ISR, | 88 | STATE_RADIO_IRQ_ON_ISR, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 9ac14598e2a0..1a9937d5aff6 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -195,7 +195,8 @@ static void rt2x00usb_work_txdone(struct work_struct *work) | |||
195 | while (!rt2x00queue_empty(queue)) { | 195 | while (!rt2x00queue_empty(queue)) { |
196 | entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); | 196 | entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); |
197 | 197 | ||
198 | if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | 198 | if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || |
199 | !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) | ||
199 | break; | 200 | break; |
200 | 201 | ||
201 | rt2x00usb_work_txdone_entry(entry); | 202 | rt2x00usb_work_txdone_entry(entry); |
@@ -235,8 +236,10 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry) | |||
235 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | 236 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
236 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | 237 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; |
237 | u32 length; | 238 | u32 length; |
239 | int status; | ||
238 | 240 | ||
239 | if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) | 241 | if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) || |
242 | test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) | ||
240 | return; | 243 | return; |
241 | 244 | ||
242 | /* | 245 | /* |
@@ -251,106 +254,15 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry) | |||
251 | entry->skb->data, length, | 254 | entry->skb->data, length, |
252 | rt2x00usb_interrupt_txdone, entry); | 255 | rt2x00usb_interrupt_txdone, entry); |
253 | 256 | ||
254 | if (usb_submit_urb(entry_priv->urb, GFP_ATOMIC)) { | 257 | status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); |
258 | if (status) { | ||
259 | if (status == -ENODEV) | ||
260 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||
255 | set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); | 261 | set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); |
256 | rt2x00lib_dmadone(entry); | 262 | rt2x00lib_dmadone(entry); |
257 | } | 263 | } |
258 | } | 264 | } |
259 | 265 | ||
260 | void rt2x00usb_kick_tx_queue(struct data_queue *queue) | ||
261 | { | ||
262 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, | ||
263 | rt2x00usb_kick_tx_entry); | ||
264 | } | ||
265 | EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue); | ||
266 | |||
267 | static void rt2x00usb_kill_tx_entry(struct queue_entry *entry) | ||
268 | { | ||
269 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
270 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | ||
271 | struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; | ||
272 | |||
273 | if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | ||
274 | return; | ||
275 | |||
276 | usb_kill_urb(entry_priv->urb); | ||
277 | |||
278 | /* | ||
279 | * Kill guardian urb (if required by driver). | ||
280 | */ | ||
281 | if ((entry->queue->qid == QID_BEACON) && | ||
282 | (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))) | ||
283 | usb_kill_urb(bcn_priv->guardian_urb); | ||
284 | } | ||
285 | |||
286 | void rt2x00usb_kill_tx_queue(struct data_queue *queue) | ||
287 | { | ||
288 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, | ||
289 | rt2x00usb_kill_tx_entry); | ||
290 | } | ||
291 | EXPORT_SYMBOL_GPL(rt2x00usb_kill_tx_queue); | ||
292 | |||
293 | static void rt2x00usb_watchdog_tx_dma(struct data_queue *queue) | ||
294 | { | ||
295 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
296 | unsigned short threshold = queue->threshold; | ||
297 | |||
298 | WARNING(queue->rt2x00dev, "TX queue %d DMA timed out," | ||
299 | " invoke forced forced reset", queue->qid); | ||
300 | |||
301 | /* | ||
302 | * Temporarily disable the TX queue, this will force mac80211 | ||
303 | * to use the other queues until this queue has been restored. | ||
304 | * | ||
305 | * Set the queue threshold to the queue limit. This prevents the | ||
306 | * queue from being enabled during the txdone handler. | ||
307 | */ | ||
308 | queue->threshold = queue->limit; | ||
309 | ieee80211_stop_queue(rt2x00dev->hw, queue->qid); | ||
310 | |||
311 | /* | ||
312 | * Kill all entries in the queue, afterwards we need to | ||
313 | * wait a bit for all URBs to be cancelled. | ||
314 | */ | ||
315 | rt2x00usb_kill_tx_queue(queue); | ||
316 | |||
317 | /* | ||
318 | * In case that a driver has overriden the txdone_work | ||
319 | * function, we invoke the TX done through there. | ||
320 | */ | ||
321 | rt2x00dev->txdone_work.func(&rt2x00dev->txdone_work); | ||
322 | |||
323 | /* | ||
324 | * The queue has been reset, and mac80211 is allowed to use the | ||
325 | * queue again. | ||
326 | */ | ||
327 | queue->threshold = threshold; | ||
328 | ieee80211_wake_queue(rt2x00dev->hw, queue->qid); | ||
329 | } | ||
330 | |||
331 | static void rt2x00usb_watchdog_tx_status(struct data_queue *queue) | ||
332 | { | ||
333 | WARNING(queue->rt2x00dev, "TX queue %d status timed out," | ||
334 | " invoke forced tx handler", queue->qid); | ||
335 | |||
336 | ieee80211_queue_work(queue->rt2x00dev->hw, &queue->rt2x00dev->txdone_work); | ||
337 | } | ||
338 | |||
339 | void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) | ||
340 | { | ||
341 | struct data_queue *queue; | ||
342 | |||
343 | tx_queue_for_each(rt2x00dev, queue) { | ||
344 | if (!rt2x00queue_empty(queue)) { | ||
345 | if (rt2x00queue_dma_timeout(queue)) | ||
346 | rt2x00usb_watchdog_tx_dma(queue); | ||
347 | if (rt2x00queue_status_timeout(queue)) | ||
348 | rt2x00usb_watchdog_tx_status(queue); | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | EXPORT_SYMBOL_GPL(rt2x00usb_watchdog); | ||
353 | |||
354 | /* | 266 | /* |
355 | * RX data handlers. | 267 | * RX data handlers. |
356 | */ | 268 | */ |
@@ -365,7 +277,8 @@ static void rt2x00usb_work_rxdone(struct work_struct *work) | |||
365 | while (!rt2x00queue_empty(rt2x00dev->rx)) { | 277 | while (!rt2x00queue_empty(rt2x00dev->rx)) { |
366 | entry = rt2x00queue_get_entry(rt2x00dev->rx, Q_INDEX_DONE); | 278 | entry = rt2x00queue_get_entry(rt2x00dev->rx, Q_INDEX_DONE); |
367 | 279 | ||
368 | if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | 280 | if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || |
281 | !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) | ||
369 | break; | 282 | break; |
370 | 283 | ||
371 | /* | 284 | /* |
@@ -410,6 +323,154 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
410 | ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->rxdone_work); | 323 | ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->rxdone_work); |
411 | } | 324 | } |
412 | 325 | ||
326 | static void rt2x00usb_kick_rx_entry(struct queue_entry *entry) | ||
327 | { | ||
328 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
329 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | ||
330 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | ||
331 | int status; | ||
332 | |||
333 | if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || | ||
334 | test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) | ||
335 | return; | ||
336 | |||
337 | rt2x00lib_dmastart(entry); | ||
338 | |||
339 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, | ||
340 | usb_rcvbulkpipe(usb_dev, entry->queue->usb_endpoint), | ||
341 | entry->skb->data, entry->skb->len, | ||
342 | rt2x00usb_interrupt_rxdone, entry); | ||
343 | |||
344 | status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); | ||
345 | if (status) { | ||
346 | if (status == -ENODEV) | ||
347 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||
348 | set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); | ||
349 | rt2x00lib_dmadone(entry); | ||
350 | } | ||
351 | } | ||
352 | |||
353 | void rt2x00usb_kick_queue(struct data_queue *queue) | ||
354 | { | ||
355 | switch (queue->qid) { | ||
356 | case QID_AC_VO: | ||
357 | case QID_AC_VI: | ||
358 | case QID_AC_BE: | ||
359 | case QID_AC_BK: | ||
360 | if (!rt2x00queue_empty(queue)) | ||
361 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, | ||
362 | rt2x00usb_kick_tx_entry); | ||
363 | break; | ||
364 | case QID_RX: | ||
365 | if (!rt2x00queue_full(queue)) | ||
366 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, | ||
367 | rt2x00usb_kick_rx_entry); | ||
368 | break; | ||
369 | default: | ||
370 | break; | ||
371 | } | ||
372 | } | ||
373 | EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue); | ||
374 | |||
375 | static void rt2x00usb_flush_entry(struct queue_entry *entry) | ||
376 | { | ||
377 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
378 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | ||
379 | struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; | ||
380 | |||
381 | if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | ||
382 | return; | ||
383 | |||
384 | usb_kill_urb(entry_priv->urb); | ||
385 | |||
386 | /* | ||
387 | * Kill guardian urb (if required by driver). | ||
388 | */ | ||
389 | if ((entry->queue->qid == QID_BEACON) && | ||
390 | (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))) | ||
391 | usb_kill_urb(bcn_priv->guardian_urb); | ||
392 | } | ||
393 | |||
394 | void rt2x00usb_flush_queue(struct data_queue *queue) | ||
395 | { | ||
396 | struct work_struct *completion; | ||
397 | unsigned int i; | ||
398 | |||
399 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, | ||
400 | rt2x00usb_flush_entry); | ||
401 | |||
402 | /* | ||
403 | * Obtain the queue completion handler | ||
404 | */ | ||
405 | switch (queue->qid) { | ||
406 | case QID_AC_VO: | ||
407 | case QID_AC_VI: | ||
408 | case QID_AC_BE: | ||
409 | case QID_AC_BK: | ||
410 | completion = &queue->rt2x00dev->txdone_work; | ||
411 | break; | ||
412 | case QID_RX: | ||
413 | completion = &queue->rt2x00dev->rxdone_work; | ||
414 | break; | ||
415 | default: | ||
416 | return; | ||
417 | } | ||
418 | |||
419 | for (i = 0; i < 20; i++) { | ||
420 | /* | ||
421 | * Check if the driver is already done, otherwise we | ||
422 | * have to sleep a little while to give the driver/hw | ||
423 | * the oppurtunity to complete interrupt process itself. | ||
424 | */ | ||
425 | if (rt2x00queue_empty(queue)) | ||
426 | break; | ||
427 | |||
428 | /* | ||
429 | * Schedule the completion handler manually, when this | ||
430 | * worker function runs, it should cleanup the queue. | ||
431 | */ | ||
432 | ieee80211_queue_work(queue->rt2x00dev->hw, completion); | ||
433 | |||
434 | /* | ||
435 | * Wait for a little while to give the driver | ||
436 | * the oppurtunity to recover itself. | ||
437 | */ | ||
438 | msleep(10); | ||
439 | } | ||
440 | } | ||
441 | EXPORT_SYMBOL_GPL(rt2x00usb_flush_queue); | ||
442 | |||
443 | static void rt2x00usb_watchdog_tx_dma(struct data_queue *queue) | ||
444 | { | ||
445 | WARNING(queue->rt2x00dev, "TX queue %d DMA timed out," | ||
446 | " invoke forced forced reset\n", queue->qid); | ||
447 | |||
448 | rt2x00queue_flush_queue(queue, true); | ||
449 | } | ||
450 | |||
451 | static void rt2x00usb_watchdog_tx_status(struct data_queue *queue) | ||
452 | { | ||
453 | WARNING(queue->rt2x00dev, "TX queue %d status timed out," | ||
454 | " invoke forced tx handler\n", queue->qid); | ||
455 | |||
456 | ieee80211_queue_work(queue->rt2x00dev->hw, &queue->rt2x00dev->txdone_work); | ||
457 | } | ||
458 | |||
459 | void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) | ||
460 | { | ||
461 | struct data_queue *queue; | ||
462 | |||
463 | tx_queue_for_each(rt2x00dev, queue) { | ||
464 | if (!rt2x00queue_empty(queue)) { | ||
465 | if (rt2x00queue_dma_timeout(queue)) | ||
466 | rt2x00usb_watchdog_tx_dma(queue); | ||
467 | if (rt2x00queue_status_timeout(queue)) | ||
468 | rt2x00usb_watchdog_tx_status(queue); | ||
469 | } | ||
470 | } | ||
471 | } | ||
472 | EXPORT_SYMBOL_GPL(rt2x00usb_watchdog); | ||
473 | |||
413 | /* | 474 | /* |
414 | * Radio handlers | 475 | * Radio handlers |
415 | */ | 476 | */ |
@@ -417,12 +478,6 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
417 | { | 478 | { |
418 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0, | 479 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0, |
419 | REGISTER_TIMEOUT); | 480 | REGISTER_TIMEOUT); |
420 | |||
421 | /* | ||
422 | * The USB version of kill_tx_queue also works | ||
423 | * on the RX queue. | ||
424 | */ | ||
425 | rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev->rx); | ||
426 | } | 481 | } |
427 | EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); | 482 | EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); |
428 | 483 | ||
@@ -431,25 +486,10 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); | |||
431 | */ | 486 | */ |
432 | void rt2x00usb_clear_entry(struct queue_entry *entry) | 487 | void rt2x00usb_clear_entry(struct queue_entry *entry) |
433 | { | 488 | { |
434 | struct usb_device *usb_dev = | ||
435 | to_usb_device_intf(entry->queue->rt2x00dev->dev); | ||
436 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | ||
437 | int pipe; | ||
438 | |||
439 | entry->flags = 0; | 489 | entry->flags = 0; |
440 | 490 | ||
441 | if (entry->queue->qid == QID_RX) { | 491 | if (entry->queue->qid == QID_RX) |
442 | pipe = usb_rcvbulkpipe(usb_dev, entry->queue->usb_endpoint); | 492 | rt2x00usb_kick_rx_entry(entry); |
443 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, pipe, | ||
444 | entry->skb->data, entry->skb->len, | ||
445 | rt2x00usb_interrupt_rxdone, entry); | ||
446 | |||
447 | set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | ||
448 | if (usb_submit_urb(entry_priv->urb, GFP_ATOMIC)) { | ||
449 | set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); | ||
450 | rt2x00lib_dmadone(entry); | ||
451 | } | ||
452 | } | ||
453 | } | 493 | } |
454 | EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry); | 494 | EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry); |
455 | 495 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index c2d997f67b3e..6aaf51fc7ad8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -378,22 +378,22 @@ struct queue_entry_priv_usb_bcn { | |||
378 | }; | 378 | }; |
379 | 379 | ||
380 | /** | 380 | /** |
381 | * rt2x00usb_kick_tx_queue - Kick data queue | 381 | * rt2x00usb_kick_queue - Kick data queue |
382 | * @queue: Data queue to kick | 382 | * @queue: Data queue to kick |
383 | * | 383 | * |
384 | * This will walk through all entries of the queue and push all pending | 384 | * This will walk through all entries of the queue and push all pending |
385 | * frames to the hardware as a single burst. | 385 | * frames to the hardware as a single burst. |
386 | */ | 386 | */ |
387 | void rt2x00usb_kick_tx_queue(struct data_queue *queue); | 387 | void rt2x00usb_kick_queue(struct data_queue *queue); |
388 | 388 | ||
389 | /** | 389 | /** |
390 | * rt2x00usb_kill_tx_queue - Kill data queue | 390 | * rt2x00usb_flush_queue - Flush data queue |
391 | * @queue: Data queue to kill | 391 | * @queue: Data queue to stop |
392 | * | 392 | * |
393 | * This will walk through all entries of the queue and kill all | 393 | * This will walk through all entries of the queue and kill all |
394 | * previously kicked frames before they can be send. | 394 | * URB's which were send to the device. |
395 | */ | 395 | */ |
396 | void rt2x00usb_kill_tx_queue(struct data_queue *queue); | 396 | void rt2x00usb_flush_queue(struct data_queue *queue); |
397 | 397 | ||
398 | /** | 398 | /** |
399 | * rt2x00usb_watchdog - Watchdog for USB communication | 399 | * rt2x00usb_watchdog - Watchdog for USB communication |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 6b09b01f634f..8de44dd401e0 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1140,6 +1140,106 @@ dynamic_cca_tune: | |||
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | /* | 1142 | /* |
1143 | * Queue handlers. | ||
1144 | */ | ||
1145 | static void rt61pci_start_queue(struct data_queue *queue) | ||
1146 | { | ||
1147 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1148 | u32 reg; | ||
1149 | |||
1150 | switch (queue->qid) { | ||
1151 | case QID_RX: | ||
1152 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); | ||
1153 | rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); | ||
1154 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); | ||
1155 | break; | ||
1156 | case QID_BEACON: | ||
1157 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1158 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1159 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1160 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1161 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1162 | break; | ||
1163 | default: | ||
1164 | break; | ||
1165 | } | ||
1166 | } | ||
1167 | |||
1168 | static void rt61pci_kick_queue(struct data_queue *queue) | ||
1169 | { | ||
1170 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1171 | u32 reg; | ||
1172 | |||
1173 | switch (queue->qid) { | ||
1174 | case QID_AC_VO: | ||
1175 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1176 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, 1); | ||
1177 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1178 | break; | ||
1179 | case QID_AC_VI: | ||
1180 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1181 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, 1); | ||
1182 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1183 | break; | ||
1184 | case QID_AC_BE: | ||
1185 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1186 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC2, 1); | ||
1187 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1188 | break; | ||
1189 | case QID_AC_BK: | ||
1190 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1191 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC3, 1); | ||
1192 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1193 | break; | ||
1194 | default: | ||
1195 | break; | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | static void rt61pci_stop_queue(struct data_queue *queue) | ||
1200 | { | ||
1201 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1202 | u32 reg; | ||
1203 | |||
1204 | switch (queue->qid) { | ||
1205 | case QID_AC_VO: | ||
1206 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1207 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC0, 1); | ||
1208 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1209 | break; | ||
1210 | case QID_AC_VI: | ||
1211 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1212 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC1, 1); | ||
1213 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1214 | break; | ||
1215 | case QID_AC_BE: | ||
1216 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1217 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC2, 1); | ||
1218 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1219 | break; | ||
1220 | case QID_AC_BK: | ||
1221 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1222 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC3, 1); | ||
1223 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1224 | break; | ||
1225 | case QID_RX: | ||
1226 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); | ||
1227 | rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 1); | ||
1228 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); | ||
1229 | break; | ||
1230 | case QID_BEACON: | ||
1231 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1232 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); | ||
1233 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); | ||
1234 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); | ||
1235 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1236 | break; | ||
1237 | default: | ||
1238 | break; | ||
1239 | } | ||
1240 | } | ||
1241 | |||
1242 | /* | ||
1143 | * Firmware functions | 1243 | * Firmware functions |
1144 | */ | 1244 | */ |
1145 | static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 1245 | static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
@@ -1616,17 +1716,6 @@ static int rt61pci_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
1616 | /* | 1716 | /* |
1617 | * Device state switch handlers. | 1717 | * Device state switch handlers. |
1618 | */ | 1718 | */ |
1619 | static void rt61pci_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
1620 | enum dev_state state) | ||
1621 | { | ||
1622 | u32 reg; | ||
1623 | |||
1624 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); | ||
1625 | rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, | ||
1626 | (state == STATE_RADIO_RX_OFF)); | ||
1627 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); | ||
1628 | } | ||
1629 | |||
1630 | static void rt61pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | 1719 | static void rt61pci_toggle_irq(struct rt2x00_dev *rt2x00dev, |
1631 | enum dev_state state) | 1720 | enum dev_state state) |
1632 | { | 1721 | { |
@@ -1743,10 +1832,6 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1743 | case STATE_RADIO_OFF: | 1832 | case STATE_RADIO_OFF: |
1744 | rt61pci_disable_radio(rt2x00dev); | 1833 | rt61pci_disable_radio(rt2x00dev); |
1745 | break; | 1834 | break; |
1746 | case STATE_RADIO_RX_ON: | ||
1747 | case STATE_RADIO_RX_OFF: | ||
1748 | rt61pci_toggle_rx(rt2x00dev, state); | ||
1749 | break; | ||
1750 | case STATE_RADIO_IRQ_ON: | 1835 | case STATE_RADIO_IRQ_ON: |
1751 | case STATE_RADIO_IRQ_ON_ISR: | 1836 | case STATE_RADIO_IRQ_ON_ISR: |
1752 | case STATE_RADIO_IRQ_OFF: | 1837 | case STATE_RADIO_IRQ_OFF: |
@@ -1876,6 +1961,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1876 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1961 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1877 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 1962 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1878 | unsigned int beacon_base; | 1963 | unsigned int beacon_base; |
1964 | unsigned int padding_len; | ||
1879 | u32 reg; | 1965 | u32 reg; |
1880 | 1966 | ||
1881 | /* | 1967 | /* |
@@ -1897,13 +1983,16 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1897 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); | 1983 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); |
1898 | 1984 | ||
1899 | /* | 1985 | /* |
1900 | * Write entire beacon with descriptor to register. | 1986 | * Write entire beacon with descriptor and padding to register. |
1901 | */ | 1987 | */ |
1988 | padding_len = roundup(entry->skb->len, 4) - entry->skb->len; | ||
1989 | skb_pad(entry->skb, padding_len); | ||
1902 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1990 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
1903 | rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, | 1991 | rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, |
1904 | entry_priv->desc, TXINFO_SIZE); | 1992 | entry_priv->desc, TXINFO_SIZE); |
1905 | rt2x00pci_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE, | 1993 | rt2x00pci_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE, |
1906 | entry->skb->data, entry->skb->len); | 1994 | entry->skb->data, |
1995 | entry->skb->len + padding_len); | ||
1907 | 1996 | ||
1908 | /* | 1997 | /* |
1909 | * Enable beaconing again. | 1998 | * Enable beaconing again. |
@@ -1925,37 +2014,6 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1925 | entry->skb = NULL; | 2014 | entry->skb = NULL; |
1926 | } | 2015 | } |
1927 | 2016 | ||
1928 | static void rt61pci_kick_tx_queue(struct data_queue *queue) | ||
1929 | { | ||
1930 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1931 | u32 reg; | ||
1932 | |||
1933 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1934 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue->qid == QID_AC_BE)); | ||
1935 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue->qid == QID_AC_BK)); | ||
1936 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC2, (queue->qid == QID_AC_VI)); | ||
1937 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC3, (queue->qid == QID_AC_VO)); | ||
1938 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1939 | } | ||
1940 | |||
1941 | static void rt61pci_kill_tx_queue(struct data_queue *queue) | ||
1942 | { | ||
1943 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1944 | u32 reg; | ||
1945 | |||
1946 | if (queue->qid == QID_BEACON) { | ||
1947 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0); | ||
1948 | return; | ||
1949 | } | ||
1950 | |||
1951 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | ||
1952 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC0, (queue->qid == QID_AC_BE)); | ||
1953 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC1, (queue->qid == QID_AC_BK)); | ||
1954 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC2, (queue->qid == QID_AC_VI)); | ||
1955 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC3, (queue->qid == QID_AC_VO)); | ||
1956 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | ||
1957 | } | ||
1958 | |||
1959 | /* | 2017 | /* |
1960 | * RX control handlers | 2018 | * RX control handlers |
1961 | */ | 2019 | */ |
@@ -2840,10 +2898,11 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { | |||
2840 | .link_stats = rt61pci_link_stats, | 2898 | .link_stats = rt61pci_link_stats, |
2841 | .reset_tuner = rt61pci_reset_tuner, | 2899 | .reset_tuner = rt61pci_reset_tuner, |
2842 | .link_tuner = rt61pci_link_tuner, | 2900 | .link_tuner = rt61pci_link_tuner, |
2901 | .start_queue = rt61pci_start_queue, | ||
2902 | .kick_queue = rt61pci_kick_queue, | ||
2903 | .stop_queue = rt61pci_stop_queue, | ||
2843 | .write_tx_desc = rt61pci_write_tx_desc, | 2904 | .write_tx_desc = rt61pci_write_tx_desc, |
2844 | .write_beacon = rt61pci_write_beacon, | 2905 | .write_beacon = rt61pci_write_beacon, |
2845 | .kick_tx_queue = rt61pci_kick_tx_queue, | ||
2846 | .kill_tx_queue = rt61pci_kill_tx_queue, | ||
2847 | .fill_rxdone = rt61pci_fill_rxdone, | 2906 | .fill_rxdone = rt61pci_fill_rxdone, |
2848 | .config_shared_key = rt61pci_config_shared_key, | 2907 | .config_shared_key = rt61pci_config_shared_key, |
2849 | .config_pairwise_key = rt61pci_config_pairwise_key, | 2908 | .config_pairwise_key = rt61pci_config_pairwise_key, |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h index afc803b7959f..e3cd6db76b0e 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.h +++ b/drivers/net/wireless/rt2x00/rt61pci.h | |||
@@ -784,25 +784,25 @@ struct hw_pairwise_ta_entry { | |||
784 | */ | 784 | */ |
785 | 785 | ||
786 | /* | 786 | /* |
787 | * AC0_BASE_CSR: AC_BK base address. | 787 | * AC0_BASE_CSR: AC_VO base address. |
788 | */ | 788 | */ |
789 | #define AC0_BASE_CSR 0x3400 | 789 | #define AC0_BASE_CSR 0x3400 |
790 | #define AC0_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) | 790 | #define AC0_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) |
791 | 791 | ||
792 | /* | 792 | /* |
793 | * AC1_BASE_CSR: AC_BE base address. | 793 | * AC1_BASE_CSR: AC_VI base address. |
794 | */ | 794 | */ |
795 | #define AC1_BASE_CSR 0x3404 | 795 | #define AC1_BASE_CSR 0x3404 |
796 | #define AC1_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) | 796 | #define AC1_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) |
797 | 797 | ||
798 | /* | 798 | /* |
799 | * AC2_BASE_CSR: AC_VI base address. | 799 | * AC2_BASE_CSR: AC_BE base address. |
800 | */ | 800 | */ |
801 | #define AC2_BASE_CSR 0x3408 | 801 | #define AC2_BASE_CSR 0x3408 |
802 | #define AC2_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) | 802 | #define AC2_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) |
803 | 803 | ||
804 | /* | 804 | /* |
805 | * AC3_BASE_CSR: AC_VO base address. | 805 | * AC3_BASE_CSR: AC_BK base address. |
806 | */ | 806 | */ |
807 | #define AC3_BASE_CSR 0x340c | 807 | #define AC3_BASE_CSR 0x340c |
808 | #define AC3_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) | 808 | #define AC3_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) |
@@ -814,7 +814,7 @@ struct hw_pairwise_ta_entry { | |||
814 | #define MGMT_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) | 814 | #define MGMT_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) |
815 | 815 | ||
816 | /* | 816 | /* |
817 | * TX_RING_CSR0: TX Ring size for AC_BK, AC_BE, AC_VI, AC_VO. | 817 | * TX_RING_CSR0: TX Ring size for AC_VO, AC_VI, AC_BE, AC_BK. |
818 | */ | 818 | */ |
819 | #define TX_RING_CSR0 0x3418 | 819 | #define TX_RING_CSR0 0x3418 |
820 | #define TX_RING_CSR0_AC0_RING_SIZE FIELD32(0x000000ff) | 820 | #define TX_RING_CSR0_AC0_RING_SIZE FIELD32(0x000000ff) |
@@ -833,10 +833,10 @@ struct hw_pairwise_ta_entry { | |||
833 | 833 | ||
834 | /* | 834 | /* |
835 | * AIFSN_CSR: AIFSN for each EDCA AC. | 835 | * AIFSN_CSR: AIFSN for each EDCA AC. |
836 | * AIFSN0: For AC_BK. | 836 | * AIFSN0: For AC_VO. |
837 | * AIFSN1: For AC_BE. | 837 | * AIFSN1: For AC_VI. |
838 | * AIFSN2: For AC_VI. | 838 | * AIFSN2: For AC_BE. |
839 | * AIFSN3: For AC_VO. | 839 | * AIFSN3: For AC_BK. |
840 | */ | 840 | */ |
841 | #define AIFSN_CSR 0x3420 | 841 | #define AIFSN_CSR 0x3420 |
842 | #define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) | 842 | #define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) |
@@ -846,10 +846,10 @@ struct hw_pairwise_ta_entry { | |||
846 | 846 | ||
847 | /* | 847 | /* |
848 | * CWMIN_CSR: CWmin for each EDCA AC. | 848 | * CWMIN_CSR: CWmin for each EDCA AC. |
849 | * CWMIN0: For AC_BK. | 849 | * CWMIN0: For AC_VO. |
850 | * CWMIN1: For AC_BE. | 850 | * CWMIN1: For AC_VI. |
851 | * CWMIN2: For AC_VI. | 851 | * CWMIN2: For AC_BE. |
852 | * CWMIN3: For AC_VO. | 852 | * CWMIN3: For AC_BK. |
853 | */ | 853 | */ |
854 | #define CWMIN_CSR 0x3424 | 854 | #define CWMIN_CSR 0x3424 |
855 | #define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) | 855 | #define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) |
@@ -859,10 +859,10 @@ struct hw_pairwise_ta_entry { | |||
859 | 859 | ||
860 | /* | 860 | /* |
861 | * CWMAX_CSR: CWmax for each EDCA AC. | 861 | * CWMAX_CSR: CWmax for each EDCA AC. |
862 | * CWMAX0: For AC_BK. | 862 | * CWMAX0: For AC_VO. |
863 | * CWMAX1: For AC_BE. | 863 | * CWMAX1: For AC_VI. |
864 | * CWMAX2: For AC_VI. | 864 | * CWMAX2: For AC_BE. |
865 | * CWMAX3: For AC_VO. | 865 | * CWMAX3: For AC_BK. |
866 | */ | 866 | */ |
867 | #define CWMAX_CSR 0x3428 | 867 | #define CWMAX_CSR 0x3428 |
868 | #define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) | 868 | #define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) |
@@ -883,14 +883,14 @@ struct hw_pairwise_ta_entry { | |||
883 | 883 | ||
884 | /* | 884 | /* |
885 | * TX_CNTL_CSR: KICK/Abort TX. | 885 | * TX_CNTL_CSR: KICK/Abort TX. |
886 | * KICK_TX_AC0: For AC_BK. | 886 | * KICK_TX_AC0: For AC_VO. |
887 | * KICK_TX_AC1: For AC_BE. | 887 | * KICK_TX_AC1: For AC_VI. |
888 | * KICK_TX_AC2: For AC_VI. | 888 | * KICK_TX_AC2: For AC_BE. |
889 | * KICK_TX_AC3: For AC_VO. | 889 | * KICK_TX_AC3: For AC_BK. |
890 | * ABORT_TX_AC0: For AC_BK. | 890 | * ABORT_TX_AC0: For AC_VO. |
891 | * ABORT_TX_AC1: For AC_BE. | 891 | * ABORT_TX_AC1: For AC_VI. |
892 | * ABORT_TX_AC2: For AC_VI. | 892 | * ABORT_TX_AC2: For AC_BE. |
893 | * ABORT_TX_AC3: For AC_VO. | 893 | * ABORT_TX_AC3: For AC_BK. |
894 | */ | 894 | */ |
895 | #define TX_CNTL_CSR 0x3430 | 895 | #define TX_CNTL_CSR 0x3430 |
896 | #define TX_CNTL_CSR_KICK_TX_AC0 FIELD32(0x00000001) | 896 | #define TX_CNTL_CSR_KICK_TX_AC0 FIELD32(0x00000001) |
@@ -1010,18 +1010,18 @@ struct hw_pairwise_ta_entry { | |||
1010 | #define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040) | 1010 | #define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040) |
1011 | 1011 | ||
1012 | /* | 1012 | /* |
1013 | * AC_TXOP_CSR0: AC_BK/AC_BE TXOP register. | 1013 | * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register. |
1014 | * AC0_TX_OP: For AC_BK, in unit of 32us. | 1014 | * AC0_TX_OP: For AC_VO, in unit of 32us. |
1015 | * AC1_TX_OP: For AC_BE, in unit of 32us. | 1015 | * AC1_TX_OP: For AC_VI, in unit of 32us. |
1016 | */ | 1016 | */ |
1017 | #define AC_TXOP_CSR0 0x3474 | 1017 | #define AC_TXOP_CSR0 0x3474 |
1018 | #define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) | 1018 | #define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) |
1019 | #define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) | 1019 | #define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) |
1020 | 1020 | ||
1021 | /* | 1021 | /* |
1022 | * AC_TXOP_CSR1: AC_VO/AC_VI TXOP register. | 1022 | * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register. |
1023 | * AC2_TX_OP: For AC_VI, in unit of 32us. | 1023 | * AC2_TX_OP: For AC_BE, in unit of 32us. |
1024 | * AC3_TX_OP: For AC_VO, in unit of 32us. | 1024 | * AC3_TX_OP: For AC_BK, in unit of 32us. |
1025 | */ | 1025 | */ |
1026 | #define AC_TXOP_CSR1 0x3478 | 1026 | #define AC_TXOP_CSR1 0x3478 |
1027 | #define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) | 1027 | #define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 6f04552f5819..0b4e8590cbb7 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1031,6 +1031,55 @@ dynamic_cca_tune: | |||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | /* | 1033 | /* |
1034 | * Queue handlers. | ||
1035 | */ | ||
1036 | static void rt73usb_start_queue(struct data_queue *queue) | ||
1037 | { | ||
1038 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1039 | u32 reg; | ||
1040 | |||
1041 | switch (queue->qid) { | ||
1042 | case QID_RX: | ||
1043 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); | ||
1044 | rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); | ||
1045 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); | ||
1046 | break; | ||
1047 | case QID_BEACON: | ||
1048 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1049 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1050 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1051 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1052 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1053 | break; | ||
1054 | default: | ||
1055 | break; | ||
1056 | } | ||
1057 | } | ||
1058 | |||
1059 | static void rt73usb_stop_queue(struct data_queue *queue) | ||
1060 | { | ||
1061 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1062 | u32 reg; | ||
1063 | |||
1064 | switch (queue->qid) { | ||
1065 | case QID_RX: | ||
1066 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); | ||
1067 | rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 1); | ||
1068 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); | ||
1069 | break; | ||
1070 | case QID_BEACON: | ||
1071 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1072 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); | ||
1073 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); | ||
1074 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); | ||
1075 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1076 | break; | ||
1077 | default: | ||
1078 | break; | ||
1079 | } | ||
1080 | } | ||
1081 | |||
1082 | /* | ||
1034 | * Firmware functions | 1083 | * Firmware functions |
1035 | */ | 1084 | */ |
1036 | static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 1085 | static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
@@ -1324,17 +1373,6 @@ static int rt73usb_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
1324 | /* | 1373 | /* |
1325 | * Device state switch handlers. | 1374 | * Device state switch handlers. |
1326 | */ | 1375 | */ |
1327 | static void rt73usb_toggle_rx(struct rt2x00_dev *rt2x00dev, | ||
1328 | enum dev_state state) | ||
1329 | { | ||
1330 | u32 reg; | ||
1331 | |||
1332 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); | ||
1333 | rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, | ||
1334 | (state == STATE_RADIO_RX_OFF)); | ||
1335 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); | ||
1336 | } | ||
1337 | |||
1338 | static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev) | 1376 | static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev) |
1339 | { | 1377 | { |
1340 | /* | 1378 | /* |
@@ -1401,10 +1439,6 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1401 | case STATE_RADIO_OFF: | 1439 | case STATE_RADIO_OFF: |
1402 | rt73usb_disable_radio(rt2x00dev); | 1440 | rt73usb_disable_radio(rt2x00dev); |
1403 | break; | 1441 | break; |
1404 | case STATE_RADIO_RX_ON: | ||
1405 | case STATE_RADIO_RX_OFF: | ||
1406 | rt73usb_toggle_rx(rt2x00dev, state); | ||
1407 | break; | ||
1408 | case STATE_RADIO_IRQ_ON: | 1442 | case STATE_RADIO_IRQ_ON: |
1409 | case STATE_RADIO_IRQ_ON_ISR: | 1443 | case STATE_RADIO_IRQ_ON_ISR: |
1410 | case STATE_RADIO_IRQ_OFF: | 1444 | case STATE_RADIO_IRQ_OFF: |
@@ -1512,6 +1546,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry, | |||
1512 | { | 1546 | { |
1513 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1547 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1514 | unsigned int beacon_base; | 1548 | unsigned int beacon_base; |
1549 | unsigned int padding_len; | ||
1515 | u32 reg; | 1550 | u32 reg; |
1516 | 1551 | ||
1517 | /* | 1552 | /* |
@@ -1539,11 +1574,13 @@ static void rt73usb_write_beacon(struct queue_entry *entry, | |||
1539 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); | 1574 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); |
1540 | 1575 | ||
1541 | /* | 1576 | /* |
1542 | * Write entire beacon with descriptor to register. | 1577 | * Write entire beacon with descriptor and padding to register. |
1543 | */ | 1578 | */ |
1579 | padding_len = roundup(entry->skb->len, 4) - entry->skb->len; | ||
1580 | skb_pad(entry->skb, padding_len); | ||
1544 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 1581 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
1545 | rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, | 1582 | rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, |
1546 | entry->skb->data, entry->skb->len); | 1583 | entry->skb->len + padding_len); |
1547 | 1584 | ||
1548 | /* | 1585 | /* |
1549 | * Enable beaconing again. | 1586 | * Enable beaconing again. |
@@ -1579,14 +1616,6 @@ static int rt73usb_get_tx_data_len(struct queue_entry *entry) | |||
1579 | return length; | 1616 | return length; |
1580 | } | 1617 | } |
1581 | 1618 | ||
1582 | static void rt73usb_kill_tx_queue(struct data_queue *queue) | ||
1583 | { | ||
1584 | if (queue->qid == QID_BEACON) | ||
1585 | rt2x00usb_register_write(queue->rt2x00dev, TXRX_CSR9, 0); | ||
1586 | |||
1587 | rt2x00usb_kill_tx_queue(queue); | ||
1588 | } | ||
1589 | |||
1590 | /* | 1619 | /* |
1591 | * RX control handlers | 1620 | * RX control handlers |
1592 | */ | 1621 | */ |
@@ -2278,11 +2307,13 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2278 | .reset_tuner = rt73usb_reset_tuner, | 2307 | .reset_tuner = rt73usb_reset_tuner, |
2279 | .link_tuner = rt73usb_link_tuner, | 2308 | .link_tuner = rt73usb_link_tuner, |
2280 | .watchdog = rt2x00usb_watchdog, | 2309 | .watchdog = rt2x00usb_watchdog, |
2310 | .start_queue = rt73usb_start_queue, | ||
2311 | .kick_queue = rt2x00usb_kick_queue, | ||
2312 | .stop_queue = rt73usb_stop_queue, | ||
2313 | .flush_queue = rt2x00usb_flush_queue, | ||
2281 | .write_tx_desc = rt73usb_write_tx_desc, | 2314 | .write_tx_desc = rt73usb_write_tx_desc, |
2282 | .write_beacon = rt73usb_write_beacon, | 2315 | .write_beacon = rt73usb_write_beacon, |
2283 | .get_tx_data_len = rt73usb_get_tx_data_len, | 2316 | .get_tx_data_len = rt73usb_get_tx_data_len, |
2284 | .kick_tx_queue = rt2x00usb_kick_tx_queue, | ||
2285 | .kill_tx_queue = rt73usb_kill_tx_queue, | ||
2286 | .fill_rxdone = rt73usb_fill_rxdone, | 2317 | .fill_rxdone = rt73usb_fill_rxdone, |
2287 | .config_shared_key = rt73usb_config_shared_key, | 2318 | .config_shared_key = rt73usb_config_shared_key, |
2288 | .config_pairwise_key = rt73usb_config_pairwise_key, | 2319 | .config_pairwise_key = rt73usb_config_pairwise_key, |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h index 1315ce5c992f..9f6b470414d3 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.h +++ b/drivers/net/wireless/rt2x00/rt73usb.h | |||
@@ -689,10 +689,10 @@ struct hw_pairwise_ta_entry { | |||
689 | 689 | ||
690 | /* | 690 | /* |
691 | * AIFSN_CSR: AIFSN for each EDCA AC. | 691 | * AIFSN_CSR: AIFSN for each EDCA AC. |
692 | * AIFSN0: For AC_BK. | 692 | * AIFSN0: For AC_VO. |
693 | * AIFSN1: For AC_BE. | 693 | * AIFSN1: For AC_VI. |
694 | * AIFSN2: For AC_VI. | 694 | * AIFSN2: For AC_BE. |
695 | * AIFSN3: For AC_VO. | 695 | * AIFSN3: For AC_BK. |
696 | */ | 696 | */ |
697 | #define AIFSN_CSR 0x0400 | 697 | #define AIFSN_CSR 0x0400 |
698 | #define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) | 698 | #define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) |
@@ -702,10 +702,10 @@ struct hw_pairwise_ta_entry { | |||
702 | 702 | ||
703 | /* | 703 | /* |
704 | * CWMIN_CSR: CWmin for each EDCA AC. | 704 | * CWMIN_CSR: CWmin for each EDCA AC. |
705 | * CWMIN0: For AC_BK. | 705 | * CWMIN0: For AC_VO. |
706 | * CWMIN1: For AC_BE. | 706 | * CWMIN1: For AC_VI. |
707 | * CWMIN2: For AC_VI. | 707 | * CWMIN2: For AC_BE. |
708 | * CWMIN3: For AC_VO. | 708 | * CWMIN3: For AC_BK. |
709 | */ | 709 | */ |
710 | #define CWMIN_CSR 0x0404 | 710 | #define CWMIN_CSR 0x0404 |
711 | #define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) | 711 | #define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) |
@@ -715,10 +715,10 @@ struct hw_pairwise_ta_entry { | |||
715 | 715 | ||
716 | /* | 716 | /* |
717 | * CWMAX_CSR: CWmax for each EDCA AC. | 717 | * CWMAX_CSR: CWmax for each EDCA AC. |
718 | * CWMAX0: For AC_BK. | 718 | * CWMAX0: For AC_VO. |
719 | * CWMAX1: For AC_BE. | 719 | * CWMAX1: For AC_VI. |
720 | * CWMAX2: For AC_VI. | 720 | * CWMAX2: For AC_BE. |
721 | * CWMAX3: For AC_VO. | 721 | * CWMAX3: For AC_BK. |
722 | */ | 722 | */ |
723 | #define CWMAX_CSR 0x0408 | 723 | #define CWMAX_CSR 0x0408 |
724 | #define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) | 724 | #define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) |
@@ -727,18 +727,18 @@ struct hw_pairwise_ta_entry { | |||
727 | #define CWMAX_CSR_CWMAX3 FIELD32(0x0000f000) | 727 | #define CWMAX_CSR_CWMAX3 FIELD32(0x0000f000) |
728 | 728 | ||
729 | /* | 729 | /* |
730 | * AC_TXOP_CSR0: AC_BK/AC_BE TXOP register. | 730 | * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register. |
731 | * AC0_TX_OP: For AC_BK, in unit of 32us. | 731 | * AC0_TX_OP: For AC_VO, in unit of 32us. |
732 | * AC1_TX_OP: For AC_BE, in unit of 32us. | 732 | * AC1_TX_OP: For AC_VI, in unit of 32us. |
733 | */ | 733 | */ |
734 | #define AC_TXOP_CSR0 0x040c | 734 | #define AC_TXOP_CSR0 0x040c |
735 | #define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) | 735 | #define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) |
736 | #define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) | 736 | #define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) |
737 | 737 | ||
738 | /* | 738 | /* |
739 | * AC_TXOP_CSR1: AC_VO/AC_VI TXOP register. | 739 | * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register. |
740 | * AC2_TX_OP: For AC_VI, in unit of 32us. | 740 | * AC2_TX_OP: For AC_BE, in unit of 32us. |
741 | * AC3_TX_OP: For AC_VO, in unit of 32us. | 741 | * AC3_TX_OP: For AC_BK, in unit of 32us. |
742 | */ | 742 | */ |
743 | #define AC_TXOP_CSR1 0x0410 | 743 | #define AC_TXOP_CSR1 0x0410 |
744 | #define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) | 744 | #define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) |