From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:20:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0515106567B; Thu, 12 Aug 2010 06:20:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 951058FC17; Thu, 12 Aug 2010 06:20:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C6Ksp8095358; Thu, 12 Aug 2010 06:20:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C6Ks20095356; Thu, 12 Aug 2010 06:20:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120620.o7C6Ks20095356@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211211 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 06:20:54 -0000 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; } /*