Skip to content

Commit 83280e9

Browse files
committed
Merge tag 'usb-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a bunch of USB fixes for 4.10-rc3. Yeah, it's a lot, an artifact of the holiday break I think. Lots of gadget and the usual XHCI fixups for reported issues (one day that driver will calm down...) Also included are a bunch of usb-serial driver fixes, and for good measure, a number of much-reported MUSB driver issues have finally been resolved. All of these have been in linux-next with no reported issues" * tag 'usb-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (72 commits) USB: fix problems with duplicate endpoint addresses usb: ohci-at91: use descriptor-based gpio APIs correctly usb: storage: unusual_uas: Add JMicron JMS56x to unusual device usb: hub: Move hub_port_disable() to fix warning if PM is disabled usb: musb: blackfin: add bfin_fifo_offset in bfin_ops usb: musb: fix compilation warning on unused function usb: musb: Fix trying to free already-free IRQ 4 usb: musb: dsps: implement clear_ep_rxintr() callback usb: musb: core: add clear_ep_rxintr() to musb_platform_ops USB: serial: ti_usb_3410_5052: fix NULL-deref at open USB: serial: spcp8x5: fix NULL-deref at open USB: serial: quatech2: fix sleep-while-atomic in close USB: serial: pl2303: fix NULL-deref at open USB: serial: oti6858: fix NULL-deref at open USB: serial: omninet: fix NULL-derefs at open and disconnect USB: serial: mos7840: fix misleading interrupt-URB comment USB: serial: mos7840: remove unused write URB USB: serial: mos7840: fix NULL-deref at open USB: serial: mos7720: remove obsolete port initialisation USB: serial: mos7720: fix parallel probe ...
2 parents cc250e2 + 0a8fd13 commit 83280e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+550
-316
lines changed

drivers/usb/core/config.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
239239
if (ifp->desc.bNumEndpoints >= num_ep)
240240
goto skip_to_next_endpoint_or_interface_descriptor;
241241

242+
/* Check for duplicate endpoint addresses */
243+
for (i = 0; i < ifp->desc.bNumEndpoints; ++i) {
244+
if (ifp->endpoint[i].desc.bEndpointAddress ==
245+
d->bEndpointAddress) {
246+
dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
247+
cfgno, inum, asnum, d->bEndpointAddress);
248+
goto skip_to_next_endpoint_or_interface_descriptor;
249+
}
250+
}
251+
242252
endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
243253
++ifp->desc.bNumEndpoints;
244254

drivers/usb/core/hub.c

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);
103103

104104
static void hub_release(struct kref *kref);
105105
static int usb_reset_and_verify_device(struct usb_device *udev);
106-
static void hub_usb3_port_prepare_disable(struct usb_hub *hub,
107-
struct usb_port *port_dev);
106+
static int hub_port_disable(struct usb_hub *hub, int port1, int set_state);
108107

109108
static inline char *portspeed(struct usb_hub *hub, int portstatus)
110109
{
@@ -902,34 +901,6 @@ static int hub_set_port_link_state(struct usb_hub *hub, int port1,
902901
USB_PORT_FEAT_LINK_STATE);
903902
}
904903

905-
/*
906-
* USB-3 does not have a similar link state as USB-2 that will avoid negotiating
907-
* a connection with a plugged-in cable but will signal the host when the cable
908-
* is unplugged. Disable remote wake and set link state to U3 for USB-3 devices
909-
*/
910-
static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
911-
{
912-
struct usb_port *port_dev = hub->ports[port1 - 1];
913-
struct usb_device *hdev = hub->hdev;
914-
int ret = 0;
915-
916-
if (!hub->error) {
917-
if (hub_is_superspeed(hub->hdev)) {
918-
hub_usb3_port_prepare_disable(hub, port_dev);
919-
ret = hub_set_port_link_state(hub, port_dev->portnum,
920-
USB_SS_PORT_LS_U3);
921-
} else {
922-
ret = usb_clear_port_feature(hdev, port1,
923-
USB_PORT_FEAT_ENABLE);
924-
}
925-
}
926-
if (port_dev->child && set_state)
927-
usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED);
928-
if (ret && ret != -ENODEV)
929-
dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret);
930-
return ret;
931-
}
932-
933904
/*
934905
* Disable a port and mark a logical connect-change event, so that some
935906
* time later hub_wq will disconnect() any existing usb_device on the port
@@ -4162,6 +4133,34 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
41624133

41634134
#endif /* CONFIG_PM */
41644135

4136+
/*
4137+
* USB-3 does not have a similar link state as USB-2 that will avoid negotiating
4138+
* a connection with a plugged-in cable but will signal the host when the cable
4139+
* is unplugged. Disable remote wake and set link state to U3 for USB-3 devices
4140+
*/
4141+
static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
4142+
{
4143+
struct usb_port *port_dev = hub->ports[port1 - 1];
4144+
struct usb_device *hdev = hub->hdev;
4145+
int ret = 0;
4146+
4147+
if (!hub->error) {
4148+
if (hub_is_superspeed(hub->hdev)) {
4149+
hub_usb3_port_prepare_disable(hub, port_dev);
4150+
ret = hub_set_port_link_state(hub, port_dev->portnum,
4151+
USB_SS_PORT_LS_U3);
4152+
} else {
4153+
ret = usb_clear_port_feature(hdev, port1,
4154+
USB_PORT_FEAT_ENABLE);
4155+
}
4156+
}
4157+
if (port_dev->child && set_state)
4158+
usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED);
4159+
if (ret && ret != -ENODEV)
4160+
dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret);
4161+
return ret;
4162+
}
4163+
41654164

41664165
/* USB 2.0 spec, 7.1.7.3 / fig 7-29:
41674166
*

drivers/usb/dwc2/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3753,7 +3753,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
37533753
hs_ep->desc_list = dma_alloc_coherent(hsotg->dev,
37543754
MAX_DMA_DESC_NUM_GENERIC *
37553755
sizeof(struct dwc2_dma_desc),
3756-
&hs_ep->desc_list_dma, GFP_KERNEL);
3756+
&hs_ep->desc_list_dma, GFP_ATOMIC);
37573757
if (!hs_ep->desc_list) {
37583758
ret = -ENOMEM;
37593759
goto error2;

drivers/usb/dwc2/params.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -247,26 +247,14 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
247247
static void dwc2_get_device_property(struct dwc2_hsotg *hsotg,
248248
char *property, u8 size, u64 *value)
249249
{
250-
u8 val8;
251-
u16 val16;
252250
u32 val32;
253251

254252
switch (size) {
255253
case 0:
256254
*value = device_property_read_bool(hsotg->dev, property);
257255
break;
258256
case 1:
259-
if (device_property_read_u8(hsotg->dev, property, &val8))
260-
return;
261-
262-
*value = val8;
263-
break;
264257
case 2:
265-
if (device_property_read_u16(hsotg->dev, property, &val16))
266-
return;
267-
268-
*value = val16;
269-
break;
270258
case 4:
271259
if (device_property_read_u32(hsotg->dev, property, &val32))
272260
return;
@@ -1100,13 +1088,13 @@ static void dwc2_set_gadget_dma(struct dwc2_hsotg *hsotg)
11001088
/* Buffer DMA */
11011089
dwc2_set_param_bool(hsotg, &p->g_dma,
11021090
false, "gadget-dma",
1103-
true, false,
1091+
dma_capable, false,
11041092
dma_capable);
11051093

11061094
/* DMA Descriptor */
11071095
dwc2_set_param_bool(hsotg, &p->g_dma_desc, false,
11081096
"gadget-dma-desc",
1109-
p->g_dma, false,
1097+
!!hw->dma_desc_enable, false,
11101098
!!hw->dma_desc_enable);
11111099
}
11121100

@@ -1130,8 +1118,14 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg,
11301118

11311119
dwc2_set_param_bool(hsotg, &p->host_dma,
11321120
false, "host-dma",
1133-
true, false,
1121+
dma_capable, false,
11341122
dma_capable);
1123+
dwc2_set_param_host_rx_fifo_size(hsotg,
1124+
params->host_rx_fifo_size);
1125+
dwc2_set_param_host_nperio_tx_fifo_size(hsotg,
1126+
params->host_nperio_tx_fifo_size);
1127+
dwc2_set_param_host_perio_tx_fifo_size(hsotg,
1128+
params->host_perio_tx_fifo_size);
11351129
}
11361130
dwc2_set_param_dma_desc_enable(hsotg, params->dma_desc_enable);
11371131
dwc2_set_param_dma_desc_fs_enable(hsotg, params->dma_desc_fs_enable);
@@ -1140,12 +1134,6 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg,
11401134
params->host_support_fs_ls_low_power);
11411135
dwc2_set_param_enable_dynamic_fifo(hsotg,
11421136
params->enable_dynamic_fifo);
1143-
dwc2_set_param_host_rx_fifo_size(hsotg,
1144-
params->host_rx_fifo_size);
1145-
dwc2_set_param_host_nperio_tx_fifo_size(hsotg,
1146-
params->host_nperio_tx_fifo_size);
1147-
dwc2_set_param_host_perio_tx_fifo_size(hsotg,
1148-
params->host_perio_tx_fifo_size);
11491137
dwc2_set_param_max_transfer_size(hsotg,
11501138
params->max_transfer_size);
11511139
dwc2_set_param_max_packet_count(hsotg,

drivers/usb/dwc3/core.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545
#define DWC3_XHCI_RESOURCES_NUM 2
4646

4747
#define DWC3_SCRATCHBUF_SIZE 4096 /* each buffer is assumed to be 4KiB */
48-
#define DWC3_EVENT_SIZE 4 /* bytes */
49-
#define DWC3_EVENT_MAX_NUM 64 /* 2 events/endpoint */
50-
#define DWC3_EVENT_BUFFERS_SIZE (DWC3_EVENT_SIZE * DWC3_EVENT_MAX_NUM)
48+
#define DWC3_EVENT_BUFFERS_SIZE 4096
5149
#define DWC3_EVENT_TYPE_MASK 0xfe
5250

5351
#define DWC3_EVENT_TYPE_DEV 0
@@ -311,9 +309,8 @@
311309
#define DWC3_DCFG_SUPERSPEED_PLUS (5 << 0) /* DWC_usb31 only */
312310
#define DWC3_DCFG_SUPERSPEED (4 << 0)
313311
#define DWC3_DCFG_HIGHSPEED (0 << 0)
314-
#define DWC3_DCFG_FULLSPEED2 (1 << 0)
312+
#define DWC3_DCFG_FULLSPEED (1 << 0)
315313
#define DWC3_DCFG_LOWSPEED (2 << 0)
316-
#define DWC3_DCFG_FULLSPEED1 (3 << 0)
317314

318315
#define DWC3_DCFG_NUMP_SHIFT 17
319316
#define DWC3_DCFG_NUMP(n) (((n) >> DWC3_DCFG_NUMP_SHIFT) & 0x1f)
@@ -405,9 +402,8 @@
405402
#define DWC3_DSTS_SUPERSPEED_PLUS (5 << 0) /* DWC_usb31 only */
406403
#define DWC3_DSTS_SUPERSPEED (4 << 0)
407404
#define DWC3_DSTS_HIGHSPEED (0 << 0)
408-
#define DWC3_DSTS_FULLSPEED2 (1 << 0)
405+
#define DWC3_DSTS_FULLSPEED (1 << 0)
409406
#define DWC3_DSTS_LOWSPEED (2 << 0)
410-
#define DWC3_DSTS_FULLSPEED1 (3 << 0)
411407

412408
/* Device Generic Command Register */
413409
#define DWC3_DGCMD_SET_LMP 0x01

drivers/usb/dwc3/dwc3-omap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/module.h>
2020
#include <linux/kernel.h>
2121
#include <linux/slab.h>
22+
#include <linux/irq.h>
2223
#include <linux/interrupt.h>
2324
#include <linux/platform_device.h>
2425
#include <linux/platform_data/dwc3-omap.h>
@@ -510,7 +511,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
510511

511512
/* check the DMA Status */
512513
reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
513-
514+
irq_set_status_flags(omap->irq, IRQ_NOAUTOEN);
514515
ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
515516
dwc3_omap_interrupt_thread, IRQF_SHARED,
516517
"dwc3-omap", omap);
@@ -531,7 +532,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
531532
}
532533

533534
dwc3_omap_enable_irqs(omap);
534-
535+
enable_irq(omap->irq);
535536
return 0;
536537

537538
err2:
@@ -552,6 +553,7 @@ static int dwc3_omap_remove(struct platform_device *pdev)
552553
extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
553554
extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
554555
dwc3_omap_disable_irqs(omap);
556+
disable_irq(omap->irq);
555557
of_platform_depopulate(omap->dev);
556558
pm_runtime_put_sync(&pdev->dev);
557559
pm_runtime_disable(&pdev->dev);

drivers/usb/dwc3/dwc3-pci.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa
3939
#define PCI_DEVICE_ID_INTEL_APL 0x5aaa
4040
#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0
41+
#define PCI_DEVICE_ID_INTEL_GLK 0x31aa
4142

4243
#define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
4344
#define PCI_INTEL_BXT_FUNC_PMU_PWR 4
@@ -73,16 +74,6 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
7374
{
7475
struct platform_device *dwc3 = dwc->dwc3;
7576
struct pci_dev *pdev = dwc->pci;
76-
int ret;
77-
78-
struct property_entry sysdev_property[] = {
79-
PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
80-
{ },
81-
};
82-
83-
ret = platform_device_add_properties(dwc3, sysdev_property);
84-
if (ret)
85-
return ret;
8677

8778
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
8879
pdev->device == PCI_DEVICE_ID_AMD_NL_USB) {
@@ -105,6 +96,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
10596
PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
10697
PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
10798
PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
99+
PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
108100
{ },
109101
};
110102

@@ -115,7 +107,8 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
115107
int ret;
116108

117109
struct property_entry properties[] = {
118-
PROPERTY_ENTRY_STRING("dr-mode", "peripheral"),
110+
PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
111+
PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
119112
{ }
120113
};
121114

@@ -167,6 +160,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
167160
PROPERTY_ENTRY_BOOL("snps,usb3_lpm_capable"),
168161
PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
169162
PROPERTY_ENTRY_BOOL("snps,dis_enblslpm_quirk"),
163+
PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
170164
{ },
171165
};
172166

@@ -274,6 +268,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
274268
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), },
275269
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
276270
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
271+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), },
277272
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
278273
{ } /* Terminating Entry */
279274
};

0 commit comments

Comments
 (0)