diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-07-19 02:46:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-21 14:52:04 -0400 |
commit | 6054069a03f77ffa686e2dfd5f07cff8ee40b72d (patch) | |
tree | 9ffb02904f2108423c784a5f67834ee8562ad5eb /drivers/net/wireless/ath | |
parent | a0490936007bacf5bf6f4fb27788550c89c2c70d (diff) |
ath9k_hw: validate and fix broken eeprom chainmask settings
Some devices (e.g. Ubiquiti AirRouter) ship with broken EEPROM chainmask
data, which breaks the initial calibration after a hardware reset.
To fix this, mask the eeprom chainmask with the chainmask of the chip,
and use the chip chainmask if the result is zero.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 2a5f908d8037..8006ce0c7357 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1997,12 +1997,22 @@ EXPORT_SYMBOL(ath9k_hw_set_sta_beacon_timers); | |||
1997 | /* HW Capabilities */ | 1997 | /* HW Capabilities */ |
1998 | /*******************/ | 1998 | /*******************/ |
1999 | 1999 | ||
2000 | static u8 fixup_chainmask(u8 chip_chainmask, u8 eeprom_chainmask) | ||
2001 | { | ||
2002 | eeprom_chainmask &= chip_chainmask; | ||
2003 | if (eeprom_chainmask) | ||
2004 | return eeprom_chainmask; | ||
2005 | else | ||
2006 | return chip_chainmask; | ||
2007 | } | ||
2008 | |||
2000 | int ath9k_hw_fill_cap_info(struct ath_hw *ah) | 2009 | int ath9k_hw_fill_cap_info(struct ath_hw *ah) |
2001 | { | 2010 | { |
2002 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 2011 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
2003 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | 2012 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); |
2004 | struct ath_common *common = ath9k_hw_common(ah); | 2013 | struct ath_common *common = ath9k_hw_common(ah); |
2005 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; | 2014 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; |
2015 | unsigned int chip_chainmask; | ||
2006 | 2016 | ||
2007 | u16 eeval; | 2017 | u16 eeval; |
2008 | u8 ant_div_ctl1, tx_chainmask, rx_chainmask; | 2018 | u8 ant_div_ctl1, tx_chainmask, rx_chainmask; |
@@ -2039,6 +2049,15 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2039 | if (eeval & AR5416_OPFLAGS_11G) | 2049 | if (eeval & AR5416_OPFLAGS_11G) |
2040 | pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; | 2050 | pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; |
2041 | 2051 | ||
2052 | if (AR_SREV_9485(ah) || AR_SREV_9285(ah) || AR_SREV_9330(ah)) | ||
2053 | chip_chainmask = 1; | ||
2054 | else if (!AR_SREV_9280_20_OR_LATER(ah)) | ||
2055 | chip_chainmask = 7; | ||
2056 | else if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9340(ah)) | ||
2057 | chip_chainmask = 3; | ||
2058 | else | ||
2059 | chip_chainmask = 7; | ||
2060 | |||
2042 | pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); | 2061 | pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); |
2043 | /* | 2062 | /* |
2044 | * For AR9271 we will temporarilly uses the rx chainmax as read from | 2063 | * For AR9271 we will temporarilly uses the rx chainmax as read from |
@@ -2055,6 +2074,9 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2055 | /* Use rx_chainmask from EEPROM. */ | 2074 | /* Use rx_chainmask from EEPROM. */ |
2056 | pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); | 2075 | pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); |
2057 | 2076 | ||
2077 | pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); | ||
2078 | pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); | ||
2079 | |||
2058 | ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; | 2080 | ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; |
2059 | 2081 | ||
2060 | /* enable key search for every frame in an aggregate */ | 2082 | /* enable key search for every frame in an aggregate */ |