aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c132
1 files changed, 87 insertions, 45 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 */
638static 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, &reg);
646 rt2x00_set_field32(&reg, RXCSR0_DISABLE_RX, 0);
647 rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
648 break;
649 case QID_BEACON:
650 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
651 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
652 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
653 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
654 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
655 break;
656 default:
657 break;
658 }
659}
660
661static 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, &reg);
669 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, 1);
670 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
671 break;
672 case QID_AC_VI:
673 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
674 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, 1);
675 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
676 break;
677 case QID_ATIM:
678 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
679 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, 1);
680 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
681 break;
682 default:
683 break;
684 }
685}
686
687static 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, &reg);
697 rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
698 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
699 break;
700 case QID_RX:
701 rt2x00pci_register_read(rt2x00dev, RXCSR0, &reg);
702 rt2x00_set_field32(&reg, RXCSR0_DISABLE_RX, 1);
703 rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
704 break;
705 case QID_BEACON:
706 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
707 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
708 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
709 rt2x00_set_field32(&reg, 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 */
638static bool rt2400pci_get_entry_state(struct queue_entry *entry) 720static 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 */
881static void rt2400pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
882 enum dev_state state)
883{
884 u32 reg;
885
886 rt2x00pci_register_read(rt2x00dev, RXCSR0, &reg);
887 rt2x00_set_field32(&reg, RXCSR0_DISABLE_RX,
888 (state == STATE_RADIO_RX_OFF));
889 rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
890}
891
892static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, 963static 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
1125static 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, &reg);
1131 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE));
1132 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK));
1133 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM));
1134 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1135}
1136
1137static 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, &reg);
1146 rt2x00_set_field32(&reg, 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,