diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-12-23 18:58:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:34 -0500 |
commit | 4febf7b8f4f2c7052cffbccba9e5ddf041b41330 (patch) | |
tree | bb0e3ef9cb84d92f8bc85680630e6c3d58788ffb /drivers/net/wireless/ath9k/hw.c | |
parent | e56db718468416ce5ff1ba05e7fa5026424befd5 (diff) |
ath9k: remove ath9k_hw_chan2wmode()
The only left users are for timing for ACK timeout, slotime and
CTS timeout. We currently use an array CLOCK_RATE to keep
these values per mode and since as only will use A and G
we can depend on the band to get the appropriate values.
We note that we should be using a different clock rate value
for CCK, we can do this in separate patch, currently this is
being disregarded and should only affect when we want to
change the default ACK/CTS timeout or slot time and stuck
with using using 802.11b.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 46029ec13545..08b9a0d421b8 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -23,7 +23,9 @@ | |||
23 | #include "phy.h" | 23 | #include "phy.h" |
24 | #include "initvals.h" | 24 | #include "initvals.h" |
25 | 25 | ||
26 | static const u8 CLOCK_RATE[] = { 40, 80, 22, 44, 88, 40 }; | 26 | #define ATH9K_CLOCK_RATE_CCK 22 |
27 | #define ATH9K_CLOCK_RATE_5GHZ_OFDM 40 | ||
28 | #define ATH9K_CLOCK_RATE_2GHZ_OFDM 44 | ||
27 | 29 | ||
28 | extern struct hal_percal_data iq_cal_multi_sample; | 30 | extern struct hal_percal_data iq_cal_multi_sample; |
29 | extern struct hal_percal_data iq_cal_single_sample; | 31 | extern struct hal_percal_data iq_cal_single_sample; |
@@ -48,17 +50,18 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha | |||
48 | 50 | ||
49 | static u32 ath9k_hw_mac_usec(struct ath_hal *ah, u32 clks) | 51 | static u32 ath9k_hw_mac_usec(struct ath_hal *ah, u32 clks) |
50 | { | 52 | { |
51 | if (ah->ah_curchan != NULL) | 53 | struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; |
52 | return clks / CLOCK_RATE[ath9k_hw_chan2wmode(ah, ah->ah_curchan)]; | 54 | if (!ah->ah_curchan) /* should really check for CCK instead */ |
53 | else | 55 | return clks / ATH9K_CLOCK_RATE_CCK; |
54 | return clks / CLOCK_RATE[ATH9K_MODE_11B]; | 56 | if (conf->channel->band == IEEE80211_BAND_2GHZ) |
57 | return clks / ATH9K_CLOCK_RATE_2GHZ_OFDM; | ||
58 | return clks / ATH9K_CLOCK_RATE_5GHZ_OFDM; | ||
55 | } | 59 | } |
56 | 60 | ||
57 | static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks) | 61 | static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks) |
58 | { | 62 | { |
59 | struct ath9k_channel *chan = ah->ah_curchan; | 63 | struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; |
60 | 64 | if (conf_is_ht40(conf)) | |
61 | if (chan && IS_CHAN_HT40(chan)) | ||
62 | return ath9k_hw_mac_usec(ah, clks) / 2; | 65 | return ath9k_hw_mac_usec(ah, clks) / 2; |
63 | else | 66 | else |
64 | return ath9k_hw_mac_usec(ah, clks); | 67 | return ath9k_hw_mac_usec(ah, clks); |
@@ -66,34 +69,23 @@ static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks) | |||
66 | 69 | ||
67 | static u32 ath9k_hw_mac_clks(struct ath_hal *ah, u32 usecs) | 70 | static u32 ath9k_hw_mac_clks(struct ath_hal *ah, u32 usecs) |
68 | { | 71 | { |
69 | if (ah->ah_curchan != NULL) | 72 | struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; |
70 | return usecs * CLOCK_RATE[ath9k_hw_chan2wmode(ah, | 73 | if (!ah->ah_curchan) /* should really check for CCK instead */ |
71 | ah->ah_curchan)]; | 74 | return usecs *ATH9K_CLOCK_RATE_CCK; |
72 | else | 75 | if (conf->channel->band == IEEE80211_BAND_2GHZ) |
73 | return usecs * CLOCK_RATE[ATH9K_MODE_11B]; | 76 | return usecs *ATH9K_CLOCK_RATE_2GHZ_OFDM; |
77 | return usecs *ATH9K_CLOCK_RATE_5GHZ_OFDM; | ||
74 | } | 78 | } |
75 | 79 | ||
76 | static u32 ath9k_hw_mac_to_clks(struct ath_hal *ah, u32 usecs) | 80 | static u32 ath9k_hw_mac_to_clks(struct ath_hal *ah, u32 usecs) |
77 | { | 81 | { |
78 | struct ath9k_channel *chan = ah->ah_curchan; | 82 | struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; |
79 | 83 | if (conf_is_ht40(conf)) | |
80 | if (chan && IS_CHAN_HT40(chan)) | ||
81 | return ath9k_hw_mac_clks(ah, usecs) * 2; | 84 | return ath9k_hw_mac_clks(ah, usecs) * 2; |
82 | else | 85 | else |
83 | return ath9k_hw_mac_clks(ah, usecs); | 86 | return ath9k_hw_mac_clks(ah, usecs); |
84 | } | 87 | } |
85 | 88 | ||
86 | enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah, | ||
87 | const struct ath9k_channel *chan) | ||
88 | { | ||
89 | if (IS_CHAN_B(chan)) | ||
90 | return ATH9K_MODE_11B; | ||
91 | if (IS_CHAN_G(chan)) | ||
92 | return ATH9K_MODE_11G; | ||
93 | |||
94 | return ATH9K_MODE_11A; | ||
95 | } | ||
96 | |||
97 | bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val) | 89 | bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val) |
98 | { | 90 | { |
99 | int i; | 91 | int i; |