Skip to content

Commit 10cec91

Browse files
committed
Merge tag 'usb-4.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a number of small USB driver fixes and new device ids for 4.13-rc5. There is the usual gadget driver fixes, some new quirks for "messy" hardware, and some new device ids. All have been in linux-next with no reported issues" * tag 'usb-4.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: serial: pl2303: add new ATEN device id usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter USB: Check for dropped connection before switching to full speed usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume usb: renesas_usbhs: gadget: fix unused-but-set-variable warning usb: renesas_usbhs: Fix UGCTRL2 value for R-Car Gen3 usb: phy: phy-msm-usb: Fix usage of devm_regulator_bulk_get() usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling usb: dwc3: gadget: Correct ISOC DATA PIDs for short packets USB: serial: option: add D-Link DWM-222 device ID usb: musb: fix tx fifo flush handling again usb: core: unlink urbs from the tail of the endpoint's urb_list usb-storage: fix deadlock involving host lock and scsi_done uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069 USB: hcd: Mark secondary HCD as dead if the primary one died USB: serial: cp210x: add support for Qivicon USB ZigBee dongle
2 parents 89a5527 + 3b6bcd3 commit 10cec91

File tree

16 files changed

+111
-38
lines changed

16 files changed

+111
-38
lines changed

drivers/usb/core/hcd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
18881888
/* No more submits can occur */
18891889
spin_lock_irq(&hcd_urb_list_lock);
18901890
rescan:
1891-
list_for_each_entry (urb, &ep->urb_list, urb_list) {
1891+
list_for_each_entry_reverse(urb, &ep->urb_list, urb_list) {
18921892
int is_in;
18931893

18941894
if (urb->unlinked)
@@ -2485,6 +2485,8 @@ void usb_hc_died (struct usb_hcd *hcd)
24852485
}
24862486
if (usb_hcd_is_primary_hcd(hcd) && hcd->shared_hcd) {
24872487
hcd = hcd->shared_hcd;
2488+
clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags);
2489+
set_bit(HCD_FLAG_DEAD, &hcd->flags);
24882490
if (hcd->rh_registered) {
24892491
clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
24902492

drivers/usb/core/hub.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4725,7 +4725,8 @@ hub_power_remaining(struct usb_hub *hub)
47254725
static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
47264726
u16 portchange)
47274727
{
4728-
int status, i;
4728+
int status = -ENODEV;
4729+
int i;
47294730
unsigned unit_load;
47304731
struct usb_device *hdev = hub->hdev;
47314732
struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
@@ -4929,9 +4930,10 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
49294930

49304931
done:
49314932
hub_port_disable(hub, port1, 1);
4932-
if (hcd->driver->relinquish_port && !hub->hdev->parent)
4933-
hcd->driver->relinquish_port(hcd, port1);
4934-
4933+
if (hcd->driver->relinquish_port && !hub->hdev->parent) {
4934+
if (status != -ENOTCONN && status != -ENODEV)
4935+
hcd->driver->relinquish_port(hcd, port1);
4936+
}
49354937
}
49364938

49374939
/* Handle physical or logical connection change events.

drivers/usb/core/quirks.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ static const struct usb_device_id usb_quirk_list[] = {
150150
/* appletouch */
151151
{ USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
152152

153+
/* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */
154+
{ USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM },
155+
153156
/* Avision AV600U */
154157
{ USB_DEVICE(0x0638, 0x0a13), .driver_info =
155158
USB_QUIRK_STRING_FETCH_255 },
@@ -249,6 +252,7 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = {
249252
{ USB_DEVICE(0x093a, 0x2500), .driver_info = USB_QUIRK_RESET_RESUME },
250253
{ USB_DEVICE(0x093a, 0x2510), .driver_info = USB_QUIRK_RESET_RESUME },
251254
{ USB_DEVICE(0x093a, 0x2521), .driver_info = USB_QUIRK_RESET_RESUME },
255+
{ USB_DEVICE(0x03f0, 0x2b4a), .driver_info = USB_QUIRK_RESET_RESUME },
252256

253257
/* Logitech Optical Mouse M90/M100 */
254258
{ USB_DEVICE(0x046d, 0xc05a), .driver_info = USB_QUIRK_RESET_RESUME },

drivers/usb/dwc3/gadget.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,40 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb,
896896
if (!node) {
897897
trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
898898

899+
/*
900+
* USB Specification 2.0 Section 5.9.2 states that: "If
901+
* there is only a single transaction in the microframe,
902+
* only a DATA0 data packet PID is used. If there are
903+
* two transactions per microframe, DATA1 is used for
904+
* the first transaction data packet and DATA0 is used
905+
* for the second transaction data packet. If there are
906+
* three transactions per microframe, DATA2 is used for
907+
* the first transaction data packet, DATA1 is used for
908+
* the second, and DATA0 is used for the third."
909+
*
910+
* IOW, we should satisfy the following cases:
911+
*
912+
* 1) length <= maxpacket
913+
* - DATA0
914+
*
915+
* 2) maxpacket < length <= (2 * maxpacket)
916+
* - DATA1, DATA0
917+
*
918+
* 3) (2 * maxpacket) < length <= (3 * maxpacket)
919+
* - DATA2, DATA1, DATA0
920+
*/
899921
if (speed == USB_SPEED_HIGH) {
900922
struct usb_ep *ep = &dep->endpoint;
901-
trb->size |= DWC3_TRB_SIZE_PCM1(ep->mult - 1);
923+
unsigned int mult = ep->mult - 1;
924+
unsigned int maxp = usb_endpoint_maxp(ep->desc);
925+
926+
if (length <= (2 * maxp))
927+
mult--;
928+
929+
if (length <= maxp)
930+
mult--;
931+
932+
trb->size |= DWC3_TRB_SIZE_PCM1(mult);
902933
}
903934
} else {
904935
trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS;

drivers/usb/gadget/udc/renesas_usb3.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,21 +838,32 @@ static struct renesas_usb3_request *usb3_get_request(struct renesas_usb3_ep
838838
return usb3_req;
839839
}
840840

841-
static void usb3_request_done(struct renesas_usb3_ep *usb3_ep,
842-
struct renesas_usb3_request *usb3_req, int status)
841+
static void __usb3_request_done(struct renesas_usb3_ep *usb3_ep,
842+
struct renesas_usb3_request *usb3_req,
843+
int status)
843844
{
844845
struct renesas_usb3 *usb3 = usb3_ep_to_usb3(usb3_ep);
845-
unsigned long flags;
846846

847847
dev_dbg(usb3_to_dev(usb3), "giveback: ep%2d, %u, %u, %d\n",
848848
usb3_ep->num, usb3_req->req.length, usb3_req->req.actual,
849849
status);
850850
usb3_req->req.status = status;
851-
spin_lock_irqsave(&usb3->lock, flags);
852851
usb3_ep->started = false;
853852
list_del_init(&usb3_req->queue);
854-
spin_unlock_irqrestore(&usb3->lock, flags);
853+
spin_unlock(&usb3->lock);
855854
usb_gadget_giveback_request(&usb3_ep->ep, &usb3_req->req);
855+
spin_lock(&usb3->lock);
856+
}
857+
858+
static void usb3_request_done(struct renesas_usb3_ep *usb3_ep,
859+
struct renesas_usb3_request *usb3_req, int status)
860+
{
861+
struct renesas_usb3 *usb3 = usb3_ep_to_usb3(usb3_ep);
862+
unsigned long flags;
863+
864+
spin_lock_irqsave(&usb3->lock, flags);
865+
__usb3_request_done(usb3_ep, usb3_req, status);
866+
spin_unlock_irqrestore(&usb3->lock, flags);
856867
}
857868

858869
static void usb3_irq_epc_pipe0_status_end(struct renesas_usb3 *usb3)

drivers/usb/host/pci-quirks.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ enum amd_chipset_gen {
9898
AMD_CHIPSET_HUDSON2,
9999
AMD_CHIPSET_BOLTON,
100100
AMD_CHIPSET_YANGTZE,
101+
AMD_CHIPSET_TAISHAN,
101102
AMD_CHIPSET_UNKNOWN,
102103
};
103104

@@ -141,6 +142,11 @@ static int amd_chipset_sb_type_init(struct amd_chipset_info *pinfo)
141142
pinfo->sb_type.gen = AMD_CHIPSET_SB700;
142143
else if (rev >= 0x40 && rev <= 0x4f)
143144
pinfo->sb_type.gen = AMD_CHIPSET_SB800;
145+
}
146+
pinfo->smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
147+
0x145c, NULL);
148+
if (pinfo->smbus_dev) {
149+
pinfo->sb_type.gen = AMD_CHIPSET_TAISHAN;
144150
} else {
145151
pinfo->smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
146152
PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, NULL);
@@ -260,11 +266,12 @@ int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev)
260266
{
261267
/* Make sure amd chipset type has already been initialized */
262268
usb_amd_find_chipset_info();
263-
if (amd_chipset.sb_type.gen != AMD_CHIPSET_YANGTZE)
264-
return 0;
265-
266-
dev_dbg(&pdev->dev, "QUIRK: Enable AMD remote wakeup fix\n");
267-
return 1;
269+
if (amd_chipset.sb_type.gen == AMD_CHIPSET_YANGTZE ||
270+
amd_chipset.sb_type.gen == AMD_CHIPSET_TAISHAN) {
271+
dev_dbg(&pdev->dev, "QUIRK: Enable AMD remote wakeup fix\n");
272+
return 1;
273+
}
274+
return 0;
268275
}
269276
EXPORT_SYMBOL_GPL(usb_hcd_amd_remote_wakeup_quirk);
270277

drivers/usb/musb/musb_host.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
139139
"Could not flush host TX%d fifo: csr: %04x\n",
140140
ep->epnum, csr))
141141
return;
142+
mdelay(1);
142143
}
143144
}
144145

drivers/usb/phy/phy-msm-usb.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ struct msm_otg {
197197
struct regulator *v3p3;
198198
struct regulator *v1p8;
199199
struct regulator *vddcx;
200+
struct regulator_bulk_data supplies[3];
200201

201202
struct reset_control *phy_rst;
202203
struct reset_control *link_rst;
@@ -1731,7 +1732,6 @@ static int msm_otg_reboot_notify(struct notifier_block *this,
17311732

17321733
static int msm_otg_probe(struct platform_device *pdev)
17331734
{
1734-
struct regulator_bulk_data regs[3];
17351735
int ret = 0;
17361736
struct device_node *np = pdev->dev.of_node;
17371737
struct msm_otg_platform_data *pdata;
@@ -1817,17 +1817,18 @@ static int msm_otg_probe(struct platform_device *pdev)
18171817
return motg->irq;
18181818
}
18191819

1820-
regs[0].supply = "vddcx";
1821-
regs[1].supply = "v3p3";
1822-
regs[2].supply = "v1p8";
1820+
motg->supplies[0].supply = "vddcx";
1821+
motg->supplies[1].supply = "v3p3";
1822+
motg->supplies[2].supply = "v1p8";
18231823

1824-
ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
1824+
ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(motg->supplies),
1825+
motg->supplies);
18251826
if (ret)
18261827
return ret;
18271828

1828-
motg->vddcx = regs[0].consumer;
1829-
motg->v3p3 = regs[1].consumer;
1830-
motg->v1p8 = regs[2].consumer;
1829+
motg->vddcx = motg->supplies[0].consumer;
1830+
motg->v3p3 = motg->supplies[1].consumer;
1831+
motg->v1p8 = motg->supplies[2].consumer;
18311832

18321833
clk_set_rate(motg->clk, 60000000);
18331834

drivers/usb/renesas_usbhs/mod_gadget.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,14 +639,11 @@ static int usbhsg_ep_disable(struct usb_ep *ep)
639639
struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
640640
struct usbhs_pipe *pipe;
641641
unsigned long flags;
642-
int ret = 0;
643642

644643
spin_lock_irqsave(&uep->lock, flags);
645644
pipe = usbhsg_uep_to_pipe(uep);
646-
if (!pipe) {
647-
ret = -EINVAL;
645+
if (!pipe)
648646
goto out;
649-
}
650647

651648
usbhsg_pipe_disable(uep);
652649
usbhs_pipe_free(pipe);

drivers/usb/renesas_usbhs/rcar3.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
/* Low Power Status register (LPSTS) */
2121
#define LPSTS_SUSPM 0x4000
2222

23-
/* USB General control register 2 (UGCTRL2), bit[31:6] should be 0 */
23+
/*
24+
* USB General control register 2 (UGCTRL2)
25+
* Remarks: bit[31:11] and bit[9:6] should be 0
26+
*/
2427
#define UGCTRL2_RESERVED_3 0x00000001 /* bit[3:0] should be B'0001 */
2528
#define UGCTRL2_USB0SEL_OTG 0x00000030
29+
#define UGCTRL2_VBUSSEL 0x00000400
2630

2731
static void usbhs_write32(struct usbhs_priv *priv, u32 reg, u32 data)
2832
{
@@ -34,7 +38,8 @@ static int usbhs_rcar3_power_ctrl(struct platform_device *pdev,
3438
{
3539
struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
3640

37-
usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG);
41+
usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG |
42+
UGCTRL2_VBUSSEL);
3843

3944
if (enable) {
4045
usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM);

drivers/usb/serial/cp210x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static const struct usb_device_id id_table[] = {
142142
{ USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
143143
{ USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
144144
{ USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
145+
{ USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
145146
{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
146147
{ USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
147148
{ USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */

drivers/usb/serial/option.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,8 @@ static const struct usb_device_id option_ids[] = {
20252025
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d04, 0xff) }, /* D-Link DWM-158 */
20262026
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff), /* D-Link DWM-221 B1 */
20272027
.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2028+
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */
2029+
.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
20282030
{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
20292031
{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
20302032
{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */

drivers/usb/serial/pl2303.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ static const struct usb_device_id id_table[] = {
5252
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
5353
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID),
5454
.driver_info = PL2303_QUIRK_ENDPOINT_HACK },
55+
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_UC485),
56+
.driver_info = PL2303_QUIRK_ENDPOINT_HACK },
5557
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) },
5658
{ USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) },
5759
{ USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },

drivers/usb/serial/pl2303.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define ATEN_VENDOR_ID 0x0557
2828
#define ATEN_VENDOR_ID2 0x0547
2929
#define ATEN_PRODUCT_ID 0x2008
30+
#define ATEN_PRODUCT_UC485 0x2021
3031
#define ATEN_PRODUCT_ID2 0x2118
3132

3233
#define IODATA_VENDOR_ID 0x04bb

drivers/usb/storage/unusual_uas.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x9999,
124124
/* Reported-by: Benjamin Tissoires <[email protected]> */
125125
UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999,
126126
"Initio Corporation",
127-
"",
127+
"INIC-3069",
128128
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
129-
US_FL_NO_ATA_1X),
129+
US_FL_NO_ATA_1X | US_FL_IGNORE_RESIDUE),
130130

131131
/* Reported-by: Tom Arild Naess <[email protected]> */
132132
UNUSUAL_DEV(0x152d, 0x0539, 0x0000, 0x9999,

drivers/usb/storage/usb.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ static int usb_stor_control_thread(void * __us)
315315
{
316316
struct us_data *us = (struct us_data *)__us;
317317
struct Scsi_Host *host = us_to_host(us);
318+
struct scsi_cmnd *srb;
318319

319320
for (;;) {
320321
usb_stor_dbg(us, "*** thread sleeping\n");
@@ -330,6 +331,7 @@ static int usb_stor_control_thread(void * __us)
330331
scsi_lock(host);
331332

332333
/* When we are called with no command pending, we're done */
334+
srb = us->srb;
333335
if (us->srb == NULL) {
334336
scsi_unlock(host);
335337
mutex_unlock(&us->dev_mutex);
@@ -398,14 +400,11 @@ static int usb_stor_control_thread(void * __us)
398400
/* lock access to the state */
399401
scsi_lock(host);
400402

401-
/* indicate that the command is done */
402-
if (us->srb->result != DID_ABORT << 16) {
403-
usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
404-
us->srb->result);
405-
us->srb->scsi_done(us->srb);
406-
} else {
403+
/* was the command aborted? */
404+
if (us->srb->result == DID_ABORT << 16) {
407405
SkipForAbort:
408406
usb_stor_dbg(us, "scsi command aborted\n");
407+
srb = NULL; /* Don't call srb->scsi_done() */
409408
}
410409

411410
/*
@@ -429,6 +428,13 @@ static int usb_stor_control_thread(void * __us)
429428

430429
/* unlock the device pointers */
431430
mutex_unlock(&us->dev_mutex);
431+
432+
/* now that the locks are released, notify the SCSI core */
433+
if (srb) {
434+
usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
435+
srb->result);
436+
srb->scsi_done(srb);
437+
}
432438
} /* for (;;) */
433439

434440
/* Wait until we are told to stop */

0 commit comments

Comments
 (0)