aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorRA-Jay Hung <jay_hung@ralinktech.com>2011-01-10 05:27:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-19 11:36:07 -0500
commit7f6e144fb99a4a70d3c5ad5f074204c5b89a6f65 (patch)
tree61fb1b2a039e669327bc4b3aee55d5b173a27f91 /drivers/net/wireless
parent9d52501b421450ddd9e000c9788ac3be0e44ef1c (diff)
rt2x00: Fix radio off hang issue for PCIE interface
PCI/PCIE radio off behavior is different from SOC/USB. They mainly use MCU command to disable DMA, TX/RX and enter power saving mode. Signed-off-by: RA-Jay Hung <jay_hung@ralinktech.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c36
2 files changed, 10 insertions, 32 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 54917a281398..e2a528da3641 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2810,10 +2810,7 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev)
2810 2810
2811 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); 2811 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
2812 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); 2812 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
2813 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
2814 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); 2813 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
2815 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
2816 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
2817 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); 2814 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
2818 2815
2819 /* Wait for DMA, ignore error */ 2816 /* Wait for DMA, ignore error */
@@ -2823,9 +2820,6 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev)
2823 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_TX, 0); 2820 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_TX, 0);
2824 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0); 2821 rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
2825 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 2822 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
2826
2827 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0);
2828 rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0);
2829} 2823}
2830EXPORT_SYMBOL_GPL(rt2800_disable_radio); 2824EXPORT_SYMBOL_GPL(rt2800_disable_radio);
2831 2825
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index aa97971a38af..bfc2fc5c1c22 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -475,39 +475,23 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
475 475
476static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) 476static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev)
477{ 477{
478 u32 reg; 478 if (rt2x00_is_soc(rt2x00dev)) {
479 479 rt2800_disable_radio(rt2x00dev);
480 rt2800_disable_radio(rt2x00dev); 480 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0);
481 481 rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0);
482 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001280); 482 }
483
484 rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, &reg);
485 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX0, 1);
486 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX1, 1);
487 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX2, 1);
488 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX3, 1);
489 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX4, 1);
490 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX5, 1);
491 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DRX_IDX0, 1);
492 rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
493
494 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f);
495 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
496} 483}
497 484
498static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, 485static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
499 enum dev_state state) 486 enum dev_state state)
500{ 487{
501 /*
502 * Always put the device to sleep (even when we intend to wakeup!)
503 * if the device is booting and wasn't asleep it will return
504 * failure when attempting to wakeup.
505 */
506 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0xff, 2);
507
508 if (state == STATE_AWAKE) { 488 if (state == STATE_AWAKE) {
509 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0); 489 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0x02);
510 rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP); 490 rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP);
491 } else if (state == STATE_SLEEP) {
492 rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, 0xffffffff);
493 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, 0xffffffff);
494 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0x01, 0xff, 0x01);
511 } 495 }
512 496
513 return 0; 497 return 0;