Date: Tue, 10 May 2011 04:32:27 +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: r221722 - head/sys/dev/ath/ath_hal/ar9002 Message-ID: <201105100432.p4A4WRvM026664@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Tue May 10 04:32:27 2011 New Revision: 221722 URL: http://svn.freebsd.org/changeset/base/221722 Log: 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 Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c head/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Tue May 10 02:58:08 2011 (r221721) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Tue May 10 04:32:27 2011 (r221722) @@ -74,8 +74,33 @@ static void ar9285WriteIni(struct ath_ha 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 s 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 s } 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; Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Tue May 10 02:58:08 2011 (r221721) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Tue May 10 04:32:27 2011 (r221722) @@ -60,13 +60,13 @@ ar9285_hw_pa_cal(struct ath_hal *ah, HAL { 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 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105100432.p4A4WRvM026664>