aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2010-12-13 06:34:22 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-13 15:23:35 -0500
commit5450b7e2f0b47e52175b31399d8186a74ef3c46d (patch)
tree4023a3b3cc577d12f1c733a140fce7e965e7eabe /drivers/net/wireless/rt2x00/rt2500pci.c
parent094a1d92fdb18c4455758b1c33e99d647c837ee9 (diff)
rt2x00: Introduce 3 queue commands in drivers (start, kick, stop).
As part of the queue refactoring, we now introduce 3 queue commands: start, kick, stop. - Start: will enable a queue, for TX this will not mean anything, while for beacons and RX this will update the registers to enable the queue. - Kick: This will kick all pending frames to the hardware. This is needed for the TX queue to push all frames to the HW after the queue has been started - Stop: This will stop the queue in the hardware, and cancel any pending work (So this doesn't mean the queue is empty after a stop!). Move all code from the drivers into the appropriate functions, and link those calls to the old rt2x00lib callback functions (we will fix this later when we refactor the queue control inside rt2x00lib). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c131
1 files changed, 87 insertions, 44 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index ce9212f2820..bee7ce14028 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 */
728static 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, &reg);
736 rt2x00_set_field32(&reg, RXCSR0_DISABLE_RX, 0);
737 rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
738 break;
739 case QID_BEACON:
740 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
741 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
742 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
743 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
744 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
745 break;
746 default:
747 break;
748 }
749}
750
751static 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_BE:
758 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
759 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, 1);
760 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
761 break;
762 case QID_AC_BK:
763 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
764 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, 1);
765 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
766 break;
767 case QID_ATIM:
768 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
769 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, 1);
770 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
771 break;
772 default:
773 break;
774 }
775}
776
777static 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_BE:
784 case QID_AC_BK:
785 case QID_ATIM:
786 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
787 rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
788 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
789 break;
790 case QID_RX:
791 rt2x00pci_register_read(rt2x00dev, RXCSR0, &reg);
792 rt2x00_set_field32(&reg, RXCSR0_DISABLE_RX, 1);
793 rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
794 break;
795 case QID_BEACON:
796 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
797 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
798 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
799 rt2x00_set_field32(&reg, 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 */
728static bool rt2500pci_get_entry_state(struct queue_entry *entry) 810static 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 */
1036static void rt2500pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
1037 enum dev_state state)
1038{
1039 u32 reg;
1040
1041 rt2x00pci_register_read(rt2x00dev, RXCSR0, &reg);
1042 rt2x00_set_field32(&reg, RXCSR0_DISABLE_RX,
1043 (state == STATE_RADIO_RX_OFF));
1044 rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
1045}
1046
1047static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, 1118static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
1048 enum dev_state state) 1119 enum dev_state state)
1049{ 1120{
@@ -1143,8 +1214,10 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
1143 rt2500pci_disable_radio(rt2x00dev); 1214 rt2500pci_disable_radio(rt2x00dev);
1144 break; 1215 break;
1145 case STATE_RADIO_RX_ON: 1216 case STATE_RADIO_RX_ON:
1217 rt2500pci_start_queue(rt2x00dev->rx);
1218 break;
1146 case STATE_RADIO_RX_OFF: 1219 case STATE_RADIO_RX_OFF:
1147 rt2500pci_toggle_rx(rt2x00dev, state); 1220 rt2500pci_stop_queue(rt2x00dev->rx);
1148 break; 1221 break;
1149 case STATE_RADIO_IRQ_ON: 1222 case STATE_RADIO_IRQ_ON:
1150 case STATE_RADIO_IRQ_ON_ISR: 1223 case STATE_RADIO_IRQ_ON_ISR:
@@ -1276,36 +1349,6 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,
1276 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 1349 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1277} 1350}
1278 1351
1279static 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, &reg);
1285 rt2x00_set_field32(&reg, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE));
1286 rt2x00_set_field32(&reg, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK));
1287 rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM));
1288 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1289}
1290
1291static 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_read(rt2x00dev, CSR14, &reg);
1298 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
1299 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
1300 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
1301 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1302 } else {
1303 rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
1304 rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
1305 rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
1306 }
1307}
1308
1309/* 1352/*
1310 * RX control handlers 1353 * RX control handlers
1311 */ 1354 */
@@ -1928,8 +1971,8 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
1928 .link_tuner = rt2500pci_link_tuner, 1971 .link_tuner = rt2500pci_link_tuner,
1929 .write_tx_desc = rt2500pci_write_tx_desc, 1972 .write_tx_desc = rt2500pci_write_tx_desc,
1930 .write_beacon = rt2500pci_write_beacon, 1973 .write_beacon = rt2500pci_write_beacon,
1931 .kick_tx_queue = rt2500pci_kick_tx_queue, 1974 .kick_tx_queue = rt2500pci_kick_queue,
1932 .kill_tx_queue = rt2500pci_kill_tx_queue, 1975 .kill_tx_queue = rt2500pci_stop_queue,
1933 .fill_rxdone = rt2500pci_fill_rxdone, 1976 .fill_rxdone = rt2500pci_fill_rxdone,
1934 .config_filter = rt2500pci_config_filter, 1977 .config_filter = rt2500pci_config_filter,
1935 .config_intf = rt2500pci_config_intf, 1978 .config_intf = rt2500pci_config_intf,