From owner-svn-src-head@FreeBSD.ORG Fri Jun 7 05:18:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0959796B; Fri, 7 Jun 2013 05:18:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DEED619A2; Fri, 7 Jun 2013 05:18:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r575I0kr057342; Fri, 7 Jun 2013 05:18:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r575Hxdv057327; Fri, 7 Jun 2013 05:17:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306070517.r575Hxdv057327@svn.freebsd.org> From: Adrian Chadd Date: Fri, 7 Jun 2013 05:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251483 - in head/sys/dev/ath/ath_hal: . ar5416 ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 07 Jun 2013 05:18:01 -0000 Author: adrian Date: Fri Jun 7 05:17:58 2013 New Revision: 251483 URL: http://svnweb.freebsd.org/changeset/base/251483 Log: Add bluetooth fixes to the AR5416/AR92xx HAL: * Call the bluetooth setup function during the reset path, so the bluetooth settings are actually initialised. * Call the AR9285 diversity functions during bluetooth setup; so the AR9285 diversity and antenna configuration registers are correctly programmed * Misc debugging info. Tested: * AR9285+AR3011 bluetooth combo; this code itself doesn't enable bluetooth coexistence but it's part of what I'm currently using. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ah.h Fri Jun 7 05:17:58 2013 (r251483) @@ -1581,7 +1581,7 @@ struct ath_hal { uint32_t); void __ahdecl(*ah_btCoexSetBmissThresh)(struct ath_hal *, uint32_t); - void __ahdecl(*ah_btcoexSetParameter)(struct ath_hal *, + void __ahdecl(*ah_btCoexSetParameter)(struct ath_hal *, uint32_t, uint32_t); void __ahdecl(*ah_btCoexDisable)(struct ath_hal *); int __ahdecl(*ah_btCoexEnable)(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 Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Jun 7 05:17:58 2013 (r251483) @@ -207,7 +207,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_btCoexSetQcuThresh = ar5416BTCoexSetQcuThresh; ah->ah_btCoexSetWeights = ar5416BTCoexSetWeights; ah->ah_btCoexSetBmissThresh = ar5416BTCoexSetupBmissThresh; - ah->ah_btcoexSetParameter = ar5416BTCoexSetParameter; + ah->ah_btCoexSetParameter = ar5416BTCoexSetParameter; ah->ah_btCoexDisable = ar5416BTCoexDisable; ah->ah_btCoexEnable = ar5416BTCoexEnable; AH5416(ah)->ah_btCoexSetDiversity = ar5416BTCoexAntennaDiversity; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Fri Jun 7 05:17:58 2013 (r251483) @@ -328,6 +328,11 @@ ar5416InitBTCoex(struct ath_hal *ah) { struct ath_hal_5416 *ahp = AH5416(ah); + HALDEBUG(ah, HAL_DEBUG_BT_COEX, + "%s: called; configType=%d\n", + __func__, + ahp->ah_btCoexConfigType); + if (ahp->ah_btCoexConfigType == HAL_BT_COEX_CFG_3WIRE) { OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB | Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Jun 7 05:17:58 2013 (r251483) @@ -289,6 +289,12 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO ar5416StartTsf2(ah); #endif + /* + * Enable Bluetooth Coexistence if it's enabled. + */ + if (AH5416(ah)->ah_btCoexConfigType != HAL_BT_COEX_CFG_NONE) + ar5416InitBTCoex(ah); + /* Restore previous antenna */ OS_REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna); Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Fri Jun 7 05:17:58 2013 (r251483) @@ -172,14 +172,14 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s /* override with 9285 specific state */ AH5416(ah)->ah_initPLL = ar9280InitPLL; - AH5416(ah)->ah_btCoexSetDiversity = ar5416BTCoexAntennaDiversity; + AH5416(ah)->ah_btCoexSetDiversity = ar9285BTCoexAntennaDiversity; ah->ah_setAntennaSwitch = ar9285SetAntennaSwitch; ah->ah_configPCIE = ar9285ConfigPCIE; ah->ah_disablePCIE = ar9285DisablePCIE; ah->ah_setTxPower = ar9285SetTransmitPower; ah->ah_setBoardValues = ar9285SetBoardValues; - ah->ah_btcoexSetParameter = ar9285BTCoexSetParameter; + ah->ah_btCoexSetParameter = ar9285BTCoexSetParameter; AH5416(ah)->ah_cal.iqCalData.calData = &ar9280_iq_cal; AH5416(ah)->ah_cal.adcGainCalData.calData = &ar9280_adc_gain_cal; @@ -543,7 +543,7 @@ ar9285FillCapabilityInfo(struct ath_hal pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; pCap->halUseCombinedRadarRssi = AH_TRUE; -#if 0 +#if 1 /* XXX bluetooth */ pCap->halBtCoexSupport = AH_TRUE; #endif Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Fri Jun 7 05:17:58 2013 (r251483) @@ -47,6 +47,12 @@ ar9285BTCoexAntennaDiversity(struct ath_ u_int32_t regVal; u_int8_t ant_div_control1, ant_div_control2; + HALDEBUG(ah, HAL_DEBUG_BT_COEX, + "%s: btCoexFlag: ALLOW=%d, ENABLE=%d\n", + __func__, + !! (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW), + !! (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE)); + if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) || (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) { if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) &&