summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-05-10 04:32:27 +0000
committeradrian <adrian@FreeBSD.org>2011-05-10 04:32:27 +0000
commit7e859b0cd7d9826602cafd708bc42d66e3ebf476 (patch)
treec1b46765d9532a625dc3e2a40189d1143f76a70e
parent25bebdda201858f62254543bea360283912ddd7f (diff)
downloadFreeBSD-src-7e859b0cd7d9826602cafd708bc42d66e3ebf476.zip
FreeBSD-src-7e859b0cd7d9826602cafd708bc42d66e3ebf476.tar.gz
AR9285 (Kite) fixes.
* Correct some of the silicon revision checks to match what the Atheros HAL does. (See [1] below.) * Move the PA cal and init cal method assignment to -after- the mac version/revision IDs are stored. The AR9285 init cal was never being called. * Enable ANI. Note Kite 1.0 and 1.1 were prototypes that shouldn't be seen in the wild. Linux ath9k simply removed the prototype code from their codebase. I'm going to leave it in there for now but make it conditionally compilable in the future. Obtained from: Atheros
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_attach.c39
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_cal.c9
2 files changed, 38 insertions, 10 deletions
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
index 129f094..b7ed27d 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
@@ -74,8 +74,33 @@ static void ar9285WriteIni(struct ath_hal *ah,
static void
ar9285AniSetup(struct ath_hal *ah)
{
- /* NB: disable ANI for reliable RIFS rx */
- ar5416AniAttach(ah, AH_NULL, AH_NULL, AH_FALSE);
+ /*
+ * These are the parameters from the AR5416 ANI code;
+ * they likely need quite a bit of adjustment for the
+ * AR9285.
+ */
+ static const struct ar5212AniParams aniparams = {
+ .maxNoiseImmunityLevel = 4, /* levels 0..4 */
+ .totalSizeDesired = { -55, -55, -55, -55, -62 },
+ .coarseHigh = { -14, -14, -14, -14, -12 },
+ .coarseLow = { -64, -64, -64, -64, -70 },
+ .firpwr = { -78, -78, -78, -78, -80 },
+ .maxSpurImmunityLevel = 2,
+ .cycPwrThr1 = { 2, 4, 6 },
+ .maxFirstepLevel = 2, /* levels 0..2 */
+ .firstep = { 0, 4, 8 },
+ .ofdmTrigHigh = 500,
+ .ofdmTrigLow = 200,
+ .cckTrigHigh = 200,
+ .cckTrigLow = 100,
+ .rssiThrHigh = 40,
+ .rssiThrLow = 7,
+ .period = 100,
+ };
+ /* NB: disable ANI noise immmunity for reliable RIFS rx */
+ AH5416(ah)->ah_ani_function &= ~ HAL_ANI_NOISE_IMMUNITY_LEVEL;
+
+ ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE);
}
/*
@@ -122,10 +147,6 @@ ar9285Attach(uint16_t devid, HAL_SOFTC sc,
AH5416(ah)->ah_cal.adcDcCalInitData.calData = &ar9280_adc_init_dc_cal;
AH5416(ah)->ah_cal.suppCals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL;
- if (AR_SREV_KITE_12_OR_LATER(ah))
- AH5416(ah)->ah_cal_initcal = ar9285InitCalHardware;
- AH5416(ah)->ah_cal_pacal = ar9002_hw_pa_cal;
-
AH5416(ah)->ah_spurMitigate = ar9280SpurMitigate;
AH5416(ah)->ah_writeIni = ar9285WriteIni;
AH5416(ah)->ah_rx_chainmask = AR9285_DEFAULT_RXCHAINMASK;
@@ -173,6 +194,12 @@ ar9285Attach(uint16_t devid, HAL_SOFTC sc,
}
ar5416AttachPCIE(ah);
+ /* Attach methods that require MAC version/revision info */
+ if (AR_SREV_KITE_12_OR_LATER(ah))
+ AH5416(ah)->ah_cal_initcal = ar9285InitCalHardware;
+ if (AR_SREV_KITE_11_OR_LATER(ah))
+ AH5416(ah)->ah_cal_pacal = ar9002_hw_pa_cal;
+
ecode = ath_hal_v4kEepromAttach(ah);
if (ecode != HAL_OK)
goto bad;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c b/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c
index bcb5959..f972ecb 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c
@@ -60,13 +60,13 @@ ar9285_hw_pa_cal(struct ath_hal *ah, HAL_BOOL is_reset)
{ 0x7838, 0 },
};
- HALDEBUG(ah, HAL_DEBUG_PERCAL, "Running PA Calibration\n");
-
/* PA CAL is not needed for high power solution */
if (ath_hal_eepromGet(ah, AR_EEP_TXGAIN_TYPE, AH_NULL) ==
AR5416_EEP_TXGAIN_HIGH_POWER)
return;
+ HALDEBUG(ah, HAL_DEBUG_PERCAL, "Running PA Calibration\n");
+
for (i = 0; i < N(regList); i++)
regList[i][1] = OS_REG_READ(ah, regList[i][0]);
@@ -151,7 +151,7 @@ ar9285_hw_pa_cal(struct ath_hal *ah, HAL_BOOL is_reset)
void
ar9002_hw_pa_cal(struct ath_hal *ah, HAL_BOOL is_reset)
{
- if (AR_SREV_KITE_12_OR_LATER(ah)) {
+ if (AR_SREV_KITE_11_OR_LATER(ah)) {
if (is_reset || !AH9285(ah)->pacal_info.skipcount)
ar9285_hw_pa_cal(ah, is_reset);
else
@@ -260,7 +260,8 @@ HAL_BOOL
ar9285InitCalHardware(struct ath_hal *ah,
const struct ieee80211_channel *chan)
{
- if (! ar9285_hw_clc(ah, chan))
+ if (AR_SREV_KITE(ah) && AR_SREV_KITE_10_OR_LATER(ah) &&
+ (! ar9285_hw_clc(ah, chan)))
return AH_FALSE;
return AH_TRUE;
OpenPOWER on IntegriCloud