aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNick Kossifidis <mickflemm@gmail.com>2010-11-23 13:45:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-30 13:52:31 -0500
commit80dac9eecbdb95f61b9b3c7081e02412155982b7 (patch)
treeae54526a8b8036a4bbca2288ca058401e7de87dd /drivers
parente088f23be166635b3938571c00c686094efa7cc4 (diff)
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: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c95
1 files changed, 39 insertions, 56 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 7f783d9462aa..eea5879575ba 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1063,62 +1063,44 @@ err:
1063 return ret; 1063 return ret;
1064} 1064}
1065 1065
1066/**
1067 * ath5k_drain_tx_buffs - Empty tx buffers
1068 *
1069 * @sc The &struct ath5k_softc
1070 *
1071 * Empty tx buffers from all queues in preparation
1072 * of a reset or during shutdown.
1073 *
1074 * NB: this assumes output has been stopped and
1075 * we do not need to block ath5k_tx_tasklet
1076 */
1066static void 1077static void
1067ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq) 1078ath5k_drain_tx_buffs(struct ath5k_softc *sc)
1068{ 1079{
1080 struct ath5k_txq *txq;
1069 struct ath5k_buf *bf, *bf0; 1081 struct ath5k_buf *bf, *bf0;
1082 int i;
1070 1083
1071 /* 1084 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
1072 * NB: this assumes output has been stopped and 1085 if (sc->txqs[i].setup) {
1073 * we do not need to block ath5k_tx_tasklet 1086 txq = &sc->txqs[i];
1074 */ 1087 spin_lock_bh(&txq->lock);
1075 spin_lock_bh(&txq->lock); 1088 list_for_each_entry_safe(bf, bf0, &txq->q, list) {
1076 list_for_each_entry_safe(bf, bf0, &txq->q, list) { 1089 ath5k_debug_printtxbuf(sc, bf);
1077 ath5k_debug_printtxbuf(sc, bf);
1078
1079 ath5k_txbuf_free_skb(sc, bf);
1080
1081 spin_lock_bh(&sc->txbuflock);
1082 list_move_tail(&bf->list, &sc->txbuf);
1083 sc->txbuf_len++;
1084 txq->txq_len--;
1085 spin_unlock_bh(&sc->txbuflock);
1086 }
1087 txq->link = NULL;
1088 txq->txq_poll_mark = false;
1089 spin_unlock_bh(&txq->lock);
1090}
1091 1090
1092/* 1091 ath5k_txbuf_free_skb(sc, bf);
1093 * Drain the transmit queues and reclaim resources.
1094 */
1095static void
1096ath5k_txq_cleanup(struct ath5k_softc *sc)
1097{
1098 struct ath5k_hw *ah = sc->ah;
1099 unsigned int i;
1100 1092
1101 /* XXX return value */ 1093 spin_lock_bh(&sc->txbuflock);
1102 if (likely(!test_bit(ATH_STAT_INVALID, sc->status))) { 1094 list_move_tail(&bf->list, &sc->txbuf);
1103 /* don't touch the hardware if marked invalid */ 1095 sc->txbuf_len++;
1104 ath5k_hw_stop_tx_dma(ah, sc->bhalq); 1096 txq->txq_len--;
1105 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "beacon queue %x\n", 1097 spin_unlock_bh(&sc->txbuflock);
1106 ath5k_hw_get_txdp(ah, sc->bhalq));
1107 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
1108 if (sc->txqs[i].setup) {
1109 ath5k_hw_stop_tx_dma(ah, sc->txqs[i].qnum);
1110 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "txq [%u] %x, "
1111 "link %p\n",
1112 sc->txqs[i].qnum,
1113 ath5k_hw_get_txdp(ah,
1114 sc->txqs[i].qnum),
1115 sc->txqs[i].link);
1116 } 1098 }
1099 txq->link = NULL;
1100 txq->txq_poll_mark = false;
1101 spin_unlock_bh(&txq->lock);
1102 }
1117 } 1103 }
1118
1119 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
1120 if (sc->txqs[i].setup)
1121 ath5k_txq_drainq(sc, &sc->txqs[i]);
1122} 1104}
1123 1105
1124static void 1106static void
@@ -1178,16 +1160,19 @@ err:
1178} 1160}
1179 1161
1180/* 1162/*
1181 * Disable the receive h/w in preparation for a reset. 1163 * Disable the receive logic on PCU (DRU)
1164 * In preparation for a shutdown.
1165 *
1166 * Note: Doesn't stop rx DMA, ath5k_hw_dma_stop
1167 * does.
1182 */ 1168 */
1183static void 1169static void
1184ath5k_rx_stop(struct ath5k_softc *sc) 1170ath5k_rx_stop(struct ath5k_softc *sc)
1185{ 1171{
1186 struct ath5k_hw *ah = sc->ah; 1172 struct ath5k_hw *ah = sc->ah;
1187 1173
1188 ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
1189 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */ 1174 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */
1190 ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */ 1175 ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
1191 1176
1192 ath5k_debug_printrxbuffs(sc, ah); 1177 ath5k_debug_printrxbuffs(sc, ah);
1193} 1178}
@@ -2383,10 +2368,9 @@ ath5k_stop_locked(struct ath5k_softc *sc)
2383 ath5k_led_off(sc); 2368 ath5k_led_off(sc);
2384 ath5k_hw_set_imr(ah, 0); 2369 ath5k_hw_set_imr(ah, 0);
2385 synchronize_irq(sc->pdev->irq); 2370 synchronize_irq(sc->pdev->irq);
2386 }
2387 ath5k_txq_cleanup(sc);
2388 if (!test_bit(ATH_STAT_INVALID, sc->status)) {
2389 ath5k_rx_stop(sc); 2371 ath5k_rx_stop(sc);
2372 ath5k_hw_dma_stop(ah);
2373 ath5k_drain_tx_buffs(sc);
2390 ath5k_hw_phy_disable(ah); 2374 ath5k_hw_phy_disable(ah);
2391 } 2375 }
2392 2376
@@ -2532,8 +2516,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
2532 stop_tasklets(sc); 2516 stop_tasklets(sc);
2533 2517
2534 if (chan) { 2518 if (chan) {
2535 ath5k_txq_cleanup(sc); 2519 ath5k_drain_tx_buffs(sc);
2536 ath5k_rx_stop(sc);
2537 2520
2538 sc->curchan = chan; 2521 sc->curchan = chan;
2539 sc->curband = &sc->sbands[chan->band]; 2522 sc->curband = &sc->sbands[chan->band];