Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath5k: enable support for 5 MHz and 10 MHz channels

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Simon Wunderlich and committed by
John W. Linville
4d70f2fb 6a09ae95

+25 -5
+1
drivers/net/wireless/ath/ath5k/ath5k.h
··· 29 29 #include <linux/average.h> 30 30 #include <linux/leds.h> 31 31 #include <net/mac80211.h> 32 + #include <net/cfg80211.h> 32 33 33 34 /* RX/TX descriptor hw structs 34 35 * TODO: Driver part should only see sw structs */
+22 -3
drivers/net/wireless/ath/ath5k/base.c
··· 56 56 #include <linux/etherdevice.h> 57 57 #include <linux/nl80211.h> 58 58 59 + #include <net/cfg80211.h> 59 60 #include <net/ieee80211_radiotap.h> 60 61 61 62 #include <asm/unaligned.h> ··· 444 443 * Called with ah->lock. 445 444 */ 446 445 int 447 - ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) 446 + ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef) 448 447 { 449 448 ATH5K_DBG(ah, ATH5K_DEBUG_RESET, 450 449 "channel set, resetting (%u -> %u MHz)\n", 451 - ah->curchan->center_freq, chan->center_freq); 450 + ah->curchan->center_freq, chandef->chan->center_freq); 451 + 452 + switch (chandef->width) { 453 + case NL80211_CHAN_WIDTH_20: 454 + case NL80211_CHAN_WIDTH_20_NOHT: 455 + ah->ah_bwmode = AR5K_BWMODE_DEFAULT; 456 + break; 457 + case NL80211_CHAN_WIDTH_5: 458 + ah->ah_bwmode = AR5K_BWMODE_5MHZ; 459 + break; 460 + case NL80211_CHAN_WIDTH_10: 461 + ah->ah_bwmode = AR5K_BWMODE_10MHZ; 462 + break; 463 + default: 464 + WARN_ON(1); 465 + return -EINVAL; 466 + } 452 467 453 468 /* 454 469 * To switch channels clear any pending DMA operations; ··· 472 455 * hardware at the new frequency, and then re-enable 473 456 * the relevant bits of the h/w. 474 457 */ 475 - return ath5k_reset(ah, chan, true); 458 + return ath5k_reset(ah, chandef->chan, true); 476 459 } 477 460 478 461 void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) ··· 2541 2524 2542 2525 /* SW support for IBSS_RSN is provided by mac80211 */ 2543 2526 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; 2527 + 2528 + hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ; 2544 2529 2545 2530 /* both antennas can be configured as RX or TX */ 2546 2531 hw->wiphy->available_antennas_tx = 0x3;
+1 -1
drivers/net/wireless/ath/ath5k/base.h
··· 101 101 102 102 void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, 103 103 struct ieee80211_vif *vif); 104 - int ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan); 104 + int ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef); 105 105 void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); 106 106 void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); 107 107 void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
+1 -1
drivers/net/wireless/ath/ath5k/mac80211-ops.c
··· 202 202 mutex_lock(&ah->lock); 203 203 204 204 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 205 - ret = ath5k_chan_set(ah, conf->chandef.chan); 205 + ret = ath5k_chan_set(ah, &conf->chandef); 206 206 if (ret < 0) 207 207 goto unlock; 208 208 }