Commit 80dac9ee authored by Nick Kossifidis's avatar Nick Kossifidis Committed by John W. Linville

ath5k: Use new dma_stop function on base.c

 * Since we stop rx/tx dma and pcu durring reset there is no need to
 call ath5k_hw_stop_rx/tx_dma before, also there is no need to call
 them durring stop_locked since we can use ath5k_hw_dma_stop for
 both.
Signed-off-by: default avatarNick Kossifidis <mickflemm@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e088f23b
......@@ -1063,15 +1063,27 @@ ath5k_beaconq_config(struct ath5k_softc *sc)
return ret;
}
/**
* ath5k_drain_tx_buffs - Empty tx buffers
*
* @sc The &struct ath5k_softc
*
* Empty tx buffers from all queues in preparation
* of a reset or during shutdown.
*
* NB: this assumes output has been stopped and
* we do not need to block ath5k_tx_tasklet
*/
static void
ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq)
ath5k_drain_tx_buffs(struct ath5k_softc *sc)
{
struct ath5k_txq *txq;
struct ath5k_buf *bf, *bf0;
int i;
/*
* NB: this assumes output has been stopped and
* we do not need to block ath5k_tx_tasklet
*/
for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
if (sc->txqs[i].setup) {
txq = &sc->txqs[i];
spin_lock_bh(&txq->lock);
list_for_each_entry_safe(bf, bf0, &txq->q, list) {
ath5k_debug_printtxbuf(sc, bf);
......@@ -1087,38 +1099,8 @@ ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq)
txq->link = NULL;
txq->txq_poll_mark = false;
spin_unlock_bh(&txq->lock);
}
/*
* Drain the transmit queues and reclaim resources.
*/
static void
ath5k_txq_cleanup(struct ath5k_softc *sc)
{
struct ath5k_hw *ah = sc->ah;
unsigned int i;
/* XXX return value */
if (likely(!test_bit(ATH_STAT_INVALID, sc->status))) {
/* don't touch the hardware if marked invalid */
ath5k_hw_stop_tx_dma(ah, sc->bhalq);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "beacon queue %x\n",
ath5k_hw_get_txdp(ah, sc->bhalq));
for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
if (sc->txqs[i].setup) {
ath5k_hw_stop_tx_dma(ah, sc->txqs[i].qnum);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "txq [%u] %x, "
"link %p\n",
sc->txqs[i].qnum,
ath5k_hw_get_txdp(ah,
sc->txqs[i].qnum),
sc->txqs[i].link);
}
}
for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
if (sc->txqs[i].setup)
ath5k_txq_drainq(sc, &sc->txqs[i]);
}
static void
......@@ -1178,16 +1160,19 @@ ath5k_rx_start(struct ath5k_softc *sc)
}
/*
* Disable the receive h/w in preparation for a reset.
* Disable the receive logic on PCU (DRU)
* In preparation for a shutdown.
*
* Note: Doesn't stop rx DMA, ath5k_hw_dma_stop
* does.
*/
static void
ath5k_rx_stop(struct ath5k_softc *sc)
{
struct ath5k_hw *ah = sc->ah;
ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */
ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */
ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
ath5k_debug_printrxbuffs(sc, ah);
}
......@@ -2383,10 +2368,9 @@ ath5k_stop_locked(struct ath5k_softc *sc)
ath5k_led_off(sc);
ath5k_hw_set_imr(ah, 0);
synchronize_irq(sc->pdev->irq);
}
ath5k_txq_cleanup(sc);
if (!test_bit(ATH_STAT_INVALID, sc->status)) {
ath5k_rx_stop(sc);
ath5k_hw_dma_stop(ah);
ath5k_drain_tx_buffs(sc);
ath5k_hw_phy_disable(ah);
}
......@@ -2532,8 +2516,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
stop_tasklets(sc);
if (chan) {
ath5k_txq_cleanup(sc);
ath5k_rx_stop(sc);
ath5k_drain_tx_buffs(sc);
sc->curchan = chan;
sc->curband = &sc->sbands[chan->band];
......
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