ath5k: Add Spur filter support on newer chips
PATCH 7/7 ath5k: Add Spur filter support on newer chips
*Add spur filter support for RF5413 and later chips
Can someone test this ? I moved to Athens and i forgot to take the RF2425 with me... It should be ok as it comes from HAL sources.
Signed-off-by Nick Kossifidis <[email protected]>
--- drivers/net/wireless/ath/ath5k/ath5k.h | 5 + drivers/net/wireless/ath/ath5k/phy.c | 255 +++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath5k/reset.c | 35 ++--- 3 files changed, 270 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +5 -0
@@ -1278,6 +1278,11 @@ extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *chann/* PHY calibration */ extern int ath5k_hw_phy_calibrate (struct ath5k_hw *ah,struct ieee80211_channel *channel);extern int ath5k_hw_noise_floor_calibration (struct ath5k_hw *ah,short freq); +/* Spur mitigation */ +bool ath5k_hw_chan_has_spur_noise (struct ath5k_hw *ah, +struct ieee80211_channel *channel); +void ath5k_hw_set_spur_mitigation_filter (struct ath5k_hw *ah, +struct ieee80211_channel *channel);/* Misc PHY functions */ extern u16 ath5k_hw_radio_revision (struct ath5k_hw *ah,unsigned int chan);extern int ath5k_hw_phy_disable (struct ath5k_hw *ah);
drivers/net/wireless/ath/ath5k/phy.c +251 -4
267 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reset.c +14 -21
@@ -537,26 +537,6 @@ static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)return ; } -static bool ath5k_hw_chan_has_spur_noise (struct ath5k_hw *ah, -struct ieee80211_channel *channel) -{ -u8 refclk_freq; - -if ((ah->ah_radio ==AR5K_RF5112 ) || - (ah->ah_radio ==AR5K_RF5413 ) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >>4 ))) - refclk_freq =40 ; -else - refclk_freq =32 ; - -if ((channel->center_freq % refclk_freq !=0 ) && - ((channel->center_freq % refclk_freq <10 ) || - (channel->center_freq % refclk_freq >22 ))) -return true; -else -return false; -} -/* TODO: Half/Quarter rate */ static void ath5k_hw_tweak_initval_settings (struct ath5k_hw *ah,struct ieee80211_channel *channel)
@@ -999,7 +979,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,ath5k_hw_tweak_initval_settings (ah, channel);/* -* Set TX power (FIXME) +* Set TX power */ ret =ath5k_hw_txpower (ah, channel, ee_mode, ah->ah_txpower.txp_max_pwr /2 );
@@ -1025,9 +1005,22 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,/* Write OFDM timings on 5212*/ if (ah->ah_version ==AR5K_AR5212 && channel->hw_value &CHANNEL_OFDM ) { +struct ath5k_eeprom_info *ee = + &ah->ah_capabilities.cap_eeprom; + ret =ath5k_hw_write_ofdm_timings (ah, channel);if (ret)return ret; + +/* Note: According to docs we can have a newer +* EEPROM on old hardware, so we need to verify +* that our hardware is new enough to have spur +* mitigation registers (delta phase etc) */ +if (ah->ah_mac_srev >=AR5K_SREV_AR5424 || + (ah->ah_mac_srev >=AR5K_SREV_AR5424 && + ee->ee_version >=AR5K_EEPROM_VERSION_5_3 )) +ath5k_hw_set_spur_mitigation_filter (ah, + channel); }/*Enable/disable 802.11b mode on 5111