Commit f7b395e9 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by John W. Linville

rt2800: introduce wpdma_disable function

Introduce wpdma_disable function to simplify the code.
Signed-off-by: default avatarJakub Kicinski <kubakici@wp.pl>
Reviewed-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5f546070
...@@ -295,6 +295,20 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) ...@@ -295,6 +295,20 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
} }
EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready);
void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
}
EXPORT_SYMBOL_GPL(rt2800_disable_wpdma);
static bool rt2800_check_firmware_crc(const u8 *data, const size_t len) static bool rt2800_check_firmware_crc(const u8 *data, const size_t len)
{ {
u16 fw_crc; u16 fw_crc;
...@@ -436,10 +450,7 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, ...@@ -436,10 +450,7 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
* Disable DMA, will be reenabled later when enabling * Disable DMA, will be reenabled later when enabling
* the radio. * the radio.
*/ */
rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); rt2800_disable_wpdma(rt2x00dev);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
/* /*
* Initialize firmware. * Initialize firmware.
...@@ -2717,13 +2728,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) ...@@ -2717,13 +2728,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
unsigned int i; unsigned int i;
int ret; int ret;
rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); rt2800_disable_wpdma(rt2x00dev);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
ret = rt2800_drv_init_registers(rt2x00dev); ret = rt2800_drv_init_registers(rt2x00dev);
if (ret) if (ret)
...@@ -3997,10 +4002,7 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev) ...@@ -3997,10 +4002,7 @@ void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev)
{ {
u32 reg; u32 reg;
rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); rt2800_disable_wpdma(rt2x00dev);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
/* Wait for DMA, ignore error */ /* Wait for DMA, ignore error */
rt2800_wait_wpdma_ready(rt2x00dev); rt2800_wait_wpdma_ready(rt2x00dev);
......
...@@ -208,5 +208,6 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -208,5 +208,6 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u8 buf_size); u8 buf_size);
int rt2800_get_survey(struct ieee80211_hw *hw, int idx, int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
struct survey_info *survey); struct survey_info *survey);
void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
#endif /* RT2800LIB_H */ #endif /* RT2800LIB_H */
...@@ -361,7 +361,6 @@ static void rt2800pci_clear_entry(struct queue_entry *entry) ...@@ -361,7 +361,6 @@ static void rt2800pci_clear_entry(struct queue_entry *entry)
static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev) static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev)
{ {
struct queue_entry_priv_pci *entry_priv; struct queue_entry_priv_pci *entry_priv;
u32 reg;
/* /*
* Initialize registers. * Initialize registers.
...@@ -402,14 +401,7 @@ static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev) ...@@ -402,14 +401,7 @@ static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev)
rt2x00dev->rx[0].limit - 1); rt2x00dev->rx[0].limit - 1);
rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0); rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0);
/* rt2800_disable_wpdma(rt2x00dev);
* Enable global DMA configuration
*/
rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
rt2x00pci_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
rt2x00pci_register_write(rt2x00dev, DELAY_INT_CFG, 0); rt2x00pci_register_write(rt2x00dev, DELAY_INT_CFG, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment