aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2010-08-12 06:20:54 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2010-08-12 06:20:54 +0000
commit52f81b679a71bcdaaefb85f57c0ce7ab6ee83b45 (patch)
treee5c313d103c066f722e81f89d3f3da647331a78c /sys/dev
parent5215ce1038efe365c20b58515b7d6131446d6c93 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_cal.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
index ca09bdd7aab3..af9da725905e 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
@@ -527,7 +527,7 @@ ar5416LoadNF(struct ath_hal *ah, const struct ieee80211_channel *chan)
AR_PHY_CH2_EXT_CCA
};
struct ar5212NfCalHist *h;
- int i, j;
+ int i;
int32_t val;
uint8_t chainmask;
@@ -562,11 +562,20 @@ ar5416LoadNF(struct ath_hal *ah, const struct ieee80211_channel *chan)
OS_REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
- /* Wait for load to complete, should be fast, a few 10s of us. */
- for (j = 0; j < 1000; j++) {
- if ((OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) == 0)
- break;
- OS_DELAY(10);
+ if (! ar5212WaitNFCalComplete(ah, 1000)) {
+ /*
+ * We timed out waiting for the noisefloor to load, probably due to an
+ * in-progress rx. Simply return here and allow the load plenty of time
+ * to complete before the next calibration interval. We need to avoid
+ * trying to load -50 (which happens below) while the previous load is
+ * still in progress as this can cause rx deafness. Instead by returning
+ * here, the baseband nf cal will just be capped by our present
+ * noisefloor until the next calibration timer.
+ */
+ HALDEBUG(ah, HAL_DEBUG_ANY, "Timeout while waiting for nf "
+ "to load: AR_PHY_AGC_CONTROL=0x%x\n",
+ OS_REG_READ(ah, AR_PHY_AGC_CONTROL));
+ return;
}
/*