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.
This commit is contained in:
Adrian Chadd 2012-02-10 09:58:20 +00:00
parent 48ef46e55a
commit 40ffb20de6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231368
3 changed files with 34 additions and 0 deletions

View File

@ -207,6 +207,9 @@ extern HAL_STATUS ar5416SetQuiet(struct ath_hal *ah, uint32_t period,
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);

View File

@ -129,6 +129,7 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc,
/* 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 *ah)
/* 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.

View File

@ -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, HAL_CAPABILITY_TYPE type,
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);