Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jun 2013 05:17:59 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
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
Message-ID:  <201306070517.r575Hxdv057327@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306070517.r575Hxdv057327>