mirror of
https://github.com/torvalds/linux.git
synced 2024-12-21 10:31:54 +00:00
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>
This commit is contained in:
parent
9d52501b42
commit
7f6e144fb9
@ -2810,10 +2810,7 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev)
|
||||
|
||||
rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®);
|
||||
rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
|
||||
rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
|
||||
rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
|
||||
rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
|
||||
rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
|
||||
rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
|
||||
|
||||
/* Wait for DMA, ignore error */
|
||||
@ -2823,9 +2820,6 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev)
|
||||
rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 0);
|
||||
rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0);
|
||||
rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
|
||||
|
||||
rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0);
|
||||
rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2800_disable_radio);
|
||||
|
||||
|
@ -475,39 +475,23 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
|
||||
|
||||
static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
rt2800_disable_radio(rt2x00dev);
|
||||
|
||||
rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001280);
|
||||
|
||||
rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, ®);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, 1);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, 1);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, 1);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, 1);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX4, 1);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX5, 1);
|
||||
rt2x00_set_field32(®, WPDMA_RST_IDX_DRX_IDX0, 1);
|
||||
rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
|
||||
|
||||
rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f);
|
||||
rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
|
||||
if (rt2x00_is_soc(rt2x00dev)) {
|
||||
rt2800_disable_radio(rt2x00dev);
|
||||
rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0);
|
||||
rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
|
||||
enum dev_state state)
|
||||
{
|
||||
/*
|
||||
* Always put the device to sleep (even when we intend to wakeup!)
|
||||
* if the device is booting and wasn't asleep it will return
|
||||
* failure when attempting to wakeup.
|
||||
*/
|
||||
rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0xff, 2);
|
||||
|
||||
if (state == STATE_AWAKE) {
|
||||
rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0);
|
||||
rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0x02);
|
||||
rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP);
|
||||
} else if (state == STATE_SLEEP) {
|
||||
rt2800_register_write(rt2x00dev, H2M_MAILBOX_STATUS, 0xffffffff);
|
||||
rt2800_register_write(rt2x00dev, H2M_MAILBOX_CID, 0xffffffff);
|
||||
rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0x01, 0xff, 0x01);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user