aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-08-11 04:32:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:23:55 -0400
commitf45144ef412422edf8018825328768e3db3ea45b (patch)
tree60458be8eb54391f1c058cf1cf01267a06f38063
parent9f1ba9062e032fb7b395cd27fc564754fe4e9867 (diff)
ath9k: Merge reset functions
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath9k/core.c73
-rw-r--r--drivers/net/wireless/ath9k/core.h3
-rw-r--r--drivers/net/wireless/ath9k/recv.c2
-rw-r--r--drivers/net/wireless/ath9k/xmit.c2
5 files changed, 27 insertions, 55 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index caf569401a34..67a804626757 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -719,7 +719,7 @@ void ath_bstuck_process(struct ath_softc *sc)
719 DPRINTF(sc, ATH_DBG_BEACON, 719 DPRINTF(sc, ATH_DBG_BEACON,
720 "%s: stuck beacon; resetting (bmiss count %u)\n", 720 "%s: stuck beacon; resetting (bmiss count %u)\n",
721 __func__, sc->sc_bmisscount); 721 __func__, sc->sc_bmisscount);
722 ath_internal_reset(sc); 722 ath_reset(sc, false);
723} 723}
724 724
725/* 725/*
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index f6c45288d0e7..10f2729a8c4b 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
@@ -828,29 +828,30 @@ done:
828 return error; 828 return error;
829} 829}
830 830
831/* 831int ath_reset(struct ath_softc *sc, bool retry_tx)
832 * Reset the hardware w/o losing operational state. This is
833 * basically a more efficient way of doing ath_stop, ath_init,
834 * followed by state transitions to the current 802.11
835 * operational state. Used to recover from errors rx overrun
836 * and to reset the hardware when rf gain settings must be reset.
837 */
838
839static int ath_reset_start(struct ath_softc *sc, u32 flag)
840{ 832{
841 struct ath_hal *ah = sc->sc_ah; 833 struct ath_hal *ah = sc->sc_ah;
834 int status;
835 int error = 0;
836 enum ath9k_ht_macmode ht_macmode = ath_cwm_macmode(sc);
842 837
843 ath9k_hw_set_interrupts(ah, 0); /* disable interrupts */ 838 ath9k_hw_set_interrupts(ah, 0); /* disable interrupts */
844 ath_draintxq(sc, flag & RESET_RETRY_TXQ); /* stop xmit side */ 839 ath_draintxq(sc, retry_tx); /* stop xmit */
845 ath_stoprecv(sc); /* stop recv side */ 840 ath_stoprecv(sc); /* stop recv */
846 ath_flushrecv(sc); /* flush recv queue */ 841 ath_flushrecv(sc); /* flush recv queue */
847
848 return 0;
849}
850 842
851static int ath_reset_end(struct ath_softc *sc, u32 flag) 843 /* Reset chip */
852{ 844 spin_lock_bh(&sc->sc_resetlock);
853 struct ath_hal *ah = sc->sc_ah; 845 if (!ath9k_hw_reset(ah, sc->sc_opmode, &sc->sc_curchan,
846 ht_macmode,
847 sc->sc_tx_chainmask, sc->sc_rx_chainmask,
848 sc->sc_ht_extprotspacing, false, &status)) {
849 DPRINTF(sc, ATH_DBG_FATAL,
850 "%s: unable to reset hardware; hal status %u\n",
851 __func__, status);
852 error = -EIO;
853 }
854 spin_unlock_bh(&sc->sc_resetlock);
854 855
855 if (ath_startrecv(sc) != 0) /* restart recv */ 856 if (ath_startrecv(sc) != 0) /* restart recv */
856 DPRINTF(sc, ATH_DBG_FATAL, 857 DPRINTF(sc, ATH_DBG_FATAL,
@@ -863,14 +864,15 @@ static int ath_reset_end(struct ath_softc *sc, u32 flag)
863 */ 864 */
864 ath_setcurmode(sc, ath_chan2mode(&sc->sc_curchan)); 865 ath_setcurmode(sc, ath_chan2mode(&sc->sc_curchan));
865 866
866 ath_update_txpow(sc); /* update tx power state */ 867 ath_update_txpow(sc);
867 868
868 if (sc->sc_beacons) 869 if (sc->sc_beacons)
869 ath_beacon_config(sc, ATH_IF_ID_ANY); /* restart beacons */ 870 ath_beacon_config(sc, ATH_IF_ID_ANY); /* restart beacons */
871
870 ath9k_hw_set_interrupts(ah, sc->sc_imask); 872 ath9k_hw_set_interrupts(ah, sc->sc_imask);
871 873
872 /* Restart the txq */ 874 /* Restart the txq */
873 if (flag & RESET_RETRY_TXQ) { 875 if (retry_tx) {
874 int i; 876 int i;
875 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 877 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
876 if (ATH_TXQ_SETUP(sc, i)) { 878 if (ATH_TXQ_SETUP(sc, i)) {
@@ -880,28 +882,6 @@ static int ath_reset_end(struct ath_softc *sc, u32 flag)
880 } 882 }
881 } 883 }
882 } 884 }
883 return 0;
884}
885
886int ath_reset(struct ath_softc *sc)
887{
888 struct ath_hal *ah = sc->sc_ah;
889 int status;
890 int error = 0;
891 enum ath9k_ht_macmode ht_macmode = ath_cwm_macmode(sc);
892
893 /* NB: indicate channel change so we do a full reset */
894 spin_lock_bh(&sc->sc_resetlock);
895 if (!ath9k_hw_reset(ah, sc->sc_opmode, &sc->sc_curchan,
896 ht_macmode,
897 sc->sc_tx_chainmask, sc->sc_rx_chainmask,
898 sc->sc_ht_extprotspacing, false, &status)) {
899 DPRINTF(sc, ATH_DBG_FATAL,
900 "%s: unable to reset hardware; hal status %u\n",
901 __func__, status);
902 error = -EIO;
903 }
904 spin_unlock_bh(&sc->sc_resetlock);
905 885
906 return error; 886 return error;
907} 887}
@@ -1050,7 +1030,7 @@ static void ath9k_tasklet(unsigned long data)
1050 1030
1051 if (status & ATH9K_INT_FATAL) { 1031 if (status & ATH9K_INT_FATAL) {
1052 /* need a chip reset */ 1032 /* need a chip reset */
1053 ath_internal_reset(sc); 1033 ath_reset(sc, false);
1054 return; 1034 return;
1055 } else { 1035 } else {
1056 1036
@@ -1815,13 +1795,6 @@ void ath_descdma_cleanup(struct ath_softc *sc,
1815/* Utilities */ 1795/* Utilities */
1816/*************/ 1796/*************/
1817 1797
1818void ath_internal_reset(struct ath_softc *sc)
1819{
1820 ath_reset_start(sc, 0);
1821 ath_reset(sc);
1822 ath_reset_end(sc, 0);
1823}
1824
1825int ath_get_hal_qnum(u16 queue, struct ath_softc *sc) 1798int ath_get_hal_qnum(u16 queue, struct ath_softc *sc)
1826{ 1799{
1827 int qnum; 1800 int qnum;
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 673b3d81133a..ef8f63766d43 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -1030,7 +1030,7 @@ void ath_deinit(struct ath_softc *sc);
1030int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan); 1030int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan);
1031int ath_suspend(struct ath_softc *sc); 1031int ath_suspend(struct ath_softc *sc);
1032irqreturn_t ath_isr(int irq, void *dev); 1032irqreturn_t ath_isr(int irq, void *dev);
1033int ath_reset(struct ath_softc *sc); 1033int ath_reset(struct ath_softc *sc, bool retry_tx);
1034void ath_scan_start(struct ath_softc *sc); 1034void ath_scan_start(struct ath_softc *sc);
1035void ath_scan_end(struct ath_softc *sc); 1035void ath_scan_end(struct ath_softc *sc);
1036int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan); 1036int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan);
@@ -1056,7 +1056,6 @@ int ath_cabq_update(struct ath_softc *);
1056void ath_get_currentCountry(struct ath_softc *sc, 1056void ath_get_currentCountry(struct ath_softc *sc,
1057 struct ath9k_country_entry *ctry); 1057 struct ath9k_country_entry *ctry);
1058u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp); 1058u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp);
1059void ath_internal_reset(struct ath_softc *sc);
1060u32 ath_chan2flags(struct ieee80211_channel *chan, struct ath_softc *sc); 1059u32 ath_chan2flags(struct ieee80211_channel *chan, struct ath_softc *sc);
1061dma_addr_t ath_skb_map_single(struct ath_softc *sc, 1060dma_addr_t ath_skb_map_single(struct ath_softc *sc,
1062 struct sk_buff *skb, 1061 struct sk_buff *skb,
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 2fe806175c01..838b656b9da4 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -1089,7 +1089,7 @@ rx_next:
1089 "%s: Reset rx chain mask. " 1089 "%s: Reset rx chain mask. "
1090 "Do internal reset\n", __func__); 1090 "Do internal reset\n", __func__);
1091 ASSERT(flush == 0); 1091 ASSERT(flush == 0);
1092 ath_internal_reset(sc); 1092 ath_reset(sc, false);
1093 } 1093 }
1094 1094
1095 return 0; 1095 return 0;
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 157f830ee6b8..93064cc4cba8 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -1242,7 +1242,7 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
1242 } 1242 }
1243 1243
1244 if (needreset) 1244 if (needreset)
1245 ath_internal_reset(sc); 1245 ath_reset(sc, false);
1246 1246
1247 return; 1247 return;
1248} 1248}