From a2816e3bed5782537b0c8e30da147b0d61e3fb25 Mon Sep 17 00:00:00 2001 From: adrian Date: Sun, 8 May 2011 15:55:52 +0000 Subject: Fix the 5ghz fast clock logic. The macro which I incorrectly copied into ah_internal.h assumed that it'd be called with an AR_SREV_MERLIN_20() check to ensure it was only enabled for Merlin (AR9280) silicon revision 2.0 or later. Trouble is, the 5GHz fast clock EEPROM flag is only valid for EEPROM revision 16 or greater; it's assumed to be enabled by default for Merlin rev >= 2.0. This meant it'd be incorrectly set for AR5416 and AR9160 in 5GHz mode. This would have affected non-default clock timings such as SIFS, ACK and slot time. The incorrect slot time was very likely wrong for 5ghz mode. --- sys/dev/ath/ath_hal/ah_internal.h | 18 +++++++++++++++--- sys/dev/ath/ath_hal/ar9002/ar9280_attach.c | 8 +++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h index c4ffe74..1dd8dcd 100644 --- a/sys/dev/ath/ath_hal/ah_internal.h +++ b/sys/dev/ath/ath_hal/ah_internal.h @@ -205,7 +205,8 @@ typedef struct { halMbssidAggrSupport : 1, halBssidMatchSupport : 1, hal4kbSplitTransSupport : 1, - halHasRxSelfLinkedTail : 1; + halHasRxSelfLinkedTail : 1, + halSupportsFastClock5GHz : 1; /* Hardware supports 5ghz fast clock; check eeprom/channel before using */ uint32_t halWirelessModes; uint16_t halTotalQueues; uint16_t halKeyCacheSize; @@ -807,10 +808,21 @@ extern HAL_BOOL ath_ee_FillVpdTable(uint8_t pwrMin, uint8_t pwrMax, extern int16_t ath_ee_interpolate(uint16_t target, uint16_t srcLeft, uint16_t srcRight, int16_t targetLeft, int16_t targetRight); -/* Whether 5ghz fast clock is needed for Merlin and later */ +/* Whether 5ghz fast clock is needed */ +/* + * The chipset (Merlin, AR9300/later) should set the capability flag below; + * this flag simply says that the hardware can do it, not that the EEPROM + * says it can. + * + * Merlin 2.0/2.1 chips with an EEPROM version > 16 do 5ghz fast clock + * if the relevant eeprom flag is set. + * Merlin 2.0/2.1 chips with an EEPROM version <= 16 do 5ghz fast clock + * by default. + */ #define IS_5GHZ_FAST_CLOCK_EN(_ah, _c) \ (IEEE80211_IS_CHAN_5GHZ(_c) && \ - ath_hal_eepromGetFlag(ah, AR_EEP_FSTCLK_5G)) + AH_PRIVATE((_ah))->ah_caps.halSupportsFastClock5GHz && \ + ath_hal_eepromGetFlag((_ah), AR_EEP_FSTCLK_5G)) #endif /* _ATH_AH_INTERAL_H_ */ diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c index 5e44cc5..b4aaa7b 100644 --- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c +++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c @@ -787,8 +787,14 @@ ar9280FillCapabilityInfo(struct ath_hal *ah) pCap->halMbssidAggrSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_TRUE; - if (AR_SREV_MERLIN_20_OR_LATER(ah)) + if (AR_SREV_MERLIN_20(ah)) { pCap->halPSPollBroken = AH_FALSE; + /* + * This just enables the support; it doesn't + * state 5ghz fast clock will always be used. + */ + pCap->halSupportsFastClock5GHz = AH_TRUE; + } pCap->halRxStbcSupport = 1; pCap->halTxStbcSupport = 1; -- cgit v1.1