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.
This commit is contained in:
Adrian Chadd 2013-06-07 05:17:58 +00:00
parent 0a2cc82713
commit 0c20aadbd9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251483
6 changed files with 22 additions and 5 deletions

View File

@ -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 *);

View File

@ -207,7 +207,7 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc,
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;

View File

@ -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 |

View File

@ -289,6 +289,12 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
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);

View File

@ -172,14 +172,14 @@ ar9285Attach(uint16_t devid, HAL_SOFTC sc,
/* 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 *ah)
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

View File

@ -47,6 +47,12 @@ ar9285BTCoexAntennaDiversity(struct ath_hal *ah)
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) &&