diff options
-rw-r--r-- | drivers/net/wireless/ath/ath.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ani.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 32 |
3 files changed, 23 insertions, 37 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index cee0191704f5..b36d9d770ff1 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -145,6 +145,8 @@ struct ath_common { | |||
145 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); | 145 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); |
146 | enum ath_crypt_caps crypt_caps; | 146 | enum ath_crypt_caps crypt_caps; |
147 | 147 | ||
148 | unsigned int clockrate; | ||
149 | |||
148 | struct ath_regulatory regulatory; | 150 | struct ath_regulatory regulatory; |
149 | const struct ath_ops *ops; | 151 | const struct ath_ops *ops; |
150 | const struct ath_bus_ops *bus_ops; | 152 | const struct ath_bus_ops *bus_ops; |
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index f2a907b4acb8..f2aa68405d2f 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -465,35 +465,13 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) | |||
465 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1); | 465 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1); |
466 | } | 466 | } |
467 | 467 | ||
468 | static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah) | ||
469 | { | ||
470 | struct ath9k_channel *chan = ah->curchan; | ||
471 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; | ||
472 | u8 clockrate; /* in MHz */ | ||
473 | |||
474 | if (!ah->curchan) /* should really check for CCK instead */ | ||
475 | clockrate = ATH9K_CLOCK_RATE_CCK; | ||
476 | else if (conf->channel->band == IEEE80211_BAND_2GHZ) | ||
477 | clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; | ||
478 | else if (IS_CHAN_A_FAST_CLOCK(ah, chan)) | ||
479 | clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM; | ||
480 | else | ||
481 | clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; | ||
482 | |||
483 | if (conf_is_ht40(conf)) | ||
484 | return clockrate * 2; | ||
485 | |||
486 | return clockrate; | ||
487 | } | ||
488 | |||
489 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) | 468 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) |
490 | { | 469 | { |
470 | struct ath_common *common = ath9k_hw_common(ah); | ||
491 | int32_t listen_time; | 471 | int32_t listen_time; |
492 | int32_t clock_rate; | ||
493 | 472 | ||
494 | ath9k_hw_update_cycle_counters(ah); | 473 | ath9k_hw_update_cycle_counters(ah); |
495 | clock_rate = ath9k_hw_chan_2_clockrate_mhz(ah) * 1000; | 474 | listen_time = ah->listen_time / (common->clockrate * 1000); |
496 | listen_time = ah->listen_time / clock_rate; | ||
497 | ah->listen_time = 0; | 475 | ah->listen_time = 0; |
498 | 476 | ||
499 | return listen_time; | 477 | return listen_time; |
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++) |