From owner-svn-src-user@FreeBSD.ORG Fri Jul 23 12:51:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B44D1065677; Fri, 23 Jul 2010 12:51:24 +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 D57E08FC1A; Fri, 23 Jul 2010 12:51:23 +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 o6NCpNHs094822; Fri, 23 Jul 2010 12:51:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6NCpN9t094820; Fri, 23 Jul 2010 12:51:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201007231251.o6NCpN9t094820@svn.freebsd.org> From: Adrian Chadd Date: Fri, 23 Jul 2010 12:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210411 - user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2010 12:51:24 -0000 Author: adrian Date: Fri Jul 23 12:51:23 2010 New Revision: 210411 URL: http://svn.freebsd.org/changeset/base/210411 Log: Bring over an NF calibration fix from the latest linux wireless-testing ath9k code. The inline comment explains what is going on - on the ar5416 and ar9160 (at least) writing -50 to the CCA registers during Noise Floor calibration can result in the RX side going deaf. This has been tested on an SR-71 (AR9160 based) 11n MiniPCI card. The initial NF calibration on startup takes longer than the initial CCA register loading. It may be possible this occurs during periodic recalibrations. Obtained from: Linux 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 Fri Jul 23 12:30:29 2010 (r210410) +++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri Jul 23 12:51:23 2010 (r210411) @@ -552,6 +552,22 @@ ar5416LoadNF(struct ath_hal *ah, const s } /* + * 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. + */ + if (j == 1000) { + 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; + } + + /* * Restore maxCCAPower register parameter again so that we're not capped * by the median we just loaded. This will be initial (and max) value * of next noise floor calibration the baseband does.