Author: adrian
Date: Thu Aug 12 06:20:54 2010
New Revision: 211211
URL: http://svn.freebsd.org/changeset/base/211211

Log:
  Loading the NF CCA values may take longer than expected to occur.
  If it does, don't then try reprogramming the NF "cap" values (ie
  what values are the "maximum" value the NF can be) - instead,
  just leave the current CCA value as the NF cap.
  
  This was inspired by some similar work from ath9k. It isn't
  a 100% complete solution (as there may be some reason where a
  high NF CCA/cap is written, causing the baseband to stop thinking it
  is able to transmit, leading to stuck beacon and interface reset)
  which I'll investigate and look at fixing in a later commit.
  
  Obtained from:        Linux

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c        Thu Aug 12 06:14:26 
2010        (r211210)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c        Thu Aug 12 06:20:54 
2010        (r211211)
@@ -527,7 +527,7 @@ ar5416LoadNF(struct ath_hal *ah, const s
                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 s
        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;
        }
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to