aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-02-11 23:36:47 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:51:43 -0500
commit4af9cf4fda28c5f794861c52e0db5a3de9ee574d (patch)
treebd7cf98a05dee402ff290ae71b30c153b3f1acbd
parent06d0f0663e11cab4ec5f2c143a118d71a12fbbe9 (diff)
ath9k: Enable TSF Out of Range Interrupt
This patch lays the groundwork for handling TSF Out of Range interrupt, which will be used for power save later on. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/beacon.c3
-rw-r--r--drivers/net/wireless/ath9k/hw.c8
-rw-r--r--drivers/net/wireless/ath9k/hw.h4
-rw-r--r--drivers/net/wireless/ath9k/main.c15
-rw-r--r--drivers/net/wireless/ath9k/reg.h4
5 files changed, 27 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index 2e2ef3529135..390d5109e826 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -753,6 +753,9 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
753 if (bs.bs_sleepduration > bs.bs_dtimperiod) 753 if (bs.bs_sleepduration > bs.bs_dtimperiod)
754 bs.bs_sleepduration = bs.bs_dtimperiod; 754 bs.bs_sleepduration = bs.bs_dtimperiod;
755 755
756 /* TSF out of range threshold fixed at 1 second */
757 bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;
758
756 DPRINTF(sc, ATH_DBG_BEACON, 759 DPRINTF(sc, ATH_DBG_BEACON,
757 "tsf %llu " 760 "tsf %llu "
758 "tsf:tu %u " 761 "tsf:tu %u "
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 6939e4142325..4af1aac16785 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -2803,6 +2803,8 @@ bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
2803 mask2 |= ATH9K_INT_GTT; 2803 mask2 |= ATH9K_INT_GTT;
2804 if (isr2 & AR_ISR_S2_CST) 2804 if (isr2 & AR_ISR_S2_CST)
2805 mask2 |= ATH9K_INT_CST; 2805 mask2 |= ATH9K_INT_CST;
2806 if (isr2 & AR_ISR_S2_TSFOOR)
2807 mask2 |= ATH9K_INT_TSFOOR;
2806 } 2808 }
2807 2809
2808 isr = REG_READ(ah, AR_ISR_RAC); 2810 isr = REG_READ(ah, AR_ISR_RAC);
@@ -2948,7 +2950,9 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints)
2948 if (ints & ATH9K_INT_DTIMSYNC) 2950 if (ints & ATH9K_INT_DTIMSYNC)
2949 mask2 |= AR_IMR_S2_DTIMSYNC; 2951 mask2 |= AR_IMR_S2_DTIMSYNC;
2950 if (ints & ATH9K_INT_CABEND) 2952 if (ints & ATH9K_INT_CABEND)
2951 mask2 |= (AR_IMR_S2_CABEND); 2953 mask2 |= AR_IMR_S2_CABEND;
2954 if (ints & ATH9K_INT_TSFOOR)
2955 mask2 |= AR_IMR_S2_TSFOOR;
2952 } 2956 }
2953 2957
2954 if (ints & (ATH9K_INT_GTT | ATH9K_INT_CST)) { 2958 if (ints & (ATH9K_INT_GTT | ATH9K_INT_CST)) {
@@ -3118,6 +3122,8 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
3118 AR_TBTT_TIMER_EN | AR_TIM_TIMER_EN | 3122 AR_TBTT_TIMER_EN | AR_TIM_TIMER_EN |
3119 AR_DTIM_TIMER_EN); 3123 AR_DTIM_TIMER_EN);
3120 3124
3125 /* TSF Out of Range Threshold */
3126 REG_WRITE(ah, AR_TSFOOR_THRESHOLD, bs->bs_tsfoor_threshold);
3121} 3127}
3122 3128
3123/*******************/ 3129/*******************/
diff --git a/drivers/net/wireless/ath9k/hw.h b/drivers/net/wireless/ath9k/hw.h
index 82111636c693..587a78db748d 100644
--- a/drivers/net/wireless/ath9k/hw.h
+++ b/drivers/net/wireless/ath9k/hw.h
@@ -249,6 +249,7 @@ enum ath9k_int {
249 ATH9K_INT_DTIMSYNC = 0x00800000, 249 ATH9K_INT_DTIMSYNC = 0x00800000,
250 ATH9K_INT_GPIO = 0x01000000, 250 ATH9K_INT_GPIO = 0x01000000,
251 ATH9K_INT_CABEND = 0x02000000, 251 ATH9K_INT_CABEND = 0x02000000,
252 ATH9K_INT_TSFOOR = 0x04000000,
252 ATH9K_INT_CST = 0x10000000, 253 ATH9K_INT_CST = 0x10000000,
253 ATH9K_INT_GTT = 0x20000000, 254 ATH9K_INT_GTT = 0x20000000,
254 ATH9K_INT_FATAL = 0x40000000, 255 ATH9K_INT_FATAL = 0x40000000,
@@ -256,6 +257,7 @@ enum ath9k_int {
256 ATH9K_INT_BMISC = ATH9K_INT_TIM | 257 ATH9K_INT_BMISC = ATH9K_INT_TIM |
257 ATH9K_INT_DTIM | 258 ATH9K_INT_DTIM |
258 ATH9K_INT_DTIMSYNC | 259 ATH9K_INT_DTIMSYNC |
260 ATH9K_INT_TSFOOR |
259 ATH9K_INT_CABEND, 261 ATH9K_INT_CABEND,
260 ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM | 262 ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
261 ATH9K_INT_RXDESC | 263 ATH9K_INT_RXDESC |
@@ -385,6 +387,7 @@ struct ath9k_beacon_state {
385#define ATH9K_BEACON_PERIOD 0x0000ffff 387#define ATH9K_BEACON_PERIOD 0x0000ffff
386#define ATH9K_BEACON_ENA 0x00800000 388#define ATH9K_BEACON_ENA 0x00800000
387#define ATH9K_BEACON_RESET_TSF 0x01000000 389#define ATH9K_BEACON_RESET_TSF 0x01000000
390#define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */
388 u32 bs_dtimperiod; 391 u32 bs_dtimperiod;
389 u16 bs_cfpperiod; 392 u16 bs_cfpperiod;
390 u16 bs_cfpmaxduration; 393 u16 bs_cfpmaxduration;
@@ -392,6 +395,7 @@ struct ath9k_beacon_state {
392 u16 bs_timoffset; 395 u16 bs_timoffset;
393 u16 bs_bmissthreshold; 396 u16 bs_bmissthreshold;
394 u32 bs_sleepduration; 397 u32 bs_sleepduration;
398 u32 bs_tsfoor_threshold;
395}; 399};
396 400
397struct chan_centers { 401struct chan_centers {
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 7d7537e2738e..32cdb246a8f2 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -574,6 +574,10 @@ irqreturn_t ath_isr(int irq, void *dev)
574 sc->sc_flags |= SC_OP_WAIT_FOR_BEACON; 574 sc->sc_flags |= SC_OP_WAIT_FOR_BEACON;
575 } 575 }
576 } 576 }
577 if (status & ATH9K_INT_TSFOOR) {
578 /* FIXME: Handle this interrupt for power save */
579 sched = true;
580 }
577 } 581 }
578 } while (0); 582 } while (0);
579 583
@@ -2165,10 +2169,13 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2165 * Enable MIB interrupts when there are hardware phy counters. 2169 * Enable MIB interrupts when there are hardware phy counters.
2166 * Note we only do this (at the moment) for station mode. 2170 * Note we only do this (at the moment) for station mode.
2167 */ 2171 */
2168 if (ath9k_hw_phycounters(sc->sc_ah) && 2172 if ((conf->type == NL80211_IFTYPE_STATION) ||
2169 ((conf->type == NL80211_IFTYPE_STATION) || 2173 (conf->type == NL80211_IFTYPE_ADHOC)) {
2170 (conf->type == NL80211_IFTYPE_ADHOC))) 2174 if (ath9k_hw_phycounters(sc->sc_ah))
2171 sc->imask |= ATH9K_INT_MIB; 2175 sc->imask |= ATH9K_INT_MIB;
2176 sc->imask |= ATH9K_INT_TSFOOR;
2177 }
2178
2172 /* 2179 /*
2173 * Some hardware processes the TIM IE and fires an 2180 * Some hardware processes the TIM IE and fires an
2174 * interrupt when the TIM bit is set. For hardware 2181 * interrupt when the TIM bit is set. For hardware
diff --git a/drivers/net/wireless/ath9k/reg.h b/drivers/net/wireless/ath9k/reg.h
index 17ed190349a5..a471832308a0 100644
--- a/drivers/net/wireless/ath9k/reg.h
+++ b/drivers/net/wireless/ath9k/reg.h
@@ -1385,8 +1385,8 @@ enum {
1385#define AR_PHY_COUNTMAX (3 << 22) 1385#define AR_PHY_COUNTMAX (3 << 22)
1386#define AR_MIBCNT_INTRMASK (3 << 22) 1386#define AR_MIBCNT_INTRMASK (3 << 22)
1387 1387
1388#define AR_TSF_THRESHOLD 0x813c 1388#define AR_TSFOOR_THRESHOLD 0x813c
1389#define AR_TSF_THRESHOLD_VAL 0x0000FFFF 1389#define AR_TSFOOR_THRESHOLD_VAL 0x0000FFFF
1390 1390
1391#define AR_PHY_ERR_EIFS_MASK 8144 1391#define AR_PHY_ERR_EIFS_MASK 8144
1392 1392