From owner-svn-src-all@FreeBSD.ORG Fri May 13 14:33:46 2011 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 6D56E106564A; Fri, 13 May 2011 14:33:46 +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 5245E8FC16; Fri, 13 May 2011 14:33:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DEXkXB073506; Fri, 13 May 2011 14:33:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DEXkgJ073502; Fri, 13 May 2011 14:33:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105131433.p4DEXkgJ073502@svn.freebsd.org> From: Adrian Chadd Date: Fri, 13 May 2011 14:33:46 +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: r221837 - in head/sys/dev/ath/ath_hal: ar5416 ar9002 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: Fri, 13 May 2011 14:33:46 -0000 Author: adrian Date: Fri May 13 14:33:45 2011 New Revision: 221837 URL: http://svn.freebsd.org/changeset/base/221837 Log: Only do open loop power control and temperature compensation for the AR9280 based NICs if it's actually enabled. Some of the OLC code was erroneously called during setup and calibration. This may have caused some incorrect behaviour. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri May 13 14:29:28 2011 (r221836) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri May 13 14:33:45 2011 (r221837) @@ -492,8 +492,9 @@ ar5416PerCalibrationN(struct ath_hal *ah if (AH5416(ah)->ah_cal_pacal) AH5416(ah)->ah_cal_pacal(ah, AH_FALSE); - /* Do temperature compensation if the chipset needs it */ - AH5416(ah)->ah_olcTempCompensation(ah); + /* Do open-loop temperature compensation if the chipset needs it */ + if (ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) + AH5416(ah)->ah_olcTempCompensation(ah); /* * Get the value from the previous NF cal Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri May 13 14:29:28 2011 (r221836) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri May 13 14:33:45 2011 (r221837) @@ -202,8 +202,11 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO */ ar5416InitChainMasks(ah); - /* Setup the open-loop temperature compensation if required */ - AH5416(ah)->ah_olcInit(ah); + /* Setup the open-loop power calibration if required */ + if (ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) { + AH5416(ah)->ah_olcInit(ah); + AH5416(ah)->ah_olcTempCompensation(ah); + } /* Setup the transmit power values. */ if (!ah->ah_setTxPower(ah, chan, rfXpdGain)) { Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c Fri May 13 14:29:28 2011 (r221836) +++ head/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c Fri May 13 14:33:45 2011 (r221837) @@ -43,6 +43,12 @@ ar9280olcInit(struct ath_hal *ah) { uint32_t i; + /* Only do OLC if it's enabled for this chipset */ + if (! ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) + return; + + HALDEBUG(ah, HAL_DEBUG_RESET, "%s: Setting up TX gain tables.\n", __func__); + for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++) AH9280(ah)->originalGain[i] = MS(OS_REG_READ(ah, AR_PHY_TX_GAIN_TBL1 + i * 4), AR_PHY_TX_GAIN); @@ -126,6 +132,9 @@ ar9280olcTemperatureCompensation(struct int delta, currPDADC, regval; uint8_t hpwr_5g = 0; + if (! ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) + return; + rddata = OS_REG_READ(ah, AR_PHY_TX_PWRCTRL4); currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT);