diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/base.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index ce67ab791eae..48161edec8de 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/etherdevice.h> | 56 | #include <linux/etherdevice.h> |
57 | #include <linux/nl80211.h> | 57 | #include <linux/nl80211.h> |
58 | 58 | ||
59 | #include <net/cfg80211.h> | ||
59 | #include <net/ieee80211_radiotap.h> | 60 | #include <net/ieee80211_radiotap.h> |
60 | 61 | ||
61 | #include <asm/unaligned.h> | 62 | #include <asm/unaligned.h> |
@@ -165,28 +166,36 @@ static const struct ieee80211_rate ath5k_rates[] = { | |||
165 | .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | 166 | .flags = IEEE80211_RATE_SHORT_PREAMBLE }, |
166 | { .bitrate = 60, | 167 | { .bitrate = 60, |
167 | .hw_value = ATH5K_RATE_CODE_6M, | 168 | .hw_value = ATH5K_RATE_CODE_6M, |
168 | .flags = 0 }, | 169 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
170 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
169 | { .bitrate = 90, | 171 | { .bitrate = 90, |
170 | .hw_value = ATH5K_RATE_CODE_9M, | 172 | .hw_value = ATH5K_RATE_CODE_9M, |
171 | .flags = 0 }, | 173 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
174 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
172 | { .bitrate = 120, | 175 | { .bitrate = 120, |
173 | .hw_value = ATH5K_RATE_CODE_12M, | 176 | .hw_value = ATH5K_RATE_CODE_12M, |
174 | .flags = 0 }, | 177 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
178 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
175 | { .bitrate = 180, | 179 | { .bitrate = 180, |
176 | .hw_value = ATH5K_RATE_CODE_18M, | 180 | .hw_value = ATH5K_RATE_CODE_18M, |
177 | .flags = 0 }, | 181 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
182 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
178 | { .bitrate = 240, | 183 | { .bitrate = 240, |
179 | .hw_value = ATH5K_RATE_CODE_24M, | 184 | .hw_value = ATH5K_RATE_CODE_24M, |
180 | .flags = 0 }, | 185 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
186 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
181 | { .bitrate = 360, | 187 | { .bitrate = 360, |
182 | .hw_value = ATH5K_RATE_CODE_36M, | 188 | .hw_value = ATH5K_RATE_CODE_36M, |
183 | .flags = 0 }, | 189 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
190 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
184 | { .bitrate = 480, | 191 | { .bitrate = 480, |
185 | .hw_value = ATH5K_RATE_CODE_48M, | 192 | .hw_value = ATH5K_RATE_CODE_48M, |
186 | .flags = 0 }, | 193 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
194 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
187 | { .bitrate = 540, | 195 | { .bitrate = 540, |
188 | .hw_value = ATH5K_RATE_CODE_54M, | 196 | .hw_value = ATH5K_RATE_CODE_54M, |
189 | .flags = 0 }, | 197 | .flags = IEEE80211_RATE_SUPPORTS_5MHZ | |
198 | IEEE80211_RATE_SUPPORTS_10MHZ }, | ||
190 | }; | 199 | }; |
191 | 200 | ||
192 | static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp) | 201 | static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp) |
@@ -435,11 +444,27 @@ ath5k_setup_bands(struct ieee80211_hw *hw) | |||
435 | * Called with ah->lock. | 444 | * Called with ah->lock. |
436 | */ | 445 | */ |
437 | int | 446 | int |
438 | ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) | 447 | ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef) |
439 | { | 448 | { |
440 | ATH5K_DBG(ah, ATH5K_DEBUG_RESET, | 449 | ATH5K_DBG(ah, ATH5K_DEBUG_RESET, |
441 | "channel set, resetting (%u -> %u MHz)\n", | 450 | "channel set, resetting (%u -> %u MHz)\n", |
442 | ah->curchan->center_freq, chan->center_freq); | 451 | ah->curchan->center_freq, chandef->chan->center_freq); |
452 | |||
453 | switch (chandef->width) { | ||
454 | case NL80211_CHAN_WIDTH_20: | ||
455 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
456 | ah->ah_bwmode = AR5K_BWMODE_DEFAULT; | ||
457 | break; | ||
458 | case NL80211_CHAN_WIDTH_5: | ||
459 | ah->ah_bwmode = AR5K_BWMODE_5MHZ; | ||
460 | break; | ||
461 | case NL80211_CHAN_WIDTH_10: | ||
462 | ah->ah_bwmode = AR5K_BWMODE_10MHZ; | ||
463 | break; | ||
464 | default: | ||
465 | WARN_ON(1); | ||
466 | return -EINVAL; | ||
467 | } | ||
443 | 468 | ||
444 | /* | 469 | /* |
445 | * To switch channels clear any pending DMA operations; | 470 | * To switch channels clear any pending DMA operations; |
@@ -447,7 +472,7 @@ ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) | |||
447 | * hardware at the new frequency, and then re-enable | 472 | * hardware at the new frequency, and then re-enable |
448 | * the relevant bits of the h/w. | 473 | * the relevant bits of the h/w. |
449 | */ | 474 | */ |
450 | return ath5k_reset(ah, chan, true); | 475 | return ath5k_reset(ah, chandef->chan, true); |
451 | } | 476 | } |
452 | 477 | ||
453 | void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | 478 | void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) |
@@ -1400,6 +1425,16 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb, | |||
1400 | 1425 | ||
1401 | rxs->rate_idx = ath5k_hw_to_driver_rix(ah, rs->rs_rate); | 1426 | rxs->rate_idx = ath5k_hw_to_driver_rix(ah, rs->rs_rate); |
1402 | rxs->flag |= ath5k_rx_decrypted(ah, skb, rs); | 1427 | rxs->flag |= ath5k_rx_decrypted(ah, skb, rs); |
1428 | switch (ah->ah_bwmode) { | ||
1429 | case AR5K_BWMODE_5MHZ: | ||
1430 | rxs->flag |= RX_FLAG_5MHZ; | ||
1431 | break; | ||
1432 | case AR5K_BWMODE_10MHZ: | ||
1433 | rxs->flag |= RX_FLAG_10MHZ; | ||
1434 | break; | ||
1435 | default: | ||
1436 | break; | ||
1437 | } | ||
1403 | 1438 | ||
1404 | if (rxs->rate_idx >= 0 && rs->rs_rate == | 1439 | if (rxs->rate_idx >= 0 && rs->rs_rate == |
1405 | ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short) | 1440 | ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short) |
@@ -2507,6 +2542,8 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) | |||
2507 | /* SW support for IBSS_RSN is provided by mac80211 */ | 2542 | /* SW support for IBSS_RSN is provided by mac80211 */ |
2508 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 2543 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
2509 | 2544 | ||
2545 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ; | ||
2546 | |||
2510 | /* both antennas can be configured as RX or TX */ | 2547 | /* both antennas can be configured as RX or TX */ |
2511 | hw->wiphy->available_antennas_tx = 0x3; | 2548 | hw->wiphy->available_antennas_tx = 0x3; |
2512 | hw->wiphy->available_antennas_rx = 0x3; | 2549 | hw->wiphy->available_antennas_rx = 0x3; |