svn commit: r210607 - user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416

Adrian Chadd adrian at FreeBSD.org
Thu Jul 29 14:13:45 UTC 2010


Author: adrian
Date: Thu Jul 29 14:13:45 2010
New Revision: 210607
URL: http://svn.freebsd.org/changeset/base/210607

Log:
  Point out that the comment in ar5416InitCal() that NF calibration
  is delayed is wrong.
  
  Since it is wrong, and the current code immediately kicks off
  one of the periodic calibrations on interface reset, just delay
  the rest of the calibration setup until the NF calibration
  completes.

Modified:
  user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Thu Jul 29 14:04:29 2010	(r210606)
+++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Thu Jul 29 14:13:45 2010	(r210607)
@@ -169,6 +169,7 @@ ar5416InitCal(struct ath_hal *ah, const 
 {
 	struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
 	HAL_CHANNEL_INTERNAL *ichan;
+	int i;
 
 	ichan = ath_hal_checkchannel(ah, chan);
 	HALASSERT(ichan != AH_NULL);
@@ -219,7 +220,24 @@ ar5416InitCal(struct ath_hal *ah, const 
 	 * higher than normal value if DC offset and noise floor cal are
 	 * triggered at the same time.
 	 */
+	/* XXX this actually kicks off a NF calibration -adrian */
 	OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
+	/*
+	 * Try to make sure the above NF cal completes, just so
+	 * it doesn't clash with subsequent percals -adrian
+	 */
+	for (i = 0; i < 100; i++) {
+		if (ath_hal_wait(ah, AR_PHY_AGC_CONTROL,
+		    AR_PHY_AGC_CONTROL_NF, 0) == AH_TRUE)
+			break;
+		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: (loop %d): initial NF "
+		"calibration didn't finish.\n", __func__, i);
+	}
+	if (i >= 100) {
+		HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did "
+		"not complete in time; noisy environment?\n", __func__);
+		return AH_FALSE;
+	}               
 
 	/* Initialize list pointers */
 	cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL;


More information about the svn-src-user mailing list