Commit 4d70f2fb authored by Simon Wunderlich's avatar Simon Wunderlich Committed by John W. Linville

ath5k: enable support for 5 MHz and 10 MHz channels

Signed-off-by: default avatarSimon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: default avatarMathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6a09ae95
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/average.h> #include <linux/average.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include <net/cfg80211.h>
/* RX/TX descriptor hw structs /* RX/TX descriptor hw structs
* TODO: Driver part should only see sw structs */ * TODO: Driver part should only see sw structs */
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/nl80211.h> #include <linux/nl80211.h>
#include <net/cfg80211.h>
#include <net/ieee80211_radiotap.h> #include <net/ieee80211_radiotap.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
...@@ -443,11 +444,27 @@ ath5k_setup_bands(struct ieee80211_hw *hw) ...@@ -443,11 +444,27 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
* Called with ah->lock. * Called with ah->lock.
*/ */
int int
ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef)
{ {
ATH5K_DBG(ah, ATH5K_DEBUG_RESET, ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
"channel set, resetting (%u -> %u MHz)\n", "channel set, resetting (%u -> %u MHz)\n",
ah->curchan->center_freq, chan->center_freq); ah->curchan->center_freq, chandef->chan->center_freq);
switch (chandef->width) {
case NL80211_CHAN_WIDTH_20:
case NL80211_CHAN_WIDTH_20_NOHT:
ah->ah_bwmode = AR5K_BWMODE_DEFAULT;
break;
case NL80211_CHAN_WIDTH_5:
ah->ah_bwmode = AR5K_BWMODE_5MHZ;
break;
case NL80211_CHAN_WIDTH_10:
ah->ah_bwmode = AR5K_BWMODE_10MHZ;
break;
default:
WARN_ON(1);
return -EINVAL;
}
/* /*
* To switch channels clear any pending DMA operations; * To switch channels clear any pending DMA operations;
...@@ -455,7 +472,7 @@ ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) ...@@ -455,7 +472,7 @@ ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan)
* hardware at the new frequency, and then re-enable * hardware at the new frequency, and then re-enable
* the relevant bits of the h/w. * the relevant bits of the h/w.
*/ */
return ath5k_reset(ah, chan, true); return ath5k_reset(ah, chandef->chan, true);
} }
void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
...@@ -2525,6 +2542,8 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) ...@@ -2525,6 +2542,8 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
/* SW support for IBSS_RSN is provided by mac80211 */ /* SW support for IBSS_RSN is provided by mac80211 */
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ;
/* both antennas can be configured as RX or TX */ /* both antennas can be configured as RX or TX */
hw->wiphy->available_antennas_tx = 0x3; hw->wiphy->available_antennas_tx = 0x3;
hw->wiphy->available_antennas_rx = 0x3; hw->wiphy->available_antennas_rx = 0x3;
......
...@@ -101,7 +101,7 @@ void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable); ...@@ -101,7 +101,7 @@ void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable);
void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
int ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan); int ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef);
void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
......
...@@ -202,7 +202,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed) ...@@ -202,7 +202,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
mutex_lock(&ah->lock); mutex_lock(&ah->lock);
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
ret = ath5k_chan_set(ah, conf->chandef.chan); ret = ath5k_chan_set(ah, &conf->chandef);
if (ret < 0) if (ret < 0)
goto unlock; goto unlock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment