From owner-svn-src-head@FreeBSD.ORG Fri Feb 10 09:58:21 2012 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 622821065670; Fri, 10 Feb 2012 09:58:21 +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 458ED8FC12; Fri, 10 Feb 2012 09:58:21 +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 q1A9wLqa065515; Fri, 10 Feb 2012 09:58:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1A9wLNd065511; Fri, 10 Feb 2012 09:58:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202100958.q1A9wLNd065511@svn.freebsd.org> From: Adrian Chadd Date: Fri, 10 Feb 2012 09:58:21 +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: r231368 - 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: Fri, 10 Feb 2012 09:58:21 -0000 Author: adrian Date: Fri Feb 10 09:58:20 2012 New Revision: 231368 URL: http://svn.freebsd.org/changeset/base/231368 Log: Extend the HAL code to allow the RX and TX chainmask to be overridden by capabilities. Add an ar5416SetCapability() function, which contains logic to override the chainmask and update the relevant stream. This is designed to be called after the attach function, which presets the TX/RX chainmask and stream. TODO: check the chainmask against the hardware chainmask so non-existing chains aren't enabled. 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_misc.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Feb 10 09:55:18 2012 (r231367) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Feb 10 09:58:20 2012 (r231368) @@ -207,6 +207,9 @@ extern HAL_STATUS ar5416SetQuiet(struct uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag); extern HAL_STATUS ar5416GetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t *result); +extern HAL_BOOL ar5416SetCapability(struct ath_hal *ah, + HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t val, + HAL_STATUS *status); extern HAL_BOOL ar5416GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Feb 10 09:55:18 2012 (r231367) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Feb 10 09:58:20 2012 (r231368) @@ -129,6 +129,7 @@ ar5416InitState(struct ath_hal_5416 *ahp /* Misc Functions */ ah->ah_getCapability = ar5416GetCapability; + ah->ah_setCapability = ar5416SetCapability; ah->ah_getDiagState = ar5416GetDiagState; ah->ah_setLedState = ar5416SetLedState; ah->ah_gpioCfgOutput = ar5416GpioCfgOutput; @@ -884,6 +885,7 @@ ar5416FillCapabilityInfo(struct ath_hal /* AR5416 may have 3 antennas but is a 2x2 stream device */ pCap->halTxStreams = 2; pCap->halRxStreams = 2; + /* * If the TX or RX chainmask has less than 2 chains active, * mark it as a 1-stream device for the relevant stream. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Feb 10 09:55:18 2012 (r231367) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Feb 10 09:58:20 2012 (r231368) @@ -27,6 +27,8 @@ #include "ar5416/ar5416reg.h" #include "ar5416/ar5416phy.h" +#include "ah_eeprom_v14.h" /* for owl_get_ntxchains() */ + /* * Return the wireless modes (a,b,g,n,t) supported by hardware. * @@ -430,6 +432,33 @@ ar5416GetCapability(struct ath_hal *ah, return ar5212GetCapability(ah, type, capability, result); } +HAL_BOOL +ar5416SetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, + u_int32_t capability, u_int32_t setting, HAL_STATUS *status) +{ + HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; + + switch (type) { + case HAL_CAP_RX_CHAINMASK: + pCap->halRxChainMask = setting; + if (owl_get_ntxchains(setting) > 2) + pCap->halRxStreams = 2; + else + pCap->halRxStreams = 1; + return HAL_OK; + case HAL_CAP_TX_CHAINMASK: + pCap->halTxChainMask = setting; + if (owl_get_ntxchains(setting) > 2) + pCap->halTxStreams = 2; + else + pCap->halTxStreams = 1; + return HAL_OK; + default: + break; + } + return ar5212SetCapability(ah, type, capability, setting, status); +} + static int ar5416DetectMacHang(struct ath_hal *ah); static int ar5416DetectBBHang(struct ath_hal *ah);