aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt73usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c84
1 files changed, 55 insertions, 29 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 3934dad709c6..e9b1e3d5f47c 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1031,6 +1031,57 @@ dynamic_cca_tune:
1031} 1031}
1032 1032
1033/* 1033/*
1034 * Queue handlers.
1035 */
1036static 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, &reg);
1044 rt2x00_set_field32(&reg, 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, &reg);
1049 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
1050 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
1051 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
1052 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1053 break;
1054 default:
1055 break;
1056 }
1057}
1058
1059static 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, &reg);
1067 rt2x00_set_field32(&reg, 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, &reg);
1072 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
1073 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
1074 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
1075 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1076 break;
1077 default:
1078 break;
1079 }
1080
1081 rt2x00usb_stop_queue(queue);
1082}
1083
1084/*
1034 * Firmware functions 1085 * Firmware functions
1035 */ 1086 */
1036static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) 1087static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
@@ -1324,17 +1375,6 @@ static int rt73usb_init_bbp(struct rt2x00_dev *rt2x00dev)
1324/* 1375/*
1325 * Device state switch handlers. 1376 * Device state switch handlers.
1326 */ 1377 */
1327static 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, &reg);
1333 rt2x00_set_field32(&reg, TXRX_CSR0_DISABLE_RX,
1334 (state == STATE_RADIO_RX_OFF));
1335 rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg);
1336}
1337
1338static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev) 1378static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev)
1339{ 1379{
1340 /* 1380 /*
@@ -1402,8 +1442,10 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,
1402 rt73usb_disable_radio(rt2x00dev); 1442 rt73usb_disable_radio(rt2x00dev);
1403 break; 1443 break;
1404 case STATE_RADIO_RX_ON: 1444 case STATE_RADIO_RX_ON:
1445 rt73usb_start_queue(rt2x00dev->rx);
1446 break;
1405 case STATE_RADIO_RX_OFF: 1447 case STATE_RADIO_RX_OFF:
1406 rt73usb_toggle_rx(rt2x00dev, state); 1448 rt73usb_stop_queue(rt2x00dev->rx);
1407 break; 1449 break;
1408 case STATE_RADIO_IRQ_ON: 1450 case STATE_RADIO_IRQ_ON:
1409 case STATE_RADIO_IRQ_ON_ISR: 1451 case STATE_RADIO_IRQ_ON_ISR:
@@ -1579,22 +1621,6 @@ static int rt73usb_get_tx_data_len(struct queue_entry *entry)
1579 return length; 1621 return length;
1580} 1622}
1581 1623
1582static void rt73usb_kill_tx_queue(struct data_queue *queue)
1583{
1584 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
1585 u32 reg;
1586
1587 if (queue->qid == QID_BEACON) {
1588 rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
1589 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
1590 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
1591 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
1592 rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1593 }
1594
1595 rt2x00usb_kill_tx_queue(queue);
1596}
1597
1598/* 1624/*
1599 * RX control handlers 1625 * RX control handlers
1600 */ 1626 */
@@ -2290,7 +2316,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
2290 .write_beacon = rt73usb_write_beacon, 2316 .write_beacon = rt73usb_write_beacon,
2291 .get_tx_data_len = rt73usb_get_tx_data_len, 2317 .get_tx_data_len = rt73usb_get_tx_data_len,
2292 .kick_tx_queue = rt2x00usb_kick_tx_queue, 2318 .kick_tx_queue = rt2x00usb_kick_tx_queue,
2293 .kill_tx_queue = rt73usb_kill_tx_queue, 2319 .kill_tx_queue = rt73usb_stop_queue,
2294 .fill_rxdone = rt73usb_fill_rxdone, 2320 .fill_rxdone = rt73usb_fill_rxdone,
2295 .config_shared_key = rt73usb_config_shared_key, 2321 .config_shared_key = rt73usb_config_shared_key,
2296 .config_pairwise_key = rt73usb_config_pairwise_key, 2322 .config_pairwise_key = rt73usb_config_pairwise_key,