From owner-svn-src-head@FreeBSD.ORG Thu Jan 27 09:26:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7720D106566B; Thu, 27 Jan 2011 09:26:37 +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 4BD008FC12; Thu, 27 Jan 2011 09:26:37 +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 p0R9QbiH008350; Thu, 27 Jan 2011 09:26:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0R9QbgS008348; Thu, 27 Jan 2011 09:26:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201101270926.p0R9QbgS008348@svn.freebsd.org> From: Adrian Chadd Date: Thu, 27 Jan 2011 09:26:37 +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: r217930 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2011 09:26:37 -0000 Author: adrian Date: Thu Jan 27 09:26:37 2011 New Revision: 217930 URL: http://svn.freebsd.org/changeset/base/217930 Log: Initialise the chainmask from the EEPROM rather than the hard-coded defaults. The defaults enabled three chains on the AR5416 even if the card has two chains. This restores that and ensures that only the correct TX/RX chainmasks are used. When HT modes are enabled, all TX chains will be correctly enabled. This should now enable analog chain swapping with 2-chain cards. I'm not sure if this is needed for just the AR5416 or whether it also applies to AR9160, AR9280 and AR9287 (later on); I'll have to get clarification. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Thu Jan 27 09:04:20 2011 (r217929) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Thu Jan 27 09:26:37 2011 (r217930) @@ -44,6 +44,7 @@ static void ar5416InitBB(struct ath_hal static void ar5416InitIMR(struct ath_hal *ah, HAL_OPMODE opmode); static void ar5416InitQoS(struct ath_hal *ah); static void ar5416InitUserSettings(struct ath_hal *ah); +static void ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht); #if 0 static HAL_BOOL ar5416ChannelChange(struct ath_hal *, const struct ieee80211_channel *); @@ -210,6 +211,11 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO } /* + * Setup ah_tx_chainmask / ah_rx_chainmask before we fiddle + * with enabling the TX/RX radio chains. + */ + ar5416UpdateChainMasks(ah, IEEE80211_IS_CHAN_HT(chan)); + /* * This routine swaps the analog chains - it should be done * before any radio register twiddling is done. */ @@ -1137,6 +1143,30 @@ ar5416RestoreChainMask(struct ath_hal *a } } +/* + * Update the chainmask based on the current channel configuration. + * + * XXX ath9k checks bluetooth co-existence here + * XXX ath9k checks whether the current state is "off-channel". + * XXX ath9k sticks the hardware into 1x1 mode for legacy; + * we're going to leave multi-RX on for multi-path cancellation. + */ +static void +ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht) +{ + struct ath_hal_private *ahpriv = AH_PRIVATE(ah); + HAL_CAPABILITIES *pCap = &ahpriv->ah_caps; + + if (is_ht) { + AH5416(ah)->ah_tx_chainmask = pCap->halTxChainMask; + } else { + AH5416(ah)->ah_tx_chainmask = 1; + } + AH5416(ah)->ah_rx_chainmask = pCap->halRxChainMask; + HALDEBUG(ah, HAL_DEBUG_ANY, "TX chainmask: 0x%x; RX chainmask: 0x%x\n", + AH5416(ah)->ah_tx_chainmask, + AH5416(ah)->ah_rx_chainmask); +} #ifndef IS_5GHZ_FAST_CLOCK_EN #define IS_5GHZ_FAST_CLOCK_EN(ah, chan) AH_FALSE