aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c105
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/gpio.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/link.c18
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c3
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c30
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c15
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c5
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c15
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c11
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.h17
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c22
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.h3
24 files changed, 260 insertions, 53 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 2c9f7d7ed4cc..0ed3846f9cbb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -142,6 +142,7 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
142 }; 142 };
143 int training_power; 143 int training_power;
144 int i, val; 144 int i, val;
145 u32 am2pm_mask = ah->paprd_ratemask;
145 146
146 if (IS_CHAN_2GHZ(ah->curchan)) 147 if (IS_CHAN_2GHZ(ah->curchan))
147 training_power = ar9003_get_training_power_2g(ah); 148 training_power = ar9003_get_training_power_2g(ah);
@@ -158,10 +159,13 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
158 } 159 }
159 ah->paprd_training_power = training_power; 160 ah->paprd_training_power = training_power;
160 161
162 if (AR_SREV_9330(ah))
163 am2pm_mask = 0;
164
161 REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK, 165 REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK,
162 ah->paprd_ratemask); 166 ah->paprd_ratemask);
163 REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK, 167 REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK,
164 ah->paprd_ratemask); 168 am2pm_mask);
165 REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK, 169 REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK,
166 ah->paprd_ratemask_ht40); 170 ah->paprd_ratemask_ht40);
167 171
@@ -782,6 +786,102 @@ int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain)
782} 786}
783EXPORT_SYMBOL(ar9003_paprd_setup_gain_table); 787EXPORT_SYMBOL(ar9003_paprd_setup_gain_table);
784 788
789static bool ar9003_paprd_retrain_pa_in(struct ath_hw *ah,
790 struct ath9k_hw_cal_data *caldata,
791 int chain)
792{
793 u32 *pa_in = caldata->pa_table[chain];
794 int capdiv_offset, quick_drop_offset;
795 int capdiv2g, quick_drop;
796 int count = 0;
797 int i;
798
799 if (!AR_SREV_9485(ah) && !AR_SREV_9330(ah))
800 return false;
801
802 capdiv2g = REG_READ_FIELD(ah, AR_PHY_65NM_CH0_TXRF3,
803 AR_PHY_65NM_CH0_TXRF3_CAPDIV2G);
804
805 quick_drop = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
806 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP);
807
808 if (quick_drop)
809 quick_drop -= 0x40;
810
811 for (i = 0; i < NUM_BIN + 1; i++) {
812 if (pa_in[i] == 1400)
813 count++;
814 }
815
816 if (AR_SREV_9485(ah)) {
817 if (pa_in[23] < 800) {
818 capdiv_offset = (int)((1000 - pa_in[23] + 75) / 150);
819 capdiv2g += capdiv_offset;
820 if (capdiv2g > 7) {
821 capdiv2g = 7;
822 if (pa_in[23] < 600) {
823 quick_drop++;
824 if (quick_drop > 0)
825 quick_drop = 0;
826 }
827 }
828 } else if (pa_in[23] == 1400) {
829 quick_drop_offset = min_t(int, count / 3, 2);
830 quick_drop += quick_drop_offset;
831 capdiv2g += quick_drop_offset / 2;
832
833 if (capdiv2g > 7)
834 capdiv2g = 7;
835
836 if (quick_drop > 0) {
837 quick_drop = 0;
838 capdiv2g -= quick_drop_offset;
839 if (capdiv2g < 0)
840 capdiv2g = 0;
841 }
842 } else {
843 return false;
844 }
845 } else if (AR_SREV_9330(ah)) {
846 if (pa_in[23] < 1000) {
847 capdiv_offset = (1000 - pa_in[23]) / 100;
848 capdiv2g += capdiv_offset;
849 if (capdiv_offset > 3) {
850 capdiv_offset = 1;
851 quick_drop--;
852 }
853
854 capdiv2g += capdiv_offset;
855 if (capdiv2g > 6)
856 capdiv2g = 6;
857 if (quick_drop < -4)
858 quick_drop = -4;
859 } else if (pa_in[23] == 1400) {
860 if (count > 3) {
861 quick_drop++;
862 capdiv2g -= count / 4;
863 if (quick_drop > -2)
864 quick_drop = -2;
865 } else {
866 capdiv2g--;
867 }
868
869 if (capdiv2g < 0)
870 capdiv2g = 0;
871 } else {
872 return false;
873 }
874 }
875
876 REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_TXRF3,
877 AR_PHY_65NM_CH0_TXRF3_CAPDIV2G, capdiv2g);
878 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
879 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP,
880 quick_drop);
881
882 return true;
883}
884
785int ar9003_paprd_create_curve(struct ath_hw *ah, 885int ar9003_paprd_create_curve(struct ath_hw *ah,
786 struct ath9k_hw_cal_data *caldata, int chain) 886 struct ath9k_hw_cal_data *caldata, int chain)
787{ 887{
@@ -817,6 +917,9 @@ int ar9003_paprd_create_curve(struct ath_hw *ah,
817 if (!create_pa_curve(data_L, data_U, pa_table, small_signal_gain)) 917 if (!create_pa_curve(data_L, data_U, pa_table, small_signal_gain))
818 status = -2; 918 status = -2;
819 919
920 if (ar9003_paprd_retrain_pa_in(ah, caldata, chain))
921 status = -EINPROGRESS;
922
820 REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1, 923 REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1,
821 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); 924 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE);
822 925
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index 7bfbaf065a43..84d3d4956861 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -625,6 +625,10 @@
625#define AR_PHY_AIC_CTRL_4_B0 (AR_SM_BASE + 0x4c0) 625#define AR_PHY_AIC_CTRL_4_B0 (AR_SM_BASE + 0x4c0)
626#define AR_PHY_AIC_STAT_2_B0 (AR_SM_BASE + 0x4cc) 626#define AR_PHY_AIC_STAT_2_B0 (AR_SM_BASE + 0x4cc)
627 627
628#define AR_PHY_65NM_CH0_TXRF3 0x16048
629#define AR_PHY_65NM_CH0_TXRF3_CAPDIV2G 0x0000001e
630#define AR_PHY_65NM_CH0_TXRF3_CAPDIV2G_S 1
631
628#define AR_PHY_65NM_CH0_SYNTH4 0x1608c 632#define AR_PHY_65NM_CH0_SYNTH4 0x1608c
629#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT (AR_SREV_9462(ah) ? 0x00000001 : 0x00000002) 633#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT (AR_SREV_9462(ah) ? 0x00000001 : 0x00000002)
630#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT_S (AR_SREV_9462(ah) ? 0 : 1) 634#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT_S (AR_SREV_9462(ah) ? 0 : 1)
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index bacdb8fb4ef4..9f83f71742a5 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -341,7 +341,8 @@ void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc)
341{ 341{
342 struct ath_btcoex *btcoex = &sc->btcoex; 342 struct ath_btcoex *btcoex = &sc->btcoex;
343 343
344 ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); 344 if (btcoex->hw_timer_enabled)
345 ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer);
345} 346}
346 347
347u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen) 348u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen)
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 60b6a9daff7e..48af40151d23 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -463,9 +463,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah)
463 ah->config.spurchans[i][1] = AR_NO_SPUR; 463 ah->config.spurchans[i][1] = AR_NO_SPUR;
464 } 464 }
465 465
466 /* PAPRD needs some more work to be enabled */
467 ah->config.paprd_disable = 1;
468
469 ah->config.rx_intr_mitigation = true; 466 ah->config.rx_intr_mitigation = true;
470 ah->config.pcieSerDesWrite = true; 467 ah->config.pcieSerDesWrite = true;
471 468
@@ -978,9 +975,6 @@ static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
978 else 975 else
979 imr_reg |= AR_IMR_TXOK; 976 imr_reg |= AR_IMR_TXOK;
980 977
981 if (opmode == NL80211_IFTYPE_AP)
982 imr_reg |= AR_IMR_MIB;
983
984 ENABLE_REGWRITE_BUFFER(ah); 978 ENABLE_REGWRITE_BUFFER(ah);
985 979
986 REG_WRITE(ah, AR_IMR, imr_reg); 980 REG_WRITE(ah, AR_IMR, imr_reg);
@@ -1778,6 +1772,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1778 /* Operating channel changed, reset channel calibration data */ 1772 /* Operating channel changed, reset channel calibration data */
1779 memset(caldata, 0, sizeof(*caldata)); 1773 memset(caldata, 0, sizeof(*caldata));
1780 ath9k_init_nfcal_hist_buffer(ah, chan); 1774 ath9k_init_nfcal_hist_buffer(ah, chan);
1775 } else if (caldata) {
1776 caldata->paprd_packet_sent = false;
1781 } 1777 }
1782 ah->noise = ath9k_hw_getchan_noise(ah, chan); 1778 ah->noise = ath9k_hw_getchan_noise(ah, chan);
1783 1779
@@ -2502,7 +2498,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2502 pCap->tx_desc_len = sizeof(struct ar9003_txc); 2498 pCap->tx_desc_len = sizeof(struct ar9003_txc);
2503 pCap->txs_len = sizeof(struct ar9003_txs); 2499 pCap->txs_len = sizeof(struct ar9003_txs);
2504 if (!ah->config.paprd_disable && 2500 if (!ah->config.paprd_disable &&
2505 ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) 2501 ah->eep_ops->get_eeprom(ah, EEP_PAPRD) &&
2502 !AR_SREV_9462(ah))
2506 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; 2503 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
2507 } else { 2504 } else {
2508 pCap->tx_desc_len = sizeof(struct ath_desc); 2505 pCap->tx_desc_len = sizeof(struct ath_desc);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index ce7332c64efb..6599a75f01fe 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -405,6 +405,7 @@ struct ath9k_hw_cal_data {
405 int8_t iCoff; 405 int8_t iCoff;
406 int8_t qCoff; 406 int8_t qCoff;
407 bool rtt_done; 407 bool rtt_done;
408 bool paprd_packet_sent;
408 bool paprd_done; 409 bool paprd_done;
409 bool nfcal_pending; 410 bool nfcal_pending;
410 bool nfcal_interference; 411 bool nfcal_interference;
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index d4549e9aac5c..825a29cc9313 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -254,8 +254,9 @@ void ath_paprd_calibrate(struct work_struct *work)
254 int chain_ok = 0; 254 int chain_ok = 0;
255 int chain; 255 int chain;
256 int len = 1800; 256 int len = 1800;
257 int ret;
257 258
258 if (!caldata) 259 if (!caldata || !caldata->paprd_packet_sent || caldata->paprd_done)
259 return; 260 return;
260 261
261 ath9k_ps_wakeup(sc); 262 ath9k_ps_wakeup(sc);
@@ -282,13 +283,6 @@ void ath_paprd_calibrate(struct work_struct *work)
282 continue; 283 continue;
283 284
284 chain_ok = 0; 285 chain_ok = 0;
285
286 ath_dbg(common, CALIBRATE,
287 "Sending PAPRD frame for thermal measurement on chain %d\n",
288 chain);
289 if (!ath_paprd_send_frame(sc, skb, chain))
290 goto fail_paprd;
291
292 ar9003_paprd_setup_gain_table(ah, chain); 286 ar9003_paprd_setup_gain_table(ah, chain);
293 287
294 ath_dbg(common, CALIBRATE, 288 ath_dbg(common, CALIBRATE,
@@ -302,7 +296,13 @@ void ath_paprd_calibrate(struct work_struct *work)
302 break; 296 break;
303 } 297 }
304 298
305 if (ar9003_paprd_create_curve(ah, caldata, chain)) { 299 ret = ar9003_paprd_create_curve(ah, caldata, chain);
300 if (ret == -EINPROGRESS) {
301 ath_dbg(common, CALIBRATE,
302 "PAPRD curve on chain %d needs to be re-trained\n",
303 chain);
304 break;
305 } else if (ret) {
306 ath_dbg(common, CALIBRATE, 306 ath_dbg(common, CALIBRATE,
307 "PAPRD create curve failed on chain %d\n", 307 "PAPRD create curve failed on chain %d\n",
308 chain); 308 chain);
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 2c9da6b2ecb1..0d4155aec48d 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2018,6 +2018,9 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
2018 2018
2019 ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); 2019 ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb);
2020 2020
2021 if (sc->sc_ah->caldata)
2022 sc->sc_ah->caldata->paprd_packet_sent = true;
2023
2021 if (!(tx_flags & ATH_TX_ERROR)) 2024 if (!(tx_flags & ATH_TX_ERROR))
2022 /* Frame was ACKed */ 2025 /* Frame was ACKed */
2023 tx_info->flags |= IEEE80211_TX_STAT_ACK; 2026 tx_info->flags |= IEEE80211_TX_STAT_ACK;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index a299d42da8e7..58f89fa9c9f8 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -519,7 +519,7 @@ static void brcmf_usb_tx_complete(struct urb *urb)
519 else 519 else
520 devinfo->bus_pub.bus->dstats.tx_errors++; 520 devinfo->bus_pub.bus->dstats.tx_errors++;
521 521
522 dev_kfree_skb(req->skb); 522 brcmu_pkt_buf_free_skb(req->skb);
523 req->skb = NULL; 523 req->skb = NULL;
524 brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req); 524 brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req);
525 525
@@ -540,7 +540,7 @@ static void brcmf_usb_rx_complete(struct urb *urb)
540 devinfo->bus_pub.bus->dstats.rx_packets++; 540 devinfo->bus_pub.bus->dstats.rx_packets++;
541 } else { 541 } else {
542 devinfo->bus_pub.bus->dstats.rx_errors++; 542 devinfo->bus_pub.bus->dstats.rx_errors++;
543 dev_kfree_skb(skb); 543 brcmu_pkt_buf_free_skb(skb);
544 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req); 544 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
545 return; 545 return;
546 } 546 }
@@ -550,13 +550,15 @@ static void brcmf_usb_rx_complete(struct urb *urb)
550 if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) { 550 if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) {
551 brcmf_dbg(ERROR, "rx protocol error\n"); 551 brcmf_dbg(ERROR, "rx protocol error\n");
552 brcmu_pkt_buf_free_skb(skb); 552 brcmu_pkt_buf_free_skb(skb);
553 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
553 devinfo->bus_pub.bus->dstats.rx_errors++; 554 devinfo->bus_pub.bus->dstats.rx_errors++;
554 } else { 555 } else {
555 brcmf_rx_packet(devinfo->dev, ifidx, skb); 556 brcmf_rx_packet(devinfo->dev, ifidx, skb);
556 brcmf_usb_rx_refill(devinfo, req); 557 brcmf_usb_rx_refill(devinfo, req);
557 } 558 }
558 } else { 559 } else {
559 dev_kfree_skb(skb); 560 brcmu_pkt_buf_free_skb(skb);
561 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
560 } 562 }
561 return; 563 return;
562 564
@@ -581,14 +583,13 @@ static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
581 usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->rx_pipe, 583 usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->rx_pipe,
582 skb->data, skb_tailroom(skb), brcmf_usb_rx_complete, 584 skb->data, skb_tailroom(skb), brcmf_usb_rx_complete,
583 req); 585 req);
584 req->urb->transfer_flags |= URB_ZERO_PACKET;
585 req->devinfo = devinfo; 586 req->devinfo = devinfo;
587 brcmf_usb_enq(devinfo, &devinfo->rx_postq, req);
586 588
587 ret = usb_submit_urb(req->urb, GFP_ATOMIC); 589 ret = usb_submit_urb(req->urb, GFP_ATOMIC);
588 if (ret == 0) { 590 if (ret) {
589 brcmf_usb_enq(devinfo, &devinfo->rx_postq, req); 591 brcmf_usb_del_fromq(devinfo, req);
590 } else { 592 brcmu_pkt_buf_free_skb(req->skb);
591 dev_kfree_skb(req->skb);
592 req->skb = NULL; 593 req->skb = NULL;
593 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req); 594 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
594 } 595 }
@@ -683,23 +684,22 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb)
683 684
684 req = brcmf_usb_deq(devinfo, &devinfo->tx_freeq); 685 req = brcmf_usb_deq(devinfo, &devinfo->tx_freeq);
685 if (!req) { 686 if (!req) {
687 brcmu_pkt_buf_free_skb(skb);
686 brcmf_dbg(ERROR, "no req to send\n"); 688 brcmf_dbg(ERROR, "no req to send\n");
687 return -ENOMEM; 689 return -ENOMEM;
688 } 690 }
689 if (!req->urb) {
690 brcmf_dbg(ERROR, "no urb for req %p\n", req);
691 return -ENOBUFS;
692 }
693 691
694 req->skb = skb; 692 req->skb = skb;
695 req->devinfo = devinfo; 693 req->devinfo = devinfo;
696 usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->tx_pipe, 694 usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->tx_pipe,
697 skb->data, skb->len, brcmf_usb_tx_complete, req); 695 skb->data, skb->len, brcmf_usb_tx_complete, req);
698 req->urb->transfer_flags |= URB_ZERO_PACKET; 696 req->urb->transfer_flags |= URB_ZERO_PACKET;
697 brcmf_usb_enq(devinfo, &devinfo->tx_postq, req);
699 ret = usb_submit_urb(req->urb, GFP_ATOMIC); 698 ret = usb_submit_urb(req->urb, GFP_ATOMIC);
700 if (!ret) { 699 if (ret) {
701 brcmf_usb_enq(devinfo, &devinfo->tx_postq, req); 700 brcmf_dbg(ERROR, "brcmf_usb_tx usb_submit_urb FAILED\n");
702 } else { 701 brcmf_usb_del_fromq(devinfo, req);
702 brcmu_pkt_buf_free_skb(req->skb);
703 req->skb = NULL; 703 req->skb = NULL;
704 brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req); 704 brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req);
705 } 705 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 28c5fbb4af26..c36e92312443 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1876,16 +1876,17 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
1876 } 1876 }
1877 1877
1878 if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) { 1878 if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) {
1879 scb_val.val = cpu_to_le32(0); 1879 memset(&scb_val, 0, sizeof(scb_val));
1880 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_RSSI, &scb_val, 1880 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_RSSI, &scb_val,
1881 sizeof(struct brcmf_scb_val_le)); 1881 sizeof(struct brcmf_scb_val_le));
1882 if (err) 1882 if (err) {
1883 WL_ERR("Could not get rssi (%d)\n", err); 1883 WL_ERR("Could not get rssi (%d)\n", err);
1884 1884 } else {
1885 rssi = le32_to_cpu(scb_val.val); 1885 rssi = le32_to_cpu(scb_val.val);
1886 sinfo->filled |= STATION_INFO_SIGNAL; 1886 sinfo->filled |= STATION_INFO_SIGNAL;
1887 sinfo->signal = rssi; 1887 sinfo->signal = rssi;
1888 WL_CONN("RSSI %d dBm\n", rssi); 1888 WL_CONN("RSSI %d dBm\n", rssi);
1889 }
1889 } 1890 }
1890 1891
1891done: 1892done:
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index e970897f6ab5..4cb234349fbf 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1326,6 +1326,11 @@ static int if_sdio_suspend(struct device *dev)
1326 1326
1327 mmc_pm_flag_t flags = sdio_get_host_pm_caps(func); 1327 mmc_pm_flag_t flags = sdio_get_host_pm_caps(func);
1328 1328
1329 /* If we're powered off anyway, just let the mmc layer remove the
1330 * card. */
1331 if (!lbs_iface_active(card->priv))
1332 return -ENOSYS;
1333
1329 dev_info(dev, "%s: suspend: PM flags = 0x%x\n", 1334 dev_info(dev, "%s: suspend: PM flags = 0x%x\n",
1330 sdio_func_id(func), flags); 1335 sdio_func_id(func), flags);
1331 1336
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index c68adec3cc8b..565527aee0ea 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -170,7 +170,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
170 cmd_code = le16_to_cpu(host_cmd->command); 170 cmd_code = le16_to_cpu(host_cmd->command);
171 cmd_size = le16_to_cpu(host_cmd->size); 171 cmd_size = le16_to_cpu(host_cmd->size);
172 172
173 skb_trim(cmd_node->cmd_skb, cmd_size); 173 /* Adjust skb length */
174 if (cmd_node->cmd_skb->len > cmd_size)
175 /*
176 * cmd_size is less than sizeof(struct host_cmd_ds_command).
177 * Trim off the unused portion.
178 */
179 skb_trim(cmd_node->cmd_skb, cmd_size);
180 else if (cmd_node->cmd_skb->len < cmd_size)
181 /*
182 * cmd_size is larger than sizeof(struct host_cmd_ds_command)
183 * because we have appended custom IE TLV. Increase skb length
184 * accordingly.
185 */
186 skb_put(cmd_node->cmd_skb, cmd_size - cmd_node->cmd_skb->len);
174 187
175 do_gettimeofday(&tstamp); 188 do_gettimeofday(&tstamp);
176 dev_dbg(adapter->dev, "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d," 189 dev_dbg(adapter->dev, "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d,"
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 8b9dbd76a252..64328af496f5 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1611,6 +1611,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1611static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) 1611static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1612{ 1612{
1613 int retval; 1613 int retval;
1614 u32 reg;
1614 1615
1615 /* 1616 /*
1616 * Allocate eeprom data. 1617 * Allocate eeprom data.
@@ -1624,6 +1625,14 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1624 return retval; 1625 return retval;
1625 1626
1626 /* 1627 /*
1628 * Enable rfkill polling by setting GPIO direction of the
1629 * rfkill switch GPIO pin correctly.
1630 */
1631 rt2x00pci_register_read(rt2x00dev, GPIOCSR, &reg);
1632 rt2x00_set_field32(&reg, GPIOCSR_BIT8, 1);
1633 rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg);
1634
1635 /*
1627 * Initialize hw specifications. 1636 * Initialize hw specifications.
1628 */ 1637 */
1629 retval = rt2400pci_probe_hw_mode(rt2x00dev); 1638 retval = rt2400pci_probe_hw_mode(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.h b/drivers/net/wireless/rt2x00/rt2400pci.h
index d3a4a68cc439..7564ae992b73 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.h
+++ b/drivers/net/wireless/rt2x00/rt2400pci.h
@@ -670,6 +670,7 @@
670#define GPIOCSR_BIT5 FIELD32(0x00000020) 670#define GPIOCSR_BIT5 FIELD32(0x00000020)
671#define GPIOCSR_BIT6 FIELD32(0x00000040) 671#define GPIOCSR_BIT6 FIELD32(0x00000040)
672#define GPIOCSR_BIT7 FIELD32(0x00000080) 672#define GPIOCSR_BIT7 FIELD32(0x00000080)
673#define GPIOCSR_BIT8 FIELD32(0x00000100)
673 674
674/* 675/*
675 * BBPPCSR: BBP Pin control register. 676 * BBPPCSR: BBP Pin control register.
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index d2cf8a4bc8b5..3de0406735f6 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1929,6 +1929,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1929static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) 1929static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1930{ 1930{
1931 int retval; 1931 int retval;
1932 u32 reg;
1932 1933
1933 /* 1934 /*
1934 * Allocate eeprom data. 1935 * Allocate eeprom data.
@@ -1942,6 +1943,14 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1942 return retval; 1943 return retval;
1943 1944
1944 /* 1945 /*
1946 * Enable rfkill polling by setting GPIO direction of the
1947 * rfkill switch GPIO pin correctly.
1948 */
1949 rt2x00pci_register_read(rt2x00dev, GPIOCSR, &reg);
1950 rt2x00_set_field32(&reg, GPIOCSR_DIR0, 1);
1951 rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg);
1952
1953 /*
1945 * Initialize hw specifications. 1954 * Initialize hw specifications.
1946 */ 1955 */
1947 retval = rt2500pci_probe_hw_mode(rt2x00dev); 1956 retval = rt2500pci_probe_hw_mode(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 3aae36bb0a9e..89fee311d8fd 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -283,7 +283,7 @@ static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)
283 u16 reg; 283 u16 reg;
284 284
285 rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg); 285 rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg);
286 return rt2x00_get_field32(reg, MAC_CSR19_BIT7); 286 return rt2x00_get_field16(reg, MAC_CSR19_BIT7);
287} 287}
288 288
289#ifdef CONFIG_RT2X00_LIB_LEDS 289#ifdef CONFIG_RT2X00_LIB_LEDS
@@ -1768,6 +1768,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1768static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) 1768static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
1769{ 1769{
1770 int retval; 1770 int retval;
1771 u16 reg;
1771 1772
1772 /* 1773 /*
1773 * Allocate eeprom data. 1774 * Allocate eeprom data.
@@ -1781,6 +1782,14 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
1781 return retval; 1782 return retval;
1782 1783
1783 /* 1784 /*
1785 * Enable rfkill polling by setting GPIO direction of the
1786 * rfkill switch GPIO pin correctly.
1787 */
1788 rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg);
1789 rt2x00_set_field16(&reg, MAC_CSR19_BIT8, 0);
1790 rt2500usb_register_write(rt2x00dev, MAC_CSR19, reg);
1791
1792 /*
1784 * Initialize hw specifications. 1793 * Initialize hw specifications.
1785 */ 1794 */
1786 retval = rt2500usb_probe_hw_mode(rt2x00dev); 1795 retval = rt2500usb_probe_hw_mode(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h
index b493306a7eed..196bd5103e4f 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.h
+++ b/drivers/net/wireless/rt2x00/rt2500usb.h
@@ -189,14 +189,15 @@
189 * MAC_CSR19: GPIO control register. 189 * MAC_CSR19: GPIO control register.
190 */ 190 */
191#define MAC_CSR19 0x0426 191#define MAC_CSR19 0x0426
192#define MAC_CSR19_BIT0 FIELD32(0x0001) 192#define MAC_CSR19_BIT0 FIELD16(0x0001)
193#define MAC_CSR19_BIT1 FIELD32(0x0002) 193#define MAC_CSR19_BIT1 FIELD16(0x0002)
194#define MAC_CSR19_BIT2 FIELD32(0x0004) 194#define MAC_CSR19_BIT2 FIELD16(0x0004)
195#define MAC_CSR19_BIT3 FIELD32(0x0008) 195#define MAC_CSR19_BIT3 FIELD16(0x0008)
196#define MAC_CSR19_BIT4 FIELD32(0x0010) 196#define MAC_CSR19_BIT4 FIELD16(0x0010)
197#define MAC_CSR19_BIT5 FIELD32(0x0020) 197#define MAC_CSR19_BIT5 FIELD16(0x0020)
198#define MAC_CSR19_BIT6 FIELD32(0x0040) 198#define MAC_CSR19_BIT6 FIELD16(0x0040)
199#define MAC_CSR19_BIT7 FIELD32(0x0080) 199#define MAC_CSR19_BIT7 FIELD16(0x0080)
200#define MAC_CSR19_BIT8 FIELD16(0x0100)
200 201
201/* 202/*
202 * MAC_CSR20: LED control register. 203 * MAC_CSR20: LED control register.
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index cb8c2aca54e4..b93516d832fb 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4089,6 +4089,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
4089 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); 4089 rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
4090 msleep(1); 4090 msleep(1);
4091 rt2800_register_read(rt2x00dev, LDO_CFG0, &reg); 4091 rt2800_register_read(rt2x00dev, LDO_CFG0, &reg);
4092 rt2x00_set_field32(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 0);
4092 rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1); 4093 rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1);
4093 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); 4094 rt2800_register_write(rt2x00dev, LDO_CFG0, reg);
4094 } 4095 }
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 98aa426a3564..4765bbd654cd 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -983,6 +983,7 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
983static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) 983static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
984{ 984{
985 int retval; 985 int retval;
986 u32 reg;
986 987
987 /* 988 /*
988 * Allocate eeprom data. 989 * Allocate eeprom data.
@@ -996,6 +997,14 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
996 return retval; 997 return retval;
997 998
998 /* 999 /*
1000 * Enable rfkill polling by setting GPIO direction of the
1001 * rfkill switch GPIO pin correctly.
1002 */
1003 rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
1004 rt2x00_set_field32(&reg, GPIO_CTRL_CFG_GPIOD_BIT2, 1);
1005 rt2x00pci_register_write(rt2x00dev, GPIO_CTRL_CFG, reg);
1006
1007 /*
999 * Initialize hw specifications. 1008 * Initialize hw specifications.
1000 */ 1009 */
1001 retval = rt2800_probe_hw_mode(rt2x00dev); 1010 retval = rt2800_probe_hw_mode(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 6cf336595e25..6b4226b71618 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -667,8 +667,16 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
667 skb_pull(entry->skb, RXINFO_DESC_SIZE); 667 skb_pull(entry->skb, RXINFO_DESC_SIZE);
668 668
669 /* 669 /*
670 * FIXME: we need to check for rx_pkt_len validity 670 * Check for rx_pkt_len validity. Return if invalid, leaving
671 * rxdesc->size zeroed out by the upper level.
671 */ 672 */
673 if (unlikely(rx_pkt_len == 0 ||
674 rx_pkt_len > entry->queue->data_size)) {
675 ERROR(entry->queue->rt2x00dev,
676 "Bad frame size %d, forcing to 0\n", rx_pkt_len);
677 return;
678 }
679
672 rxd = (__le32 *)(entry->skb->data + rx_pkt_len); 680 rxd = (__le32 *)(entry->skb->data + rx_pkt_len);
673 681
674 /* 682 /*
@@ -736,6 +744,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
736static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) 744static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
737{ 745{
738 int retval; 746 int retval;
747 u32 reg;
739 748
740 /* 749 /*
741 * Allocate eeprom data. 750 * Allocate eeprom data.
@@ -749,6 +758,14 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
749 return retval; 758 return retval;
750 759
751 /* 760 /*
761 * Enable rfkill polling by setting GPIO direction of the
762 * rfkill switch GPIO pin correctly.
763 */
764 rt2x00usb_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
765 rt2x00_set_field32(&reg, GPIO_CTRL_CFG_GPIOD_BIT2, 1);
766 rt2x00usb_register_write(rt2x00dev, GPIO_CTRL_CFG, reg);
767
768 /*
752 * Initialize hw specifications. 769 * Initialize hw specifications.
753 */ 770 */
754 retval = rt2800_probe_hw_mode(rt2x00dev); 771 retval = rt2800_probe_hw_mode(rt2x00dev);
@@ -1157,6 +1174,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
1157 { USB_DEVICE(0x1690, 0x0744) }, 1174 { USB_DEVICE(0x1690, 0x0744) },
1158 { USB_DEVICE(0x1690, 0x0761) }, 1175 { USB_DEVICE(0x1690, 0x0761) },
1159 { USB_DEVICE(0x1690, 0x0764) }, 1176 { USB_DEVICE(0x1690, 0x0764) },
1177 /* ASUS */
1178 { USB_DEVICE(0x0b05, 0x179d) },
1160 /* Cisco */ 1179 /* Cisco */
1161 { USB_DEVICE(0x167b, 0x4001) }, 1180 { USB_DEVICE(0x167b, 0x4001) },
1162 /* EnGenius */ 1181 /* EnGenius */
@@ -1222,7 +1241,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
1222 { USB_DEVICE(0x0b05, 0x1760) }, 1241 { USB_DEVICE(0x0b05, 0x1760) },
1223 { USB_DEVICE(0x0b05, 0x1761) }, 1242 { USB_DEVICE(0x0b05, 0x1761) },
1224 { USB_DEVICE(0x0b05, 0x1790) }, 1243 { USB_DEVICE(0x0b05, 0x1790) },
1225 { USB_DEVICE(0x0b05, 0x179d) },
1226 /* AzureWave */ 1244 /* AzureWave */
1227 { USB_DEVICE(0x13d3, 0x3262) }, 1245 { USB_DEVICE(0x13d3, 0x3262) },
1228 { USB_DEVICE(0x13d3, 0x3284) }, 1246 { USB_DEVICE(0x13d3, 0x3284) },
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index a6b88bd4a1a5..3f07e36f462b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -629,7 +629,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)
629 */ 629 */
630 if (unlikely(rxdesc.size == 0 || 630 if (unlikely(rxdesc.size == 0 ||
631 rxdesc.size > entry->queue->data_size)) { 631 rxdesc.size > entry->queue->data_size)) {
632 WARNING(rt2x00dev, "Wrong frame size %d max %d.\n", 632 ERROR(rt2x00dev, "Wrong frame size %d max %d.\n",
633 rxdesc.size, entry->queue->data_size); 633 rxdesc.size, entry->queue->data_size);
634 dev_kfree_skb(entry->skb); 634 dev_kfree_skb(entry->skb);
635 goto renew_skb; 635 goto renew_skb;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 3f7bc5cadf9a..b8ec96163922 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2832,6 +2832,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2832static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) 2832static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
2833{ 2833{
2834 int retval; 2834 int retval;
2835 u32 reg;
2835 2836
2836 /* 2837 /*
2837 * Disable power saving. 2838 * Disable power saving.
@@ -2850,6 +2851,14 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
2850 return retval; 2851 return retval;
2851 2852
2852 /* 2853 /*
2854 * Enable rfkill polling by setting GPIO direction of the
2855 * rfkill switch GPIO pin correctly.
2856 */
2857 rt2x00pci_register_read(rt2x00dev, MAC_CSR13, &reg);
2858 rt2x00_set_field32(&reg, MAC_CSR13_BIT13, 1);
2859 rt2x00pci_register_write(rt2x00dev, MAC_CSR13, reg);
2860
2861 /*
2853 * Initialize hw specifications. 2862 * Initialize hw specifications.
2854 */ 2863 */
2855 retval = rt61pci_probe_hw_mode(rt2x00dev); 2864 retval = rt61pci_probe_hw_mode(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h
index e3cd6db76b0e..8f3da5a56766 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.h
+++ b/drivers/net/wireless/rt2x00/rt61pci.h
@@ -372,6 +372,7 @@ struct hw_pairwise_ta_entry {
372#define MAC_CSR13_BIT10 FIELD32(0x00000400) 372#define MAC_CSR13_BIT10 FIELD32(0x00000400)
373#define MAC_CSR13_BIT11 FIELD32(0x00000800) 373#define MAC_CSR13_BIT11 FIELD32(0x00000800)
374#define MAC_CSR13_BIT12 FIELD32(0x00001000) 374#define MAC_CSR13_BIT12 FIELD32(0x00001000)
375#define MAC_CSR13_BIT13 FIELD32(0x00002000)
375 376
376/* 377/*
377 * MAC_CSR14: LED control register. 378 * MAC_CSR14: LED control register.
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index ba6e434b859d..248436c13ce0 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2177static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) 2177static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
2178{ 2178{
2179 int retval; 2179 int retval;
2180 u32 reg;
2180 2181
2181 /* 2182 /*
2182 * Allocate eeprom data. 2183 * Allocate eeprom data.
@@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
2190 return retval; 2191 return retval;
2191 2192
2192 /* 2193 /*
2194 * Enable rfkill polling by setting GPIO direction of the
2195 * rfkill switch GPIO pin correctly.
2196 */
2197 rt2x00usb_register_read(rt2x00dev, MAC_CSR13, &reg);
2198 rt2x00_set_field32(&reg, MAC_CSR13_BIT15, 0);
2199 rt2x00usb_register_write(rt2x00dev, MAC_CSR13, reg);
2200
2201 /*
2193 * Initialize hw specifications. 2202 * Initialize hw specifications.
2194 */ 2203 */
2195 retval = rt73usb_probe_hw_mode(rt2x00dev); 2204 retval = rt73usb_probe_hw_mode(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h
index 9f6b470414d3..df1cc116b83b 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.h
+++ b/drivers/net/wireless/rt2x00/rt73usb.h
@@ -282,6 +282,9 @@ struct hw_pairwise_ta_entry {
282#define MAC_CSR13_BIT10 FIELD32(0x00000400) 282#define MAC_CSR13_BIT10 FIELD32(0x00000400)
283#define MAC_CSR13_BIT11 FIELD32(0x00000800) 283#define MAC_CSR13_BIT11 FIELD32(0x00000800)
284#define MAC_CSR13_BIT12 FIELD32(0x00001000) 284#define MAC_CSR13_BIT12 FIELD32(0x00001000)
285#define MAC_CSR13_BIT13 FIELD32(0x00002000)
286#define MAC_CSR13_BIT14 FIELD32(0x00004000)
287#define MAC_CSR13_BIT15 FIELD32(0x00008000)
285 288
286/* 289/*
287 * MAC_CSR14: LED control register. 290 * MAC_CSR14: LED control register.