diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 05e9935ef160..f5d79177770c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -88,29 +88,32 @@ static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah) | |||
88 | /* Helper Functions */ | 88 | /* Helper Functions */ |
89 | /********************/ | 89 | /********************/ |
90 | 90 | ||
91 | static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs) | 91 | static void ath9k_hw_set_clockrate(struct ath_hw *ah) |
92 | { | 92 | { |
93 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; | 93 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; |
94 | struct ath_common *common = ath9k_hw_common(ah); | ||
95 | unsigned int clockrate; | ||
94 | 96 | ||
95 | if (!ah->curchan) /* should really check for CCK instead */ | 97 | if (!ah->curchan) /* should really check for CCK instead */ |
96 | return usecs *ATH9K_CLOCK_RATE_CCK; | 98 | clockrate = ATH9K_CLOCK_RATE_CCK; |
97 | if (conf->channel->band == IEEE80211_BAND_2GHZ) | 99 | else if (conf->channel->band == IEEE80211_BAND_2GHZ) |
98 | return usecs *ATH9K_CLOCK_RATE_2GHZ_OFDM; | 100 | clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; |
99 | 101 | else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK) | |
100 | if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK) | 102 | clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM; |
101 | return usecs * ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM; | ||
102 | else | 103 | else |
103 | return usecs * ATH9K_CLOCK_RATE_5GHZ_OFDM; | 104 | clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; |
105 | |||
106 | if (conf_is_ht40(conf)) | ||
107 | clockrate *= 2; | ||
108 | |||
109 | common->clockrate = clockrate; | ||
104 | } | 110 | } |
105 | 111 | ||
106 | static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs) | 112 | static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs) |
107 | { | 113 | { |
108 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; | 114 | struct ath_common *common = ath9k_hw_common(ah); |
109 | 115 | ||
110 | if (conf_is_ht40(conf)) | 116 | return usecs * common->clockrate; |
111 | return ath9k_hw_mac_clks(ah, usecs) * 2; | ||
112 | else | ||
113 | return ath9k_hw_mac_clks(ah, usecs); | ||
114 | } | 117 | } |
115 | 118 | ||
116 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout) | 119 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout) |
@@ -1156,6 +1159,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1156 | "Failed to set channel\n"); | 1159 | "Failed to set channel\n"); |
1157 | return false; | 1160 | return false; |
1158 | } | 1161 | } |
1162 | ath9k_hw_set_clockrate(ah); | ||
1159 | 1163 | ||
1160 | ah->eep_ops->set_txpower(ah, chan, | 1164 | ah->eep_ops->set_txpower(ah, chan, |
1161 | ath9k_regd_get_ctl(regulatory, chan), | 1165 | ath9k_regd_get_ctl(regulatory, chan), |
@@ -1368,6 +1372,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1368 | if (r) | 1372 | if (r) |
1369 | return r; | 1373 | return r; |
1370 | 1374 | ||
1375 | ath9k_hw_set_clockrate(ah); | ||
1376 | |||
1371 | ENABLE_REGWRITE_BUFFER(ah); | 1377 | ENABLE_REGWRITE_BUFFER(ah); |
1372 | 1378 | ||
1373 | for (i = 0; i < AR_NUM_DCU; i++) | 1379 | for (i = 0; i < AR_NUM_DCU; i++) |