aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 17:07:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 17:07:15 -0400
commitd2aa4550379f92e929af7ed1dd4f55e6a1e331f8 (patch)
tree5ef0fc69a507f0d701fd157b6652427eabd5efdd /drivers/net/wireless
parent9e3e4b1d2d13bead8d52703c82a02b55f108b491 (diff)
parentcb2107be43d2fc5eadec58b92b54bf32c00bfff3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (55 commits) netxen: fix tx ring accounting netxen: fix detection of cut-thru firmware mode forcedeth: fix dma api mismatches atm: sk_wmem_alloc initial value is one net: correct off-by-one write allocations reports via-velocity : fix no link detection on boot Net / e100: Fix suspend of devices that cannot be power managed TI DaVinci EMAC : Fix rmmod error net: group address list and its count ipv4: Fix fib_trie rebalancing, part 2 pkt_sched: Update drops stats in act_police sky2: version 1.23 sky2: add GRO support sky2: skb recycling sky2: reduce default transmit ring sky2: receive counter update sky2: fix shutdown synchronization sky2: PCI irq issues sky2: more receive shutdown sky2: turn off pause during shutdown ... Manually fix trivial conflict in net/core/skbuff.c due to kmemcheck
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/Kconfig1
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h10
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c29
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c130
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c141
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/libertas/if_spi.c11
11 files changed, 152 insertions, 184 deletions
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index ec35503f6a40..2942f13c9c4a 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -733,8 +733,9 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
733 /* 733 /*
734 * Set the beacon register and enable all timers. 734 * Set the beacon register and enable all timers.
735 */ 735 */
736 /* When in AP mode zero timer0 to start TSF */ 736 /* When in AP or Mesh Point mode zero timer0 to start TSF */
737 if (ah->ah_op_mode == NL80211_IFTYPE_AP) 737 if (ah->ah_op_mode == NL80211_IFTYPE_AP ||
738 ah->ah_op_mode == NL80211_IFTYPE_MESH_POINT)
738 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0); 739 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
739 740
740 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0); 741 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0);
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig
index 0ed1ac312aa6..2d79610bce12 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -1,7 +1,6 @@
1config ATH9K 1config ATH9K
2 tristate "Atheros 802.11n wireless cards support" 2 tristate "Atheros 802.11n wireless cards support"
3 depends on PCI && MAC80211 && WLAN_80211 3 depends on PCI && MAC80211 && WLAN_80211
4 depends on RFKILL || RFKILL=n
5 select ATH_COMMON 4 select ATH_COMMON
6 select MAC80211_LEDS 5 select MAC80211_LEDS
7 select LEDS_CLASS 6 select LEDS_CLASS
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 515880aa2116..5efc9345ca0d 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -21,7 +21,6 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <net/mac80211.h> 22#include <net/mac80211.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/rfkill.h>
25 24
26#include "hw.h" 25#include "hw.h"
27#include "rc.h" 26#include "rc.h"
@@ -460,12 +459,6 @@ struct ath_led {
460 bool registered; 459 bool registered;
461}; 460};
462 461
463struct ath_rfkill {
464 struct rfkill *rfkill;
465 struct rfkill_ops ops;
466 char rfkill_name[32];
467};
468
469/********************/ 462/********************/
470/* Main driver core */ 463/* Main driver core */
471/********************/ 464/********************/
@@ -505,7 +498,6 @@ struct ath_rfkill {
505#define SC_OP_PROTECT_ENABLE BIT(6) 498#define SC_OP_PROTECT_ENABLE BIT(6)
506#define SC_OP_RXFLUSH BIT(7) 499#define SC_OP_RXFLUSH BIT(7)
507#define SC_OP_LED_ASSOCIATED BIT(8) 500#define SC_OP_LED_ASSOCIATED BIT(8)
508#define SC_OP_RFKILL_REGISTERED BIT(9)
509#define SC_OP_WAIT_FOR_BEACON BIT(12) 501#define SC_OP_WAIT_FOR_BEACON BIT(12)
510#define SC_OP_LED_ON BIT(13) 502#define SC_OP_LED_ON BIT(13)
511#define SC_OP_SCANNING BIT(14) 503#define SC_OP_SCANNING BIT(14)
@@ -591,7 +583,6 @@ struct ath_softc {
591 583
592 int beacon_interval; 584 int beacon_interval;
593 585
594 struct ath_rfkill rf_kill;
595 struct ath_ani ani; 586 struct ath_ani ani;
596 struct ath9k_node_stats nodestats; 587 struct ath9k_node_stats nodestats;
597#ifdef CONFIG_ATH9K_DEBUG 588#ifdef CONFIG_ATH9K_DEBUG
@@ -677,6 +668,7 @@ static inline void ath9k_ps_restore(struct ath_softc *sc)
677 if (atomic_dec_and_test(&sc->ps_usecount)) 668 if (atomic_dec_and_test(&sc->ps_usecount))
678 if ((sc->hw->conf.flags & IEEE80211_CONF_PS) && 669 if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
679 !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 670 !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
671 SC_OP_WAIT_FOR_CAB |
680 SC_OP_WAIT_FOR_PSPOLL_DATA | 672 SC_OP_WAIT_FOR_PSPOLL_DATA |
681 SC_OP_WAIT_FOR_TX_ACK))) 673 SC_OP_WAIT_FOR_TX_ACK)))
682 ath9k_hw_setpower(sc->sc_ah, 674 ath9k_hw_setpower(sc->sc_ah,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 1579c9407ed5..34935a8ee59d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2186,6 +2186,18 @@ static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan
2186 REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); 2186 REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
2187} 2187}
2188 2188
2189static void ath9k_enable_rfkill(struct ath_hw *ah)
2190{
2191 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
2192 AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
2193
2194 REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
2195 AR_GPIO_INPUT_MUX2_RFSILENT);
2196
2197 ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
2198 REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
2199}
2200
2189int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 2201int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
2190 bool bChannelChange) 2202 bool bChannelChange)
2191{ 2203{
@@ -2313,10 +2325,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
2313 ath9k_hw_init_interrupt_masks(ah, ah->opmode); 2325 ath9k_hw_init_interrupt_masks(ah, ah->opmode);
2314 ath9k_hw_init_qos(ah); 2326 ath9k_hw_init_qos(ah);
2315 2327
2316#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
2317 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) 2328 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
2318 ath9k_enable_rfkill(ah); 2329 ath9k_enable_rfkill(ah);
2319#endif 2330
2320 ath9k_hw_init_user_settings(ah); 2331 ath9k_hw_init_user_settings(ah);
2321 2332
2322 REG_WRITE(ah, AR_STA_ID1, 2333 REG_WRITE(ah, AR_STA_ID1,
@@ -3613,20 +3624,6 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
3613 AR_GPIO_BIT(gpio)); 3624 AR_GPIO_BIT(gpio));
3614} 3625}
3615 3626
3616#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
3617void ath9k_enable_rfkill(struct ath_hw *ah)
3618{
3619 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
3620 AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
3621
3622 REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
3623 AR_GPIO_INPUT_MUX2_RFSILENT);
3624
3625 ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
3626 REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
3627}
3628#endif
3629
3630u32 ath9k_hw_getdefantenna(struct ath_hw *ah) 3627u32 ath9k_hw_getdefantenna(struct ath_hw *ah)
3631{ 3628{
3632 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7; 3629 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index dd8508ef6e05..9d0b31ad4603 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -565,9 +565,6 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
565void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 565void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
566 u32 ah_signal_type); 566 u32 ah_signal_type);
567void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 567void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
568#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
569void ath9k_enable_rfkill(struct ath_hw *ah);
570#endif
571u32 ath9k_hw_getdefantenna(struct ath_hw *ah); 568u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
572void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 569void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
573bool ath9k_hw_setantennaswitch(struct ath_hw *ah, 570bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index f7baa406918b..9f49a3251d4d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -231,6 +231,19 @@ static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band)
231 } 231 }
232} 232}
233 233
234static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc,
235 struct ieee80211_hw *hw)
236{
237 struct ieee80211_channel *curchan = hw->conf.channel;
238 struct ath9k_channel *channel;
239 u8 chan_idx;
240
241 chan_idx = curchan->hw_value;
242 channel = &sc->sc_ah->channels[chan_idx];
243 ath9k_update_ichannel(sc, hw, channel);
244 return channel;
245}
246
234/* 247/*
235 * Set/change channels. If the channel is really being changed, it's done 248 * Set/change channels. If the channel is really being changed, it's done
236 * by reseting the chip. To accomplish this we must first cleanup any pending 249 * by reseting the chip. To accomplish this we must first cleanup any pending
@@ -283,7 +296,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
283 "reset status %d\n", 296 "reset status %d\n",
284 channel->center_freq, r); 297 channel->center_freq, r);
285 spin_unlock_bh(&sc->sc_resetlock); 298 spin_unlock_bh(&sc->sc_resetlock);
286 return r; 299 goto ps_restore;
287 } 300 }
288 spin_unlock_bh(&sc->sc_resetlock); 301 spin_unlock_bh(&sc->sc_resetlock);
289 302
@@ -292,14 +305,17 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
292 if (ath_startrecv(sc) != 0) { 305 if (ath_startrecv(sc) != 0) {
293 DPRINTF(sc, ATH_DBG_FATAL, 306 DPRINTF(sc, ATH_DBG_FATAL,
294 "Unable to restart recv logic\n"); 307 "Unable to restart recv logic\n");
295 return -EIO; 308 r = -EIO;
309 goto ps_restore;
296 } 310 }
297 311
298 ath_cache_conf_rate(sc, &hw->conf); 312 ath_cache_conf_rate(sc, &hw->conf);
299 ath_update_txpow(sc); 313 ath_update_txpow(sc);
300 ath9k_hw_set_interrupts(ah, sc->imask); 314 ath9k_hw_set_interrupts(ah, sc->imask);
315
316 ps_restore:
301 ath9k_ps_restore(sc); 317 ath9k_ps_restore(sc);
302 return 0; 318 return r;
303} 319}
304 320
305/* 321/*
@@ -1110,6 +1126,9 @@ void ath_radio_enable(struct ath_softc *sc)
1110 ath9k_ps_wakeup(sc); 1126 ath9k_ps_wakeup(sc);
1111 ath9k_hw_configpcipowersave(ah, 0); 1127 ath9k_hw_configpcipowersave(ah, 0);
1112 1128
1129 if (!ah->curchan)
1130 ah->curchan = ath_get_curchannel(sc, sc->hw);
1131
1113 spin_lock_bh(&sc->sc_resetlock); 1132 spin_lock_bh(&sc->sc_resetlock);
1114 r = ath9k_hw_reset(ah, ah->curchan, false); 1133 r = ath9k_hw_reset(ah, ah->curchan, false);
1115 if (r) { 1134 if (r) {
@@ -1162,6 +1181,9 @@ void ath_radio_disable(struct ath_softc *sc)
1162 ath_stoprecv(sc); /* turn off frame recv */ 1181 ath_stoprecv(sc); /* turn off frame recv */
1163 ath_flushrecv(sc); /* flush recv queue */ 1182 ath_flushrecv(sc); /* flush recv queue */
1164 1183
1184 if (!ah->curchan)
1185 ah->curchan = ath_get_curchannel(sc, sc->hw);
1186
1165 spin_lock_bh(&sc->sc_resetlock); 1187 spin_lock_bh(&sc->sc_resetlock);
1166 r = ath9k_hw_reset(ah, ah->curchan, false); 1188 r = ath9k_hw_reset(ah, ah->curchan, false);
1167 if (r) { 1189 if (r) {
@@ -1178,8 +1200,6 @@ void ath_radio_disable(struct ath_softc *sc)
1178 ath9k_ps_restore(sc); 1200 ath9k_ps_restore(sc);
1179} 1201}
1180 1202
1181#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1182
1183/*******************/ 1203/*******************/
1184/* Rfkill */ 1204/* Rfkill */
1185/*******************/ 1205/*******************/
@@ -1192,81 +1212,27 @@ static bool ath_is_rfkill_set(struct ath_softc *sc)
1192 ah->rfkill_polarity; 1212 ah->rfkill_polarity;
1193} 1213}
1194 1214
1195/* s/w rfkill handlers */ 1215static void ath9k_rfkill_poll_state(struct ieee80211_hw *hw)
1196static int ath_rfkill_set_block(void *data, bool blocked)
1197{ 1216{
1198 struct ath_softc *sc = data; 1217 struct ath_wiphy *aphy = hw->priv;
1199 1218 struct ath_softc *sc = aphy->sc;
1200 if (blocked)
1201 ath_radio_disable(sc);
1202 else
1203 ath_radio_enable(sc);
1204
1205 return 0;
1206}
1207
1208static void ath_rfkill_poll_state(struct rfkill *rfkill, void *data)
1209{
1210 struct ath_softc *sc = data;
1211 bool blocked = !!ath_is_rfkill_set(sc); 1219 bool blocked = !!ath_is_rfkill_set(sc);
1212 1220
1213 if (rfkill_set_hw_state(rfkill, blocked)) 1221 wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
1222
1223 if (blocked)
1214 ath_radio_disable(sc); 1224 ath_radio_disable(sc);
1215 else 1225 else
1216 ath_radio_enable(sc); 1226 ath_radio_enable(sc);
1217} 1227}
1218 1228
1219/* Init s/w rfkill */ 1229static void ath_start_rfkill_poll(struct ath_softc *sc)
1220static int ath_init_sw_rfkill(struct ath_softc *sc)
1221{
1222 sc->rf_kill.ops.set_block = ath_rfkill_set_block;
1223 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
1224 sc->rf_kill.ops.poll = ath_rfkill_poll_state;
1225
1226 snprintf(sc->rf_kill.rfkill_name, sizeof(sc->rf_kill.rfkill_name),
1227 "ath9k-%s::rfkill", wiphy_name(sc->hw->wiphy));
1228
1229 sc->rf_kill.rfkill = rfkill_alloc(sc->rf_kill.rfkill_name,
1230 wiphy_dev(sc->hw->wiphy),
1231 RFKILL_TYPE_WLAN,
1232 &sc->rf_kill.ops, sc);
1233 if (!sc->rf_kill.rfkill) {
1234 DPRINTF(sc, ATH_DBG_FATAL, "Failed to allocate rfkill\n");
1235 return -ENOMEM;
1236 }
1237
1238 return 0;
1239}
1240
1241/* Deinitialize rfkill */
1242static void ath_deinit_rfkill(struct ath_softc *sc)
1243{
1244 if (sc->sc_flags & SC_OP_RFKILL_REGISTERED) {
1245 rfkill_unregister(sc->rf_kill.rfkill);
1246 rfkill_destroy(sc->rf_kill.rfkill);
1247 sc->sc_flags &= ~SC_OP_RFKILL_REGISTERED;
1248 }
1249}
1250
1251static int ath_start_rfkill_poll(struct ath_softc *sc)
1252{ 1230{
1253 if (!(sc->sc_flags & SC_OP_RFKILL_REGISTERED)) { 1231 struct ath_hw *ah = sc->sc_ah;
1254 if (rfkill_register(sc->rf_kill.rfkill)) {
1255 DPRINTF(sc, ATH_DBG_FATAL,
1256 "Unable to register rfkill\n");
1257 rfkill_destroy(sc->rf_kill.rfkill);
1258
1259 /* Deinitialize the device */
1260 ath_cleanup(sc);
1261 return -EIO;
1262 } else {
1263 sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
1264 }
1265 }
1266 1232
1267 return 0; 1233 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
1234 wiphy_rfkill_start_polling(sc->hw->wiphy);
1268} 1235}
1269#endif /* CONFIG_RFKILL */
1270 1236
1271void ath_cleanup(struct ath_softc *sc) 1237void ath_cleanup(struct ath_softc *sc)
1272{ 1238{
@@ -1286,9 +1252,6 @@ void ath_detach(struct ath_softc *sc)
1286 1252
1287 DPRINTF(sc, ATH_DBG_CONFIG, "Detach ATH hw\n"); 1253 DPRINTF(sc, ATH_DBG_CONFIG, "Detach ATH hw\n");
1288 1254
1289#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1290 ath_deinit_rfkill(sc);
1291#endif
1292 ath_deinit_leds(sc); 1255 ath_deinit_leds(sc);
1293 cancel_work_sync(&sc->chan_work); 1256 cancel_work_sync(&sc->chan_work);
1294 cancel_delayed_work_sync(&sc->wiphy_work); 1257 cancel_delayed_work_sync(&sc->wiphy_work);
@@ -1626,13 +1589,6 @@ int ath_attach(u16 devid, struct ath_softc *sc)
1626 if (error != 0) 1589 if (error != 0)
1627 goto error_attach; 1590 goto error_attach;
1628 1591
1629#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1630 /* Initialize s/w rfkill */
1631 error = ath_init_sw_rfkill(sc);
1632 if (error)
1633 goto error_attach;
1634#endif
1635
1636 INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); 1592 INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work);
1637 INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); 1593 INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
1638 sc->wiphy_scheduler_int = msecs_to_jiffies(500); 1594 sc->wiphy_scheduler_int = msecs_to_jiffies(500);
@@ -1648,6 +1604,7 @@ int ath_attach(u16 devid, struct ath_softc *sc)
1648 /* Initialize LED control */ 1604 /* Initialize LED control */
1649 ath_init_leds(sc); 1605 ath_init_leds(sc);
1650 1606
1607 ath_start_rfkill_poll(sc);
1651 1608
1652 return 0; 1609 return 0;
1653 1610
@@ -1920,7 +1877,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1920 struct ath_softc *sc = aphy->sc; 1877 struct ath_softc *sc = aphy->sc;
1921 struct ieee80211_channel *curchan = hw->conf.channel; 1878 struct ieee80211_channel *curchan = hw->conf.channel;
1922 struct ath9k_channel *init_channel; 1879 struct ath9k_channel *init_channel;
1923 int r, pos; 1880 int r;
1924 1881
1925 DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with " 1882 DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with "
1926 "initial channel: %d MHz\n", curchan->center_freq); 1883 "initial channel: %d MHz\n", curchan->center_freq);
@@ -1950,11 +1907,9 @@ static int ath9k_start(struct ieee80211_hw *hw)
1950 1907
1951 /* setup initial channel */ 1908 /* setup initial channel */
1952 1909
1953 pos = curchan->hw_value; 1910 sc->chan_idx = curchan->hw_value;
1954 1911
1955 sc->chan_idx = pos; 1912 init_channel = ath_get_curchannel(sc, hw);
1956 init_channel = &sc->sc_ah->channels[pos];
1957 ath9k_update_ichannel(sc, hw, init_channel);
1958 1913
1959 /* Reset SERDES registers */ 1914 /* Reset SERDES registers */
1960 ath9k_hw_configpcipowersave(sc->sc_ah, 0); 1915 ath9k_hw_configpcipowersave(sc->sc_ah, 0);
@@ -2018,10 +1973,6 @@ static int ath9k_start(struct ieee80211_hw *hw)
2018 1973
2019 ieee80211_wake_queues(hw); 1974 ieee80211_wake_queues(hw);
2020 1975
2021#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
2022 r = ath_start_rfkill_poll(sc);
2023#endif
2024
2025mutex_unlock: 1976mutex_unlock:
2026 mutex_unlock(&sc->mutex); 1977 mutex_unlock(&sc->mutex);
2027 1978
@@ -2159,7 +2110,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2159 } else 2110 } else
2160 sc->rx.rxlink = NULL; 2111 sc->rx.rxlink = NULL;
2161 2112
2162 rfkill_pause_polling(sc->rf_kill.rfkill); 2113 wiphy_rfkill_stop_polling(sc->hw->wiphy);
2163 2114
2164 /* disable HAL and put h/w to sleep */ 2115 /* disable HAL and put h/w to sleep */
2165 ath9k_hw_disable(sc->sc_ah); 2116 ath9k_hw_disable(sc->sc_ah);
@@ -2765,6 +2716,7 @@ struct ieee80211_ops ath9k_ops = {
2765 .ampdu_action = ath9k_ampdu_action, 2716 .ampdu_action = ath9k_ampdu_action,
2766 .sw_scan_start = ath9k_sw_scan_start, 2717 .sw_scan_start = ath9k_sw_scan_start,
2767 .sw_scan_complete = ath9k_sw_scan_complete, 2718 .sw_scan_complete = ath9k_sw_scan_complete,
2719 .rfkill_poll = ath9k_rfkill_poll_state,
2768}; 2720};
2769 2721
2770static struct { 2722static struct {
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 5014a19b0f75..f99f3a76df3f 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -817,6 +817,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
817 } 817 }
818 818
819 if (unlikely(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 819 if (unlikely(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
820 SC_OP_WAIT_FOR_CAB |
820 SC_OP_WAIT_FOR_PSPOLL_DATA))) 821 SC_OP_WAIT_FOR_PSPOLL_DATA)))
821 ath_rx_ps(sc, skb); 822 ath_rx_ps(sc, skb);
822 823
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index a5637c4aa85d..6d1519e1f011 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2152,7 +2152,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2152 /* we should be verifying the device is ready to be opened */ 2152 /* we should be verifying the device is ready to be opened */
2153 mutex_lock(&priv->mutex); 2153 mutex_lock(&priv->mutex);
2154 2154
2155 memset(&priv->staging_rxon, 0, sizeof(struct iwl_rxon_cmd));
2156 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 2155 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
2157 * ucode filename and max sizes are card-specific. */ 2156 * ucode filename and max sizes are card-specific. */
2158 2157
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index f9d16ca5b3d9..6ab07165ea28 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -629,13 +629,9 @@ u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
629 if (!sta_ht_inf->ht_supported) 629 if (!sta_ht_inf->ht_supported)
630 return 0; 630 return 0;
631 } 631 }
632 632 return iwl_is_channel_extension(priv, priv->band,
633 if (iwl_ht_conf->ht_protection & IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) 633 le16_to_cpu(priv->staging_rxon.channel),
634 return 1; 634 iwl_ht_conf->extension_chan_offset);
635 else
636 return iwl_is_channel_extension(priv, priv->band,
637 le16_to_cpu(priv->staging_rxon.channel),
638 iwl_ht_conf->extension_chan_offset);
639} 635}
640EXPORT_SYMBOL(iwl_is_fat_tx_allowed); 636EXPORT_SYMBOL(iwl_is_fat_tx_allowed);
641 637
@@ -826,9 +822,18 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
826 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 822 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
827 if (iwl_is_fat_tx_allowed(priv, NULL)) { 823 if (iwl_is_fat_tx_allowed(priv, NULL)) {
828 /* pure 40 fat */ 824 /* pure 40 fat */
829 if (rxon->flags & RXON_FLG_FAT_PROT_MSK) 825 if (ht_info->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
830 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; 826 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40;
831 else { 827 /* Note: control channel is opposite of extension channel */
828 switch (ht_info->extension_chan_offset) {
829 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
830 rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
831 break;
832 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
833 rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
834 break;
835 }
836 } else {
832 /* Note: control channel is opposite of extension channel */ 837 /* Note: control channel is opposite of extension channel */
833 switch (ht_info->extension_chan_offset) { 838 switch (ht_info->extension_chan_offset) {
834 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 839 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
@@ -2390,39 +2395,46 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2390 priv->ibss_beacon = ieee80211_beacon_get(hw, vif); 2395 priv->ibss_beacon = ieee80211_beacon_get(hw, vif);
2391 } 2396 }
2392 2397
2393 if ((changes & BSS_CHANGED_BSSID) && !iwl_is_rfkill(priv)) { 2398 if (changes & BSS_CHANGED_BEACON_INT) {
2394 /* If there is currently a HW scan going on in the background 2399 priv->beacon_int = bss_conf->beacon_int;
2395 * then we need to cancel it else the RXON below will fail. */ 2400 /* TODO: in AP mode, do something to make this take effect */
2401 }
2402
2403 if (changes & BSS_CHANGED_BSSID) {
2404 IWL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid);
2405
2406 /*
2407 * If there is currently a HW scan going on in the
2408 * background then we need to cancel it else the RXON
2409 * below/in post_associate will fail.
2410 */
2396 if (iwl_scan_cancel_timeout(priv, 100)) { 2411 if (iwl_scan_cancel_timeout(priv, 100)) {
2397 IWL_WARN(priv, "Aborted scan still in progress " 2412 IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
2398 "after 100ms\n");
2399 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); 2413 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
2400 mutex_unlock(&priv->mutex); 2414 mutex_unlock(&priv->mutex);
2401 return; 2415 return;
2402 } 2416 }
2403 memcpy(priv->staging_rxon.bssid_addr, 2417
2404 bss_conf->bssid, ETH_ALEN); 2418 /* mac80211 only sets assoc when in STATION mode */
2405 2419 if (priv->iw_mode == NL80211_IFTYPE_ADHOC ||
2406 /* TODO: Audit driver for usage of these members and see 2420 bss_conf->assoc) {
2407 * if mac80211 deprecates them (priv->bssid looks like it 2421 memcpy(priv->staging_rxon.bssid_addr,
2408 * shouldn't be there, but I haven't scanned the IBSS code 2422 bss_conf->bssid, ETH_ALEN);
2409 * to verify) - jpk */ 2423
2410 memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); 2424 /* currently needed in a few places */
2411 2425 memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN);
2412 if (priv->iw_mode == NL80211_IFTYPE_AP) 2426 } else {
2413 iwlcore_config_ap(priv); 2427 priv->staging_rxon.filter_flags &=
2414 else { 2428 ~RXON_FILTER_ASSOC_MSK;
2415 int rc = iwlcore_commit_rxon(priv);
2416 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc)
2417 iwl_rxon_add_station(
2418 priv, priv->active_rxon.bssid_addr, 1);
2419 } 2429 }
2420 } else if (!iwl_is_rfkill(priv)) { 2430
2421 iwl_scan_cancel_timeout(priv, 100);
2422 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2423 iwlcore_commit_rxon(priv);
2424 } 2431 }
2425 2432
2433 /*
2434 * This needs to be after setting the BSSID in case
2435 * mac80211 decides to do both changes at once because
2436 * it will invoke post_associate.
2437 */
2426 if (priv->iw_mode == NL80211_IFTYPE_ADHOC && 2438 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2427 changes & BSS_CHANGED_BEACON) { 2439 changes & BSS_CHANGED_BEACON) {
2428 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); 2440 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
@@ -2431,8 +2443,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2431 iwl_mac_beacon_update(hw, beacon); 2443 iwl_mac_beacon_update(hw, beacon);
2432 } 2444 }
2433 2445
2434 mutex_unlock(&priv->mutex);
2435
2436 if (changes & BSS_CHANGED_ERP_PREAMBLE) { 2446 if (changes & BSS_CHANGED_ERP_PREAMBLE) {
2437 IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", 2447 IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n",
2438 bss_conf->use_short_preamble); 2448 bss_conf->use_short_preamble);
@@ -2450,6 +2460,23 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2450 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; 2460 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
2451 } 2461 }
2452 2462
2463 if (changes & BSS_CHANGED_BASIC_RATES) {
2464 /* XXX use this information
2465 *
2466 * To do that, remove code from iwl_set_rate() and put something
2467 * like this here:
2468 *
2469 if (A-band)
2470 priv->staging_rxon.ofdm_basic_rates =
2471 bss_conf->basic_rates;
2472 else
2473 priv->staging_rxon.ofdm_basic_rates =
2474 bss_conf->basic_rates >> 4;
2475 priv->staging_rxon.cck_basic_rates =
2476 bss_conf->basic_rates & 0xF;
2477 */
2478 }
2479
2453 if (changes & BSS_CHANGED_HT) { 2480 if (changes & BSS_CHANGED_HT) {
2454 iwl_ht_conf(priv, bss_conf); 2481 iwl_ht_conf(priv, bss_conf);
2455 2482
@@ -2459,10 +2486,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2459 2486
2460 if (changes & BSS_CHANGED_ASSOC) { 2487 if (changes & BSS_CHANGED_ASSOC) {
2461 IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); 2488 IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc);
2462 /* This should never happen as this function should
2463 * never be called from interrupt context. */
2464 if (WARN_ON_ONCE(in_interrupt()))
2465 return;
2466 if (bss_conf->assoc) { 2489 if (bss_conf->assoc) {
2467 priv->assoc_id = bss_conf->aid; 2490 priv->assoc_id = bss_conf->aid;
2468 priv->beacon_int = bss_conf->beacon_int; 2491 priv->beacon_int = bss_conf->beacon_int;
@@ -2470,27 +2493,35 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2470 priv->timestamp = bss_conf->timestamp; 2493 priv->timestamp = bss_conf->timestamp;
2471 priv->assoc_capability = bss_conf->assoc_capability; 2494 priv->assoc_capability = bss_conf->assoc_capability;
2472 2495
2473 /* we have just associated, don't start scan too early 2496 /*
2474 * leave time for EAPOL exchange to complete 2497 * We have just associated, don't start scan too early
2498 * leave time for EAPOL exchange to complete.
2499 *
2500 * XXX: do this in mac80211
2475 */ 2501 */
2476 priv->next_scan_jiffies = jiffies + 2502 priv->next_scan_jiffies = jiffies +
2477 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; 2503 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
2478 mutex_lock(&priv->mutex); 2504 if (!iwl_is_rfkill(priv))
2479 priv->cfg->ops->lib->post_associate(priv); 2505 priv->cfg->ops->lib->post_associate(priv);
2480 mutex_unlock(&priv->mutex); 2506 } else
2481 } else {
2482 priv->assoc_id = 0; 2507 priv->assoc_id = 0;
2483 IWL_DEBUG_MAC80211(priv, "DISASSOC %d\n", bss_conf->assoc); 2508
2509 }
2510
2511 if (changes && iwl_is_associated(priv) && priv->assoc_id) {
2512 IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n",
2513 changes);
2514 ret = iwl_send_rxon_assoc(priv);
2515 if (!ret) {
2516 /* Sync active_rxon with latest change. */
2517 memcpy((void *)&priv->active_rxon,
2518 &priv->staging_rxon,
2519 sizeof(struct iwl_rxon_cmd));
2484 } 2520 }
2485 } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
2486 IWL_DEBUG_MAC80211(priv, "Associated Changes %d\n", changes);
2487 ret = iwl_send_rxon_assoc(priv);
2488 if (!ret)
2489 /* Sync active_rxon with latest change. */
2490 memcpy((void *)&priv->active_rxon,
2491 &priv->staging_rxon,
2492 sizeof(struct iwl_rxon_cmd));
2493 } 2521 }
2522
2523 mutex_unlock(&priv->mutex);
2524
2494 IWL_DEBUG_MAC80211(priv, "leave\n"); 2525 IWL_DEBUG_MAC80211(priv, "leave\n");
2495} 2526}
2496EXPORT_SYMBOL(iwl_bss_info_changed); 2527EXPORT_SYMBOL(iwl_bss_info_changed);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 83d31606dd00..cb9bd4c8f25e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2498,8 +2498,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2498 struct iwl3945_rxon_cmd *active_rxon = 2498 struct iwl3945_rxon_cmd *active_rxon =
2499 (struct iwl3945_rxon_cmd *)(&priv->active_rxon); 2499 (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
2500 2500
2501 memcpy(&priv->staging_rxon, &priv->active_rxon, 2501 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
2502 sizeof(priv->staging_rxon));
2503 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2502 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2504 } else { 2503 } else {
2505 /* Initialize our rx_config data */ 2504 /* Initialize our rx_config data */
@@ -3147,7 +3146,6 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
3147 /* we should be verifying the device is ready to be opened */ 3146 /* we should be verifying the device is ready to be opened */
3148 mutex_lock(&priv->mutex); 3147 mutex_lock(&priv->mutex);
3149 3148
3150 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
3151 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 3149 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
3152 * ucode filename and max sizes are card-specific. */ 3150 * ucode filename and max sizes are card-specific. */
3153 3151
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 06a46d7b3d6c..6564282ce476 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -812,7 +812,6 @@ out:
812static void if_spi_e2h(struct if_spi_card *card) 812static void if_spi_e2h(struct if_spi_card *card)
813{ 813{
814 int err = 0; 814 int err = 0;
815 unsigned long flags;
816 u32 cause; 815 u32 cause;
817 struct lbs_private *priv = card->priv; 816 struct lbs_private *priv = card->priv;
818 817
@@ -827,10 +826,7 @@ static void if_spi_e2h(struct if_spi_card *card)
827 /* generate a card interrupt */ 826 /* generate a card interrupt */
828 spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT); 827 spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT);
829 828
830 spin_lock_irqsave(&priv->driver_lock, flags);
831 lbs_queue_event(priv, cause & 0xff); 829 lbs_queue_event(priv, cause & 0xff);
832 spin_unlock_irqrestore(&priv->driver_lock, flags);
833
834out: 830out:
835 if (err) 831 if (err)
836 lbs_pr_err("%s: error %d\n", __func__, err); 832 lbs_pr_err("%s: error %d\n", __func__, err);
@@ -875,7 +871,12 @@ static int lbs_spi_thread(void *data)
875 err = if_spi_c2h_data(card); 871 err = if_spi_c2h_data(card);
876 if (err) 872 if (err)
877 goto err; 873 goto err;
878 if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) { 874
875 /* workaround: in PS mode, the card does not set the Command
876 * Download Ready bit, but it sets TX Download Ready. */
877 if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
878 (card->priv->psstate != PS_STATE_FULL_POWER &&
879 (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
879 /* This means two things. First of all, 880 /* This means two things. First of all,
880 * if there was a previous command sent, the card has 881 * if there was a previous command sent, the card has
881 * successfully received it. 882 * successfully received it.