Skip to content

Commit 777bf13

Browse files
linvjwdavem330
authored andcommitted
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem
John W. Linville says: ==================== Please pull these fixes intended for 3.6. There are more commits here than I would like -- I got a bit behind while I was stalking Steven Rostedt in San Diego last week... I'll slow it down after this! There are a couple of pulls here. One is from Johannes: "Please pull (according to the below information) to get a few fixes. * a fix to properly disconnect in the driver when authentication or association fails * a fix to prevent invalid information about mesh paths being reported to userspace * a memory leak fix in an nl80211 error path" The other comes via Gustavo: "A few updates for the 3.6 kernel. There are two btusb patches to add more supported devices through the new USB_VENDOR_AND_INTEFACE_INFO() macro and another one that add a new device id for a Sony Vaio laptop, one fix for a user-after-free and, finally, two patches from Vinicius to fix a issue in SMP pairing." Along with those... Arend van Spriel provides a fix for a use-after-free bug in brcmfmac. Daniel Drake avoids a hang by not trying to touch the libertas hardware duing suspend if it is already powered-down. Felix Fietkau provides a batch of ath9k fixes that adress some potential problems with power settings, as well as a fix to avoid a potential interrupt storm. Gertjan van Wingerde provides a register-width fix for rt2x00, and a rt2x00 fix to prevent incorrectly detecting the rfkill status. He also provides a device ID patch. Hante Meuleman gives us three brcmfmac fixes, one that properly initializes a command structure, one that fixes a race condition that could lose usb requests, and one that removes some log spam. Marc Kleine-Budde offers an rt2x00 fix for a voltage setting on some specific devices. Mohammed Shafi Shajakhan sent an ath9k fix to avoid a crash related to using timers that aren't allocated when 2 wire bluetooth coexistence hardware is in use. Sergei Poselenov changes rt2800usb to do some validity checking for received packets, avoiding crashes on an ARM Soc. Stone Piao gives us an mwifiex fix for an incorrectly set skb length value for a command buffer. All of these are localized to their specific drivers, and relatively small. The power-related patches from Felix are bigger than I would like, but I merged them in consideration of their isolation to ath9k and the sensitive nature of power settings in wireless devices. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b8dfc6a + f107238 commit 777bf13

34 files changed

Lines changed: 297 additions & 76 deletions

File tree

‎drivers/bluetooth/ath3k.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ static struct usb_device_id ath3k_table[] = {
8686

8787
/* Atheros AR5BBU22 with sflash firmware */
8888
{ USB_DEVICE(0x0489, 0xE03C) },
89+
{ USB_DEVICE(0x0489, 0xE036) },
8990

9091
{ } /* Terminating entry */
9192
};
@@ -109,6 +110,7 @@ static struct usb_device_id ath3k_blist_tbl[] = {
109110

110111
/* Atheros AR5BBU22 with sflash firmware */
111112
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
113+
{ USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 },
112114

113115
{ } /* Terminating entry */
114116
};

‎drivers/bluetooth/btusb.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ static struct usb_device_id btusb_table[] = {
5252
/* Generic Bluetooth USB device */
5353
{ USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
5454

55+
/* Apple-specific (Broadcom) devices */
56+
{ USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) },
57+
5558
/* Broadcom SoftSailing reporting vendor specific */
5659
{ USB_DEVICE(0x0a5c, 0x21e1) },
5760

@@ -94,16 +97,14 @@ static struct usb_device_id btusb_table[] = {
9497

9598
/* Broadcom BCM20702A0 */
9699
{ USB_DEVICE(0x0489, 0xe042) },
97-
{ USB_DEVICE(0x0a5c, 0x21e3) },
98-
{ USB_DEVICE(0x0a5c, 0x21e6) },
99-
{ USB_DEVICE(0x0a5c, 0x21e8) },
100-
{ USB_DEVICE(0x0a5c, 0x21f3) },
101-
{ USB_DEVICE(0x0a5c, 0x21f4) },
102100
{ USB_DEVICE(0x413c, 0x8197) },
103101

104102
/* Foxconn - Hon Hai */
105103
{ USB_DEVICE(0x0489, 0xe033) },
106104

105+
/*Broadcom devices with vendor specific id */
106+
{ USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
107+
107108
{ } /* Terminating entry */
108109
};
109110

@@ -141,6 +142,7 @@ static struct usb_device_id blacklist_table[] = {
141142

142143
/* Atheros AR5BBU12 with sflash firmware */
143144
{ USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
145+
{ USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 },
144146

145147
/* Broadcom BCM2035 */
146148
{ USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },

‎drivers/net/wireless/ath/ath9k/ar9003_paprd.c‎

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
142142
};
143143
int training_power;
144144
int i, val;
145+
u32 am2pm_mask = ah->paprd_ratemask;
145146

146147
if (IS_CHAN_2GHZ(ah->curchan))
147148
training_power = ar9003_get_training_power_2g(ah);
@@ -158,10 +159,13 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
158159
}
159160
ah->paprd_training_power = training_power;
160161

162+
if (AR_SREV_9330(ah))
163+
am2pm_mask = 0;
164+
161165
REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK,
162166
ah->paprd_ratemask);
163167
REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK,
164-
ah->paprd_ratemask);
168+
am2pm_mask);
165169
REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK,
166170
ah->paprd_ratemask_ht40);
167171

@@ -782,6 +786,102 @@ int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain)
782786
}
783787
EXPORT_SYMBOL(ar9003_paprd_setup_gain_table);
784788

789+
static 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+
785885
int ar9003_paprd_create_curve(struct ath_hw *ah,
786886
struct ath9k_hw_cal_data *caldata, int chain)
787887
{
@@ -817,6 +917,9 @@ int ar9003_paprd_create_curve(struct ath_hw *ah,
817917
if (!create_pa_curve(data_L, data_U, pa_table, small_signal_gain))
818918
status = -2;
819919

920+
if (ar9003_paprd_retrain_pa_in(ah, caldata, chain))
921+
status = -EINPROGRESS;
922+
820923
REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1,
821924
AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE);
822925

‎drivers/net/wireless/ath/ath9k/ar9003_phy.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,10 @@
625625
#define AR_PHY_AIC_CTRL_4_B0 (AR_SM_BASE + 0x4c0)
626626
#define AR_PHY_AIC_STAT_2_B0 (AR_SM_BASE + 0x4cc)
627627

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+
628632
#define AR_PHY_65NM_CH0_SYNTH4 0x1608c
629633
#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT (AR_SREV_9462(ah) ? 0x00000001 : 0x00000002)
630634
#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT_S (AR_SREV_9462(ah) ? 0 : 1)

‎drivers/net/wireless/ath/ath9k/gpio.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc)
341341
{
342342
struct ath_btcoex *btcoex = &sc->btcoex;
343343

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);
345346
}
346347

347348
u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen)

‎drivers/net/wireless/ath/ath9k/hw.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah)
463463
ah->config.spurchans[i][1] = AR_NO_SPUR;
464464
}
465465

466-
/* PAPRD needs some more work to be enabled */
467-
ah->config.paprd_disable = 1;
468-
469466
ah->config.rx_intr_mitigation = true;
470467
ah->config.pcieSerDesWrite = true;
471468

@@ -978,9 +975,6 @@ static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
978975
else
979976
imr_reg |= AR_IMR_TXOK;
980977

981-
if (opmode == NL80211_IFTYPE_AP)
982-
imr_reg |= AR_IMR_MIB;
983-
984978
ENABLE_REGWRITE_BUFFER(ah);
985979

986980
REG_WRITE(ah, AR_IMR, imr_reg);
@@ -1778,6 +1772,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
17781772
/* Operating channel changed, reset channel calibration data */
17791773
memset(caldata, 0, sizeof(*caldata));
17801774
ath9k_init_nfcal_hist_buffer(ah, chan);
1775+
} else if (caldata) {
1776+
caldata->paprd_packet_sent = false;
17811777
}
17821778
ah->noise = ath9k_hw_getchan_noise(ah, chan);
17831779

@@ -2502,7 +2498,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
25022498
pCap->tx_desc_len = sizeof(struct ar9003_txc);
25032499
pCap->txs_len = sizeof(struct ar9003_txs);
25042500
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))
25062503
pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
25072504
} else {
25082505
pCap->tx_desc_len = sizeof(struct ath_desc);

‎drivers/net/wireless/ath/ath9k/hw.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ struct ath9k_hw_cal_data {
405405
int8_t iCoff;
406406
int8_t qCoff;
407407
bool rtt_done;
408+
bool paprd_packet_sent;
408409
bool paprd_done;
409410
bool nfcal_pending;
410411
bool nfcal_interference;

‎drivers/net/wireless/ath/ath9k/link.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ void ath_paprd_calibrate(struct work_struct *work)
254254
int chain_ok = 0;
255255
int chain;
256256
int len = 1800;
257+
int ret;
257258

258-
if (!caldata)
259+
if (!caldata || !caldata->paprd_packet_sent || caldata->paprd_done)
259260
return;
260261

261262
ath9k_ps_wakeup(sc);
@@ -282,13 +283,6 @@ void ath_paprd_calibrate(struct work_struct *work)
282283
continue;
283284

284285
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-
292286
ar9003_paprd_setup_gain_table(ah, chain);
293287

294288
ath_dbg(common, CALIBRATE,
@@ -302,7 +296,13 @@ void ath_paprd_calibrate(struct work_struct *work)
302296
break;
303297
}
304298

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) {
306306
ath_dbg(common, CALIBRATE,
307307
"PAPRD create curve failed on chain %d\n",
308308
chain);

‎drivers/net/wireless/ath/ath9k/xmit.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,6 +2018,9 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
20182018

20192019
ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb);
20202020

2021+
if (sc->sc_ah->caldata)
2022+
sc->sc_ah->caldata->paprd_packet_sent = true;
2023+
20212024
if (!(tx_flags & ATH_TX_ERROR))
20222025
/* Frame was ACKed */
20232026
tx_info->flags |= IEEE80211_TX_STAT_ACK;

‎drivers/net/wireless/brcm80211/brcmfmac/usb.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ static void brcmf_usb_tx_complete(struct urb *urb)
519519
else
520520
devinfo->bus_pub.bus->dstats.tx_errors++;
521521

522-
dev_kfree_skb(req->skb);
522+
brcmu_pkt_buf_free_skb(req->skb);
523523
req->skb = NULL;
524524
brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req);
525525

@@ -540,7 +540,7 @@ static void brcmf_usb_rx_complete(struct urb *urb)
540540
devinfo->bus_pub.bus->dstats.rx_packets++;
541541
} else {
542542
devinfo->bus_pub.bus->dstats.rx_errors++;
543-
dev_kfree_skb(skb);
543+
brcmu_pkt_buf_free_skb(skb);
544544
brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
545545
return;
546546
}
@@ -550,13 +550,15 @@ static void brcmf_usb_rx_complete(struct urb *urb)
550550
if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) {
551551
brcmf_dbg(ERROR, "rx protocol error\n");
552552
brcmu_pkt_buf_free_skb(skb);
553+
brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
553554
devinfo->bus_pub.bus->dstats.rx_errors++;
554555
} else {
555556
brcmf_rx_packet(devinfo->dev, ifidx, skb);
556557
brcmf_usb_rx_refill(devinfo, req);
557558
}
558559
} else {
559-
dev_kfree_skb(skb);
560+
brcmu_pkt_buf_free_skb(skb);
561+
brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
560562
}
561563
return;
562564

@@ -581,14 +583,13 @@ static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
581583
usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->rx_pipe,
582584
skb->data, skb_tailroom(skb), brcmf_usb_rx_complete,
583585
req);
584-
req->urb->transfer_flags |= URB_ZERO_PACKET;
585586
req->devinfo = devinfo;
587+
brcmf_usb_enq(devinfo, &devinfo->rx_postq, req);
586588

587589
ret = usb_submit_urb(req->urb, GFP_ATOMIC);
588-
if (ret == 0) {
589-
brcmf_usb_enq(devinfo, &devinfo->rx_postq, req);
590-
} else {
591-
dev_kfree_skb(req->skb);
590+
if (ret) {
591+
brcmf_usb_del_fromq(devinfo, req);
592+
brcmu_pkt_buf_free_skb(req->skb);
592593
req->skb = NULL;
593594
brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
594595
}
@@ -683,23 +684,22 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb)
683684

684685
req = brcmf_usb_deq(devinfo, &devinfo->tx_freeq);
685686
if (!req) {
687+
brcmu_pkt_buf_free_skb(skb);
686688
brcmf_dbg(ERROR, "no req to send\n");
687689
return -ENOMEM;
688690
}
689-
if (!req->urb) {
690-
brcmf_dbg(ERROR, "no urb for req %p\n", req);
691-
return -ENOBUFS;
692-
}
693691

694692
req->skb = skb;
695693
req->devinfo = devinfo;
696694
usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->tx_pipe,
697695
skb->data, skb->len, brcmf_usb_tx_complete, req);
698696
req->urb->transfer_flags |= URB_ZERO_PACKET;
697+
brcmf_usb_enq(devinfo, &devinfo->tx_postq, req);
699698
ret = usb_submit_urb(req->urb, GFP_ATOMIC);
700-
if (!ret) {
701-
brcmf_usb_enq(devinfo, &devinfo->tx_postq, req);
702-
} else {
699+
if (ret) {
700+
brcmf_dbg(ERROR, "brcmf_usb_tx usb_submit_urb FAILED\n");
701+
brcmf_usb_del_fromq(devinfo, req);
702+
brcmu_pkt_buf_free_skb(req->skb);
703703
req->skb = NULL;
704704
brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req);
705705
}

0 commit comments

Comments
 (0)