aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath9k/hw.c79
1 files changed, 45 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index d4b7b63fa213..bde162f128ab 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -225,10 +225,10 @@ static enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah,
225 const struct ath9k_channel *chan) 225 const struct ath9k_channel *chan)
226{ 226{
227 if (IS_CHAN_CCK(chan)) 227 if (IS_CHAN_CCK(chan))
228 return WIRELESS_MODE_11b; 228 return ATH9K_MODE_11A;
229 if (IS_CHAN_G(chan)) 229 if (IS_CHAN_G(chan))
230 return WIRELESS_MODE_11g; 230 return ATH9K_MODE_11G;
231 return WIRELESS_MODE_11a; 231 return ATH9K_MODE_11A;
232} 232}
233 233
234static bool ath9k_hw_wait(struct ath_hal *ah, 234static bool ath9k_hw_wait(struct ath_hal *ah,
@@ -2416,7 +2416,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
2416 return; 2416 return;
2417 } else { 2417 } else {
2418 mode = ath9k_hw_chan2wmode(ah, chan); 2418 mode = ath9k_hw_chan2wmode(ah, chan);
2419 if (mode == WIRELESS_MODE_11g || mode == WIRELESS_MODE_11b) { 2419 if (mode == ATH9K_MODE_11G || mode == ATH9K_MODE_11B) {
2420 if (!aniState->ofdmWeakSigDetectOff) 2420 if (!aniState->ofdmWeakSigDetectOff)
2421 ath9k_hw_ani_control(ah, 2421 ath9k_hw_ani_control(ah,
2422 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, 2422 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
@@ -2462,7 +2462,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah)
2462 aniState->firstepLevel + 1); 2462 aniState->firstepLevel + 1);
2463 } else { 2463 } else {
2464 mode = ath9k_hw_chan2wmode(ah, chan); 2464 mode = ath9k_hw_chan2wmode(ah, chan);
2465 if (mode == WIRELESS_MODE_11g || mode == WIRELESS_MODE_11b) { 2465 if (mode == ATH9K_MODE_11G || mode == ATH9K_MODE_11B) {
2466 if (aniState->firstepLevel > 0) 2466 if (aniState->firstepLevel > 0)
2467 ath9k_hw_ani_control(ah, 2467 ath9k_hw_ani_control(ah,
2468 ATH9K_ANI_FIRSTEP_LEVEL, 2468 ATH9K_ANI_FIRSTEP_LEVEL,
@@ -2970,29 +2970,40 @@ static bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
2970 ah->ah_currentRD); 2970 ah->ah_currentRD);
2971 } 2971 }
2972 2972
2973 pCap->wireless_modes = 0;
2974 eeval = ath9k_hw_get_eeprom(ahp, EEP_OP_MODE); 2973 eeval = ath9k_hw_get_eeprom(ahp, EEP_OP_MODE);
2974 bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX);
2975 2975
2976 if (eeval & AR5416_OPFLAGS_11A) { 2976 if (eeval & AR5416_OPFLAGS_11A) {
2977 pCap->wireless_modes |= ATH9K_MODE_SEL_11A | 2977 set_bit(ATH9K_MODE_11A, pCap->wireless_modes);
2978 ((!ah->ah_config.ht_enable 2978 if (ah->ah_config.ht_enable) {
2979 || (eeval & AR5416_OPFLAGS_N_5G_HT20)) ? 0 2979 if (!(eeval & AR5416_OPFLAGS_N_5G_HT20))
2980 : (ATH9K_MODE_SEL_11NA_HT20 | 2980 set_bit(ATH9K_MODE_11NA_HT20,
2981 ((eeval & AR5416_OPFLAGS_N_5G_HT40) ? 0 2981 pCap->wireless_modes);
2982 : (ATH9K_MODE_SEL_11NA_HT40PLUS | 2982 if (!(eeval & AR5416_OPFLAGS_N_5G_HT40)) {
2983 ATH9K_MODE_SEL_11NA_HT40MINUS)))); 2983 set_bit(ATH9K_MODE_11NA_HT40PLUS,
2984 pCap->wireless_modes);
2985 set_bit(ATH9K_MODE_11NA_HT40MINUS,
2986 pCap->wireless_modes);
2987 }
2988 }
2984 } 2989 }
2985 if (eeval & AR5416_OPFLAGS_11G) {
2986 pCap->wireless_modes |=
2987 ATH9K_MODE_SEL_11B | ATH9K_MODE_SEL_11G |
2988 ((!ah->ah_config.ht_enable
2989 || (eeval & AR5416_OPFLAGS_N_2G_HT20)) ? 0
2990 : (ATH9K_MODE_SEL_11NG_HT20 |
2991 ((eeval & AR5416_OPFLAGS_N_2G_HT40) ? 0
2992 : (ATH9K_MODE_SEL_11NG_HT40PLUS |
2993 ATH9K_MODE_SEL_11NG_HT40MINUS))));
2994 2990
2991 if (eeval & AR5416_OPFLAGS_11G) {
2992 set_bit(ATH9K_MODE_11B, pCap->wireless_modes);
2993 set_bit(ATH9K_MODE_11G, pCap->wireless_modes);
2994 if (ah->ah_config.ht_enable) {
2995 if (!(eeval & AR5416_OPFLAGS_N_2G_HT20))
2996 set_bit(ATH9K_MODE_11NG_HT20,
2997 pCap->wireless_modes);
2998 if (!(eeval & AR5416_OPFLAGS_N_2G_HT40)) {
2999 set_bit(ATH9K_MODE_11NG_HT40PLUS,
3000 pCap->wireless_modes);
3001 set_bit(ATH9K_MODE_11NG_HT40MINUS,
3002 pCap->wireless_modes);
3003 }
3004 }
2995 } 3005 }
3006
2996 pCap->tx_chainmask = ath9k_hw_get_eeprom(ahp, EEP_TX_MASK); 3007 pCap->tx_chainmask = ath9k_hw_get_eeprom(ahp, EEP_TX_MASK);
2997 if ((ah->ah_isPciExpress) 3008 if ((ah->ah_isPciExpress)
2998 || (eeval & AR5416_OPFLAGS_11A)) { 3009 || (eeval & AR5416_OPFLAGS_11A)) {
@@ -5213,7 +5224,7 @@ static u32 ath9k_hw_mac_usec(struct ath_hal *ah, u32 clks)
5213 return clks / 5224 return clks /
5214 CLOCK_RATE[ath9k_hw_chan2wmode(ah, ah->ah_curchan)]; 5225 CLOCK_RATE[ath9k_hw_chan2wmode(ah, ah->ah_curchan)];
5215 else 5226 else
5216 return clks / CLOCK_RATE[WIRELESS_MODE_11b]; 5227 return clks / CLOCK_RATE[ATH9K_MODE_11B];
5217} 5228}
5218 5229
5219static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks) 5230static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks)
@@ -5232,7 +5243,7 @@ static u32 ath9k_hw_mac_clks(struct ath_hal *ah, u32 usecs)
5232 return usecs * CLOCK_RATE[ath9k_hw_chan2wmode(ah, 5243 return usecs * CLOCK_RATE[ath9k_hw_chan2wmode(ah,
5233 ah->ah_curchan)]; 5244 ah->ah_curchan)];
5234 else 5245 else
5235 return usecs * CLOCK_RATE[WIRELESS_MODE_11b]; 5246 return usecs * CLOCK_RATE[ATH9K_MODE_11B];
5236} 5247}
5237 5248
5238static u32 ath9k_hw_mac_to_clks(struct ath_hal *ah, u32 usecs) 5249static u32 ath9k_hw_mac_to_clks(struct ath_hal *ah, u32 usecs)
@@ -5924,7 +5935,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, enum ath9k_opmode opmode,
5924 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, 5935 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
5925 AR_GPIO_JTAG_DISABLE); 5936 AR_GPIO_JTAG_DISABLE);
5926 5937
5927 if (ah->ah_caps.wireless_modes & ATH9K_MODE_SEL_11A) { 5938 if (test_bit(ATH9K_MODE_11A, ah->ah_caps.wireless_modes)) {
5928 if (IS_CHAN_5GHZ(chan)) 5939 if (IS_CHAN_5GHZ(chan))
5929 ath9k_hw_set_gpio(ah, 9, 0); 5940 ath9k_hw_set_gpio(ah, 9, 0);
5930 else 5941 else
@@ -8238,23 +8249,23 @@ const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah,
8238{ 8249{
8239 struct ath9k_rate_table *rt; 8250 struct ath9k_rate_table *rt;
8240 switch (mode) { 8251 switch (mode) {
8241 case ATH9K_MODE_SEL_11A: 8252 case ATH9K_MODE_11A:
8242 rt = &ar5416_11a_table; 8253 rt = &ar5416_11a_table;
8243 break; 8254 break;
8244 case ATH9K_MODE_SEL_11B: 8255 case ATH9K_MODE_11B:
8245 rt = &ar5416_11b_table; 8256 rt = &ar5416_11b_table;
8246 break; 8257 break;
8247 case ATH9K_MODE_SEL_11G: 8258 case ATH9K_MODE_11G:
8248 rt = &ar5416_11g_table; 8259 rt = &ar5416_11g_table;
8249 break; 8260 break;
8250 case ATH9K_MODE_SEL_11NG_HT20: 8261 case ATH9K_MODE_11NG_HT20:
8251 case ATH9K_MODE_SEL_11NG_HT40PLUS: 8262 case ATH9K_MODE_11NG_HT40PLUS:
8252 case ATH9K_MODE_SEL_11NG_HT40MINUS: 8263 case ATH9K_MODE_11NG_HT40MINUS:
8253 rt = &ar5416_11ng_table; 8264 rt = &ar5416_11ng_table;
8254 break; 8265 break;
8255 case ATH9K_MODE_SEL_11NA_HT20: 8266 case ATH9K_MODE_11NA_HT20:
8256 case ATH9K_MODE_SEL_11NA_HT40PLUS: 8267 case ATH9K_MODE_11NA_HT40PLUS:
8257 case ATH9K_MODE_SEL_11NA_HT40MINUS: 8268 case ATH9K_MODE_11NA_HT40MINUS:
8258 rt = &ar5416_11na_table; 8269 rt = &ar5416_11na_table;
8259 break; 8270 break;
8260 default: 8271 default: