From owner-svn-src-all@FreeBSD.ORG Wed Jan 26 10:08:38 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 64DE9106564A; Wed, 26 Jan 2011 10:08:38 +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 48AAD8FC14; Wed, 26 Jan 2011 10:08:38 +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 p0QA8c0E070986; Wed, 26 Jan 2011 10:08:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0QA8ctq070983; Wed, 26 Jan 2011 10:08:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201101261008.p0QA8ctq070983@svn.freebsd.org> From: Adrian Chadd Date: Wed, 26 Jan 2011 10:08:38 +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: r217879 - 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: Wed, 26 Jan 2011 10:08:38 -0000 Author: adrian Date: Wed Jan 26 10:08:37 2011 New Revision: 217879 URL: http://svn.freebsd.org/changeset/base/217879 Log: Break out the chainmask init code into a new function - ar5416InitChainMasks() . ath9k does a few different things here during config - if it's an early AR5416 with two chains, it enables all three chains for calibration and then restores the chainmask to the original values after initial calibration has completed. The reason behind this commit is to begin breaking out the chainmask configuration for this specific reason; follow-up commits will add the chainmask restore in the ar5416Reset() routine. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Wed Jan 26 09:37:43 2011 (r217878) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Wed Jan 26 10:08:37 2011 (r217879) @@ -201,7 +201,7 @@ extern void ar5416GetTargetPowersLeg(str CAL_TARGET_POWER_LEG *powInfo, uint16_t numChannels, CAL_TARGET_POWER_LEG *pNewPower, uint16_t numRates, HAL_BOOL isExtTarget); - +extern void ar5416InitChainMasks(struct ath_hal *ah); extern HAL_BOOL ar5416StopTxDma(struct ath_hal *ah, u_int q); extern HAL_BOOL ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Jan 26 09:37:43 2011 (r217878) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Jan 26 10:08:37 2011 (r217879) @@ -209,13 +209,11 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO #endif } - if (AH5416(ah)->ah_rx_chainmask == 0x5 || - AH5416(ah)->ah_tx_chainmask == 0x5) - OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); - /* Setup Chain Masks */ - OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); - OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); - OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask); + /* + * This routine swaps the analog chains - it should be done + * before any radio register twiddling is done. + */ + ar5416InitChainMasks(ah); /* Setup the transmit power values. */ if (!ah->ah_setTxPower(ah, chan, rfXpdGain)) { @@ -1114,6 +1112,18 @@ ar5416SetReset(struct ath_hal *ah, int t return AH_TRUE; } +void +ar5416InitChainMasks(struct ath_hal *ah) +{ + if (AH5416(ah)->ah_rx_chainmask == 0x5 || + AH5416(ah)->ah_tx_chainmask == 0x5) + OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + /* Setup Chain Masks */ + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask); +} + #ifndef IS_5GHZ_FAST_CLOCK_EN #define IS_5GHZ_FAST_CLOCK_EN(ah, chan) AH_FALSE #endif