diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 05e9935ef160..cc13ee117823 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++) |
@@ -1794,37 +1800,11 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
1794 | return -EINVAL; | 1800 | return -EINVAL; |
1795 | } | 1801 | } |
1796 | 1802 | ||
1797 | bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX); | 1803 | if (eeval & AR5416_OPFLAGS_11A) |
1798 | 1804 | pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; | |
1799 | if (eeval & AR5416_OPFLAGS_11A) { | ||
1800 | set_bit(ATH9K_MODE_11A, pCap->wireless_modes); | ||
1801 | if (ah->config.ht_enable) { | ||
1802 | if (!(eeval & AR5416_OPFLAGS_N_5G_HT20)) | ||
1803 | set_bit(ATH9K_MODE_11NA_HT20, | ||
1804 | pCap->wireless_modes); | ||
1805 | if (!(eeval & AR5416_OPFLAGS_N_5G_HT40)) { | ||
1806 | set_bit(ATH9K_MODE_11NA_HT40PLUS, | ||
1807 | pCap->wireless_modes); | ||
1808 | set_bit(ATH9K_MODE_11NA_HT40MINUS, | ||
1809 | pCap->wireless_modes); | ||
1810 | } | ||
1811 | } | ||
1812 | } | ||
1813 | 1805 | ||
1814 | if (eeval & AR5416_OPFLAGS_11G) { | 1806 | if (eeval & AR5416_OPFLAGS_11G) |
1815 | set_bit(ATH9K_MODE_11G, pCap->wireless_modes); | 1807 | pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; |
1816 | if (ah->config.ht_enable) { | ||
1817 | if (!(eeval & AR5416_OPFLAGS_N_2G_HT20)) | ||
1818 | set_bit(ATH9K_MODE_11NG_HT20, | ||
1819 | pCap->wireless_modes); | ||
1820 | if (!(eeval & AR5416_OPFLAGS_N_2G_HT40)) { | ||
1821 | set_bit(ATH9K_MODE_11NG_HT40PLUS, | ||
1822 | pCap->wireless_modes); | ||
1823 | set_bit(ATH9K_MODE_11NG_HT40MINUS, | ||
1824 | pCap->wireless_modes); | ||
1825 | } | ||
1826 | } | ||
1827 | } | ||
1828 | 1808 | ||
1829 | pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); | 1809 | pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); |
1830 | /* | 1810 | /* |