From owner-svn-src-all@FreeBSD.ORG Fri Mar 11 11:35:36 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 AD1A91065672; Fri, 11 Mar 2011 11:35:36 +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 991278FC0C; Fri, 11 Mar 2011 11:35:36 +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 p2BBZasi076980; Fri, 11 Mar 2011 11:35:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2BBZa1i076975; Fri, 11 Mar 2011 11:35:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201103111135.p2BBZa1i076975@svn.freebsd.org> From: Adrian Chadd Date: Fri, 11 Mar 2011 11:35:36 +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: r219480 - 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: Fri, 11 Mar 2011 11:35:36 -0000 Author: adrian Date: Fri Mar 11 11:35:36 2011 New Revision: 219480 URL: http://svn.freebsd.org/changeset/base/219480 Log: Introduce methods for the initial calibration and the new PA calibration routines. These are needed for the AR9285/AR2427 and AR9287 calibration routines which will be introducecd in a later commit. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Mar 11 11:07:53 2011 (r219479) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Mar 11 11:35:36 2011 (r219480) @@ -74,6 +74,12 @@ struct ath_hal_5416 { void (*ah_spurMitigate)(struct ath_hal *, const struct ieee80211_channel *); + /* calibration ops */ + HAL_BOOL (*ah_cal_initcal)(struct ath_hal *, + const struct ieee80211_channel *); + void (*ah_cal_pacal)(struct ath_hal *, + HAL_BOOL is_reset); + /* optional open-loop tx power control related methods */ void (*ah_olcInit)(struct ath_hal *); void (*ah_olcTempCompensation)(struct ath_hal *); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Mar 11 11:07:53 2011 (r219479) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Mar 11 11:35:36 2011 (r219480) @@ -178,6 +178,9 @@ ar5416InitState(struct ath_hal_5416 *ahp AH5416(ah)->ah_writeIni = ar5416WriteIni; AH5416(ah)->ah_spurMitigate = ar5416SpurMitigate; + /* Internal calibration ops */ + AH5416(ah)->ah_cal_initcal = ar5416InitCalHardware; + /* Internal TX power control related operations */ AH5416(ah)->ah_olcInit = ar5416olcInit; AH5416(ah)->ah_olcTempCompensation = ar5416olcTempCompensation; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri Mar 11 11:07:53 2011 (r219479) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri Mar 11 11:35:36 2011 (r219480) @@ -183,18 +183,9 @@ ar5416RunInitCals(struct ath_hal *ah, in } #endif -/* - * Initialize Calibration infrastructure. - */ HAL_BOOL -ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan) +ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan) { - struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; - HAL_CHANNEL_INTERNAL *ichan; - - ichan = ath_hal_checkchannel(ah, chan); - HALASSERT(ichan != AH_NULL); - if (AR_SREV_MERLIN_10_OR_LATER(ah)) { /* Enable Rx Filter Cal */ OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); @@ -235,6 +226,32 @@ ar5416InitCal(struct ath_hal *ah, const return AH_FALSE; } + return AH_TRUE; +} + +/* + * Initialize Calibration infrastructure. + */ +HAL_BOOL +ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan) +{ + struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; + HAL_CHANNEL_INTERNAL *ichan; + + ichan = ath_hal_checkchannel(ah, chan); + HALASSERT(ichan != AH_NULL); + + /* Do initial chipset-specific calibration */ + if (! AH5416(ah)->ah_cal_initcal(ah, chan)) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial chipset calibration did " + "not complete in time; noisy environment?\n", __func__); + return AH_FALSE; + } + + /* If there's PA Cal, do it */ + if (AH5416(ah)->ah_cal_pacal) + AH5416(ah)->ah_cal_pacal(ah, AH_TRUE); + /* * Do NF calibration after DC offset and other CALs. * Per system engineers, noise floor value can sometimes be 20 dB @@ -468,6 +485,10 @@ ar5416PerCalibrationN(struct ath_hal *ah /* Do NF cal only at longer intervals */ if (longcal) { + /* Do PA calibration if the chipset supports */ + 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); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h Fri Mar 11 11:07:53 2011 (r219479) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h Fri Mar 11 11:35:36 2011 (r219480) @@ -102,6 +102,7 @@ struct ar5416PerCal { } \ } while (0) +HAL_BOOL ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan); HAL_BOOL ar5416InitCal(struct ath_hal *, const struct ieee80211_channel *); HAL_BOOL ar5416PerCalibration(struct ath_hal *, struct ieee80211_channel *, HAL_BOOL *isIQdone);