summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-02-10 09:58:20 +0000
committeradrian <adrian@FreeBSD.org>2012-02-10 09:58:20 +0000
commitfac2dffabbcba8190b71ded4546b4ed1e80e9d85 (patch)
tree4d6cc9d1f9fb237fcbeb03e2390c32e733eda3dd
parent3c2d86e2b50cdaea3e3c423ebfdfaab63ed3c426 (diff)
downloadFreeBSD-src-fac2dffabbcba8190b71ded4546b4ed1e80e9d85.zip
FreeBSD-src-fac2dffabbcba8190b71ded4546b4ed1e80e9d85.tar.gz
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.
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_misc.c29
3 files changed, 34 insertions, 0 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h
index 5006c31..7099b56 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h
@@ -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);
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
index 83fc313..059799e 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
@@ -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.
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
index 4df10cd..43444d6 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
@@ -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);
OpenPOWER on IntegriCloud