diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 132 |
1 files changed, 87 insertions, 45 deletions
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, |