aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
commit0cb7bf61b1e9f05027de58c80f9b46a714d24e35 (patch)
tree41fb55cf62d07b425122f9a8b96412c0d8eb99c5 /drivers/usb
parentaa877175e7a9982233ed8f10cb4bfddd78d82741 (diff)
parent3eab887a55424fc2c27553b7bfe32330df83f7b8 (diff)
Merge branch 'linus' into smp/hotplug
Apply upstream changes to avoid conflicts with pending patches.
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/class/cdc-acm.c5
-rw-r--r--drivers/usb/class/cdc-acm.h1
-rw-r--r--drivers/usb/core/config.c66
-rw-r--r--drivers/usb/core/devio.c7
-rw-r--r--drivers/usb/core/hub.c23
-rw-r--r--drivers/usb/dwc3/dwc3-of-simple.c1
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c2
-rw-r--r--drivers/usb/dwc3/gadget.c55
-rw-r--r--drivers/usb/gadget/composite.c6
-rw-r--r--drivers/usb/gadget/configfs.c2
-rw-r--r--drivers/usb/gadget/function/rndis.c6
-rw-r--r--drivers/usb/gadget/function/u_ether.c3
-rw-r--r--drivers/usb/gadget/function/uvc_configfs.c2
-rw-r--r--drivers/usb/gadget/legacy/inode.c4
-rw-r--r--drivers/usb/gadget/udc/core.c5
-rw-r--r--drivers/usb/gadget/udc/fsl_qe_udc.c2
-rw-r--r--drivers/usb/host/ehci-hcd.c4
-rw-r--r--drivers/usb/host/max3421-hcd.c2
-rw-r--r--drivers/usb/host/xhci-hub.c3
-rw-r--r--drivers/usb/host/xhci-pci.c3
-rw-r--r--drivers/usb/host/xhci-ring.c16
-rw-r--r--drivers/usb/misc/ftdi-elan.c10
-rw-r--r--drivers/usb/misc/usbtest.c9
-rw-r--r--drivers/usb/phy/phy-omap-otg.c2
-rw-r--r--drivers/usb/renesas_usbhs/common.c3
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c4
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c7
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h12
-rw-r--r--drivers/usb/serial/option.c22
-rw-r--r--drivers/usb/serial/usb-serial.c4
31 files changed, 215 insertions, 79 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 71912301ef7f..0f3f62e81e5b 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1354,7 +1354,6 @@ made_compressed_probe:
1354 spin_lock_init(&acm->write_lock); 1354 spin_lock_init(&acm->write_lock);
1355 spin_lock_init(&acm->read_lock); 1355 spin_lock_init(&acm->read_lock);
1356 mutex_init(&acm->mutex); 1356 mutex_init(&acm->mutex);
1357 acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress);
1358 acm->is_int_ep = usb_endpoint_xfer_int(epread); 1357 acm->is_int_ep = usb_endpoint_xfer_int(epread);
1359 if (acm->is_int_ep) 1358 if (acm->is_int_ep)
1360 acm->bInterval = epread->bInterval; 1359 acm->bInterval = epread->bInterval;
@@ -1394,14 +1393,14 @@ made_compressed_probe:
1394 urb->transfer_dma = rb->dma; 1393 urb->transfer_dma = rb->dma;
1395 if (acm->is_int_ep) { 1394 if (acm->is_int_ep) {
1396 usb_fill_int_urb(urb, acm->dev, 1395 usb_fill_int_urb(urb, acm->dev,
1397 acm->rx_endpoint, 1396 usb_rcvintpipe(usb_dev, epread->bEndpointAddress),
1398 rb->base, 1397 rb->base,
1399 acm->readsize, 1398 acm->readsize,
1400 acm_read_bulk_callback, rb, 1399 acm_read_bulk_callback, rb,
1401 acm->bInterval); 1400 acm->bInterval);
1402 } else { 1401 } else {
1403 usb_fill_bulk_urb(urb, acm->dev, 1402 usb_fill_bulk_urb(urb, acm->dev,
1404 acm->rx_endpoint, 1403 usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress),
1405 rb->base, 1404 rb->base,
1406 acm->readsize, 1405 acm->readsize,
1407 acm_read_bulk_callback, rb); 1406 acm_read_bulk_callback, rb);
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index 05ce308d5d2a..1f1eabfd8462 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -96,7 +96,6 @@ struct acm {
96 struct acm_rb read_buffers[ACM_NR]; 96 struct acm_rb read_buffers[ACM_NR];
97 struct acm_wb *putbuffer; /* for acm_tty_put_char() */ 97 struct acm_wb *putbuffer; /* for acm_tty_put_char() */
98 int rx_buflimit; 98 int rx_buflimit;
99 int rx_endpoint;
100 spinlock_t read_lock; 99 spinlock_t read_lock;
101 int write_used; /* number of non-empty write buffers */ 100 int write_used; /* number of non-empty write buffers */
102 int transmitting; 101 int transmitting;
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 31ccdccd7a04..051163189810 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -171,6 +171,31 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno,
171 ep, buffer, size); 171 ep, buffer, size);
172} 172}
173 173
174static const unsigned short low_speed_maxpacket_maxes[4] = {
175 [USB_ENDPOINT_XFER_CONTROL] = 8,
176 [USB_ENDPOINT_XFER_ISOC] = 0,
177 [USB_ENDPOINT_XFER_BULK] = 0,
178 [USB_ENDPOINT_XFER_INT] = 8,
179};
180static const unsigned short full_speed_maxpacket_maxes[4] = {
181 [USB_ENDPOINT_XFER_CONTROL] = 64,
182 [USB_ENDPOINT_XFER_ISOC] = 1023,
183 [USB_ENDPOINT_XFER_BULK] = 64,
184 [USB_ENDPOINT_XFER_INT] = 64,
185};
186static const unsigned short high_speed_maxpacket_maxes[4] = {
187 [USB_ENDPOINT_XFER_CONTROL] = 64,
188 [USB_ENDPOINT_XFER_ISOC] = 1024,
189 [USB_ENDPOINT_XFER_BULK] = 512,
190 [USB_ENDPOINT_XFER_INT] = 1023,
191};
192static const unsigned short super_speed_maxpacket_maxes[4] = {
193 [USB_ENDPOINT_XFER_CONTROL] = 512,
194 [USB_ENDPOINT_XFER_ISOC] = 1024,
195 [USB_ENDPOINT_XFER_BULK] = 1024,
196 [USB_ENDPOINT_XFER_INT] = 1024,
197};
198
174static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, 199static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
175 int asnum, struct usb_host_interface *ifp, int num_ep, 200 int asnum, struct usb_host_interface *ifp, int num_ep,
176 unsigned char *buffer, int size) 201 unsigned char *buffer, int size)
@@ -179,6 +204,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
179 struct usb_endpoint_descriptor *d; 204 struct usb_endpoint_descriptor *d;
180 struct usb_host_endpoint *endpoint; 205 struct usb_host_endpoint *endpoint;
181 int n, i, j, retval; 206 int n, i, j, retval;
207 unsigned int maxp;
208 const unsigned short *maxpacket_maxes;
182 209
183 d = (struct usb_endpoint_descriptor *) buffer; 210 d = (struct usb_endpoint_descriptor *) buffer;
184 buffer += d->bLength; 211 buffer += d->bLength;
@@ -286,6 +313,42 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
286 endpoint->desc.wMaxPacketSize = cpu_to_le16(8); 313 endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
287 } 314 }
288 315
316 /* Validate the wMaxPacketSize field */
317 maxp = usb_endpoint_maxp(&endpoint->desc);
318
319 /* Find the highest legal maxpacket size for this endpoint */
320 i = 0; /* additional transactions per microframe */
321 switch (to_usb_device(ddev)->speed) {
322 case USB_SPEED_LOW:
323 maxpacket_maxes = low_speed_maxpacket_maxes;
324 break;
325 case USB_SPEED_FULL:
326 maxpacket_maxes = full_speed_maxpacket_maxes;
327 break;
328 case USB_SPEED_HIGH:
329 /* Bits 12..11 are allowed only for HS periodic endpoints */
330 if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) {
331 i = maxp & (BIT(12) | BIT(11));
332 maxp &= ~i;
333 }
334 /* fallthrough */
335 default:
336 maxpacket_maxes = high_speed_maxpacket_maxes;
337 break;
338 case USB_SPEED_SUPER:
339 case USB_SPEED_SUPER_PLUS:
340 maxpacket_maxes = super_speed_maxpacket_maxes;
341 break;
342 }
343 j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];
344
345 if (maxp > j) {
346 dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n",
347 cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
348 maxp = j;
349 endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);
350 }
351
289 /* 352 /*
290 * Some buggy high speed devices have bulk endpoints using 353 * Some buggy high speed devices have bulk endpoints using
291 * maxpacket sizes other than 512. High speed HCDs may not 354 * maxpacket sizes other than 512. High speed HCDs may not
@@ -293,9 +356,6 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
293 */ 356 */
294 if (to_usb_device(ddev)->speed == USB_SPEED_HIGH 357 if (to_usb_device(ddev)->speed == USB_SPEED_HIGH
295 && usb_endpoint_xfer_bulk(d)) { 358 && usb_endpoint_xfer_bulk(d)) {
296 unsigned maxp;
297
298 maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
299 if (maxp != 512) 359 if (maxp != 512)
300 dev_warn(ddev, "config %d interface %d altsetting %d " 360 dev_warn(ddev, "config %d interface %d altsetting %d "
301 "bulk endpoint 0x%X has invalid maxpacket %d\n", 361 "bulk endpoint 0x%X has invalid maxpacket %d\n",
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index e9f5043a2167..e6a6d67c8705 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -241,7 +241,8 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma)
241 goto error_decrease_mem; 241 goto error_decrease_mem;
242 } 242 }
243 243
244 mem = usb_alloc_coherent(ps->dev, size, GFP_USER, &dma_handle); 244 mem = usb_alloc_coherent(ps->dev, size, GFP_USER | __GFP_NOWARN,
245 &dma_handle);
245 if (!mem) { 246 if (!mem) {
246 ret = -ENOMEM; 247 ret = -ENOMEM;
247 goto error_free_usbm; 248 goto error_free_usbm;
@@ -2582,7 +2583,9 @@ static unsigned int usbdev_poll(struct file *file,
2582 if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed)) 2583 if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed))
2583 mask |= POLLOUT | POLLWRNORM; 2584 mask |= POLLOUT | POLLWRNORM;
2584 if (!connected(ps)) 2585 if (!connected(ps))
2585 mask |= POLLERR | POLLHUP; 2586 mask |= POLLHUP;
2587 if (list_empty(&ps->list))
2588 mask |= POLLERR;
2586 return mask; 2589 return mask;
2587} 2590}
2588 2591
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bee13517676f..1d5fc32d06d0 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1052,14 +1052,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1052 1052
1053 /* Continue a partial initialization */ 1053 /* Continue a partial initialization */
1054 if (type == HUB_INIT2 || type == HUB_INIT3) { 1054 if (type == HUB_INIT2 || type == HUB_INIT3) {
1055 device_lock(hub->intfdev); 1055 device_lock(&hdev->dev);
1056 1056
1057 /* Was the hub disconnected while we were waiting? */ 1057 /* Was the hub disconnected while we were waiting? */
1058 if (hub->disconnected) { 1058 if (hub->disconnected)
1059 device_unlock(hub->intfdev); 1059 goto disconnected;
1060 kref_put(&hub->kref, hub_release);
1061 return;
1062 }
1063 if (type == HUB_INIT2) 1060 if (type == HUB_INIT2)
1064 goto init2; 1061 goto init2;
1065 goto init3; 1062 goto init3;
@@ -1262,7 +1259,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1262 queue_delayed_work(system_power_efficient_wq, 1259 queue_delayed_work(system_power_efficient_wq,
1263 &hub->init_work, 1260 &hub->init_work,
1264 msecs_to_jiffies(delay)); 1261 msecs_to_jiffies(delay));
1265 device_unlock(hub->intfdev); 1262 device_unlock(&hdev->dev);
1266 return; /* Continues at init3: below */ 1263 return; /* Continues at init3: below */
1267 } else { 1264 } else {
1268 msleep(delay); 1265 msleep(delay);
@@ -1281,12 +1278,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1281 /* Scan all ports that need attention */ 1278 /* Scan all ports that need attention */
1282 kick_hub_wq(hub); 1279 kick_hub_wq(hub);
1283 1280
1284 /* Allow autosuspend if it was suppressed */ 1281 if (type == HUB_INIT2 || type == HUB_INIT3) {
1285 if (type <= HUB_INIT3) 1282 /* Allow autosuspend if it was suppressed */
1283 disconnected:
1286 usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); 1284 usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));
1287 1285 device_unlock(&hdev->dev);
1288 if (type == HUB_INIT2 || type == HUB_INIT3) 1286 }
1289 device_unlock(hub->intfdev);
1290 1287
1291 kref_put(&hub->kref, hub_release); 1288 kref_put(&hub->kref, hub_release);
1292} 1289}
@@ -1315,8 +1312,6 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
1315 struct usb_device *hdev = hub->hdev; 1312 struct usb_device *hdev = hub->hdev;
1316 int i; 1313 int i;
1317 1314
1318 cancel_delayed_work_sync(&hub->init_work);
1319
1320 /* hub_wq and related activity won't re-trigger */ 1315 /* hub_wq and related activity won't re-trigger */
1321 hub->quiescing = 1; 1316 hub->quiescing = 1;
1322 1317
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index 974335377d9f..e56d59b19a0e 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -61,6 +61,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
61 if (!simple->clks) 61 if (!simple->clks)
62 return -ENOMEM; 62 return -ENOMEM;
63 63
64 platform_set_drvdata(pdev, simple);
64 simple->dev = dev; 65 simple->dev = dev;
65 66
66 for (i = 0; i < simple->num_clocks; i++) { 67 for (i = 0; i < simple->num_clocks; i++) {
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 45f5a232d9fb..2eb84d6c24a6 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -37,6 +37,7 @@
37#define PCI_DEVICE_ID_INTEL_BXT 0x0aaa 37#define PCI_DEVICE_ID_INTEL_BXT 0x0aaa
38#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa 38#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa
39#define PCI_DEVICE_ID_INTEL_APL 0x5aaa 39#define PCI_DEVICE_ID_INTEL_APL 0x5aaa
40#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0
40 41
41static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; 42static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
42static const struct acpi_gpio_params cs_gpios = { 1, 0, false }; 43static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
@@ -227,6 +228,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
227 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, 228 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), },
228 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, 229 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), },
229 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, 230 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
231 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
230 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, 232 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
231 { } /* Terminating Entry */ 233 { } /* Terminating Entry */
232}; 234};
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8f8c2157910e..1f5597ef945d 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -829,7 +829,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
829 if (!req->request.no_interrupt && !chain) 829 if (!req->request.no_interrupt && !chain)
830 trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI; 830 trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI;
831 831
832 if (last) 832 if (last && !usb_endpoint_xfer_isoc(dep->endpoint.desc))
833 trb->ctrl |= DWC3_TRB_CTRL_LST; 833 trb->ctrl |= DWC3_TRB_CTRL_LST;
834 834
835 if (chain) 835 if (chain)
@@ -1955,7 +1955,8 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
1955 1955
1956static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, 1956static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
1957 struct dwc3_request *req, struct dwc3_trb *trb, 1957 struct dwc3_request *req, struct dwc3_trb *trb,
1958 const struct dwc3_event_depevt *event, int status) 1958 const struct dwc3_event_depevt *event, int status,
1959 int chain)
1959{ 1960{
1960 unsigned int count; 1961 unsigned int count;
1961 unsigned int s_pkt = 0; 1962 unsigned int s_pkt = 0;
@@ -1964,17 +1965,22 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
1964 dep->queued_requests--; 1965 dep->queued_requests--;
1965 trace_dwc3_complete_trb(dep, trb); 1966 trace_dwc3_complete_trb(dep, trb);
1966 1967
1968 /*
1969 * If we're in the middle of series of chained TRBs and we
1970 * receive a short transfer along the way, DWC3 will skip
1971 * through all TRBs including the last TRB in the chain (the
1972 * where CHN bit is zero. DWC3 will also avoid clearing HWO
1973 * bit and SW has to do it manually.
1974 *
1975 * We're going to do that here to avoid problems of HW trying
1976 * to use bogus TRBs for transfers.
1977 */
1978 if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
1979 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1980
1967 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) 1981 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
1968 /* 1982 return 1;
1969 * We continue despite the error. There is not much we 1983
1970 * can do. If we don't clean it up we loop forever. If
1971 * we skip the TRB then it gets overwritten after a
1972 * while since we use them in a ring buffer. A BUG()
1973 * would help. Lets hope that if this occurs, someone
1974 * fixes the root cause instead of looking away :)
1975 */
1976 dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n",
1977 dep->name, trb);
1978 count = trb->size & DWC3_TRB_SIZE_MASK; 1984 count = trb->size & DWC3_TRB_SIZE_MASK;
1979 1985
1980 if (dep->direction) { 1986 if (dep->direction) {
@@ -2013,15 +2019,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
2013 s_pkt = 1; 2019 s_pkt = 1;
2014 } 2020 }
2015 2021
2016 /* 2022 if (s_pkt && !chain)
2017 * We assume here we will always receive the entire data block
2018 * which we should receive. Meaning, if we program RX to
2019 * receive 4K but we receive only 2K, we assume that's all we
2020 * should receive and we simply bounce the request back to the
2021 * gadget driver for further processing.
2022 */
2023 req->request.actual += req->request.length - count;
2024 if (s_pkt)
2025 return 1; 2023 return 1;
2026 if ((event->status & DEPEVT_STATUS_LST) && 2024 if ((event->status & DEPEVT_STATUS_LST) &&
2027 (trb->ctrl & (DWC3_TRB_CTRL_LST | 2025 (trb->ctrl & (DWC3_TRB_CTRL_LST |
@@ -2040,13 +2038,17 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
2040 struct dwc3_trb *trb; 2038 struct dwc3_trb *trb;
2041 unsigned int slot; 2039 unsigned int slot;
2042 unsigned int i; 2040 unsigned int i;
2041 int count = 0;
2043 int ret; 2042 int ret;
2044 2043
2045 do { 2044 do {
2045 int chain;
2046
2046 req = next_request(&dep->started_list); 2047 req = next_request(&dep->started_list);
2047 if (WARN_ON_ONCE(!req)) 2048 if (WARN_ON_ONCE(!req))
2048 return 1; 2049 return 1;
2049 2050
2051 chain = req->request.num_mapped_sgs > 0;
2050 i = 0; 2052 i = 0;
2051 do { 2053 do {
2052 slot = req->first_trb_index + i; 2054 slot = req->first_trb_index + i;
@@ -2054,13 +2056,22 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
2054 slot++; 2056 slot++;
2055 slot %= DWC3_TRB_NUM; 2057 slot %= DWC3_TRB_NUM;
2056 trb = &dep->trb_pool[slot]; 2058 trb = &dep->trb_pool[slot];
2059 count += trb->size & DWC3_TRB_SIZE_MASK;
2057 2060
2058 ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, 2061 ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
2059 event, status); 2062 event, status, chain);
2060 if (ret) 2063 if (ret)
2061 break; 2064 break;
2062 } while (++i < req->request.num_mapped_sgs); 2065 } while (++i < req->request.num_mapped_sgs);
2063 2066
2067 /*
2068 * We assume here we will always receive the entire data block
2069 * which we should receive. Meaning, if we program RX to
2070 * receive 4K but we receive only 2K, we assume that's all we
2071 * should receive and we simply bounce the request back to the
2072 * gadget driver for further processing.
2073 */
2074 req->request.actual += req->request.length - count;
2064 dwc3_gadget_giveback(dep, req, status); 2075 dwc3_gadget_giveback(dep, req, status);
2065 2076
2066 if (ret) 2077 if (ret)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index eb648485a58c..5ebe6af7976e 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1913,6 +1913,8 @@ unknown:
1913 break; 1913 break;
1914 1914
1915 case USB_RECIP_ENDPOINT: 1915 case USB_RECIP_ENDPOINT:
1916 if (!cdev->config)
1917 break;
1916 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f); 1918 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
1917 list_for_each_entry(f, &cdev->config->functions, list) { 1919 list_for_each_entry(f, &cdev->config->functions, list) {
1918 if (test_bit(endp, f->endpoints)) 1920 if (test_bit(endp, f->endpoints))
@@ -2124,14 +2126,14 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
2124 2126
2125 cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL); 2127 cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL);
2126 if (!cdev->os_desc_req) { 2128 if (!cdev->os_desc_req) {
2127 ret = PTR_ERR(cdev->os_desc_req); 2129 ret = -ENOMEM;
2128 goto end; 2130 goto end;
2129 } 2131 }
2130 2132
2131 /* OS feature descriptor length <= 4kB */ 2133 /* OS feature descriptor length <= 4kB */
2132 cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL); 2134 cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
2133 if (!cdev->os_desc_req->buf) { 2135 if (!cdev->os_desc_req->buf) {
2134 ret = PTR_ERR(cdev->os_desc_req->buf); 2136 ret = -ENOMEM;
2135 kfree(cdev->os_desc_req); 2137 kfree(cdev->os_desc_req);
2136 goto end; 2138 goto end;
2137 } 2139 }
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 70cf3477f951..f9237fe2be05 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1490,7 +1490,9 @@ void unregister_gadget_item(struct config_item *item)
1490{ 1490{
1491 struct gadget_info *gi = to_gadget_info(item); 1491 struct gadget_info *gi = to_gadget_info(item);
1492 1492
1493 mutex_lock(&gi->lock);
1493 unregister_gadget(gi); 1494 unregister_gadget(gi);
1495 mutex_unlock(&gi->lock);
1494} 1496}
1495EXPORT_SYMBOL_GPL(unregister_gadget_item); 1497EXPORT_SYMBOL_GPL(unregister_gadget_item);
1496 1498
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 943c21aafd3b..ab6ac1b74ac0 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -680,6 +680,12 @@ static int rndis_reset_response(struct rndis_params *params,
680{ 680{
681 rndis_reset_cmplt_type *resp; 681 rndis_reset_cmplt_type *resp;
682 rndis_resp_t *r; 682 rndis_resp_t *r;
683 u8 *xbuf;
684 u32 length;
685
686 /* drain the response queue */
687 while ((xbuf = rndis_get_next_response(params, &length)))
688 rndis_free_response(params, xbuf);
683 689
684 r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type)); 690 r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type));
685 if (!r) 691 if (!r)
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index a3f7e7c55ebb..5f562c1ec795 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -556,7 +556,8 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
556 /* Multi frame CDC protocols may store the frame for 556 /* Multi frame CDC protocols may store the frame for
557 * later which is not a dropped frame. 557 * later which is not a dropped frame.
558 */ 558 */
559 if (dev->port_usb->supports_multi_frame) 559 if (dev->port_usb &&
560 dev->port_usb->supports_multi_frame)
560 goto multiframe; 561 goto multiframe;
561 goto drop; 562 goto drop;
562 } 563 }
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 66753ba7a42e..31125a4a2658 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -2023,7 +2023,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
2023 if (!data) { 2023 if (!data) {
2024 kfree(*class_array); 2024 kfree(*class_array);
2025 *class_array = NULL; 2025 *class_array = NULL;
2026 ret = PTR_ERR(data); 2026 ret = -ENOMEM;
2027 goto unlock; 2027 goto unlock;
2028 } 2028 }
2029 cl_arr = *class_array; 2029 cl_arr = *class_array;
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index aa3707bdebb4..16104b5ebdcb 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -542,7 +542,7 @@ static ssize_t ep_aio(struct kiocb *iocb,
542 */ 542 */
543 spin_lock_irq(&epdata->dev->lock); 543 spin_lock_irq(&epdata->dev->lock);
544 value = -ENODEV; 544 value = -ENODEV;
545 if (unlikely(epdata->ep)) 545 if (unlikely(epdata->ep == NULL))
546 goto fail; 546 goto fail;
547 547
548 req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC); 548 req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC);
@@ -606,7 +606,7 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to)
606 } 606 }
607 if (is_sync_kiocb(iocb)) { 607 if (is_sync_kiocb(iocb)) {
608 value = ep_io(epdata, buf, len); 608 value = ep_io(epdata, buf, len);
609 if (value >= 0 && copy_to_iter(buf, value, to)) 609 if (value >= 0 && (copy_to_iter(buf, value, to) != value))
610 value = -EFAULT; 610 value = -EFAULT;
611 } else { 611 } else {
612 struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL); 612 struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL);
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index ff8685ea7219..934f83881c30 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -1145,7 +1145,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
1145 if (ret != -EPROBE_DEFER) 1145 if (ret != -EPROBE_DEFER)
1146 list_del(&driver->pending); 1146 list_del(&driver->pending);
1147 if (ret) 1147 if (ret)
1148 goto err4; 1148 goto err5;
1149 break; 1149 break;
1150 } 1150 }
1151 } 1151 }
@@ -1154,6 +1154,9 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
1154 1154
1155 return 0; 1155 return 0;
1156 1156
1157err5:
1158 device_del(&udc->dev);
1159
1157err4: 1160err4:
1158 list_del(&udc->list); 1161 list_del(&udc->list);
1159 mutex_unlock(&udc_lock); 1162 mutex_unlock(&udc_lock);
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 93d28cb00b76..cf8819a5c5b2 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -2053,7 +2053,7 @@ static void setup_received_handle(struct qe_udc *udc,
2053 struct qe_ep *ep; 2053 struct qe_ep *ep;
2054 2054
2055 if (wValue != 0 || wLength != 0 2055 if (wValue != 0 || wLength != 0
2056 || pipe > USB_MAX_ENDPOINTS) 2056 || pipe >= USB_MAX_ENDPOINTS)
2057 break; 2057 break;
2058 ep = &udc->eps[pipe]; 2058 ep = &udc->eps[pipe];
2059 2059
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a962b89b65a6..1e5f529d51a2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -332,11 +332,11 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci)
332 int port = HCS_N_PORTS(ehci->hcs_params); 332 int port = HCS_N_PORTS(ehci->hcs_params);
333 333
334 while (port--) { 334 while (port--) {
335 ehci_writel(ehci, PORT_RWC_BITS,
336 &ehci->regs->port_status[port]);
337 spin_unlock_irq(&ehci->lock); 335 spin_unlock_irq(&ehci->lock);
338 ehci_port_power(ehci, port, false); 336 ehci_port_power(ehci, port, false);
339 spin_lock_irq(&ehci->lock); 337 spin_lock_irq(&ehci->lock);
338 ehci_writel(ehci, PORT_RWC_BITS,
339 &ehci->regs->port_status[port]);
340 } 340 }
341} 341}
342 342
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index c369c29e496d..2f7690092a7f 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1675,7 +1675,7 @@ max3421_gpout_set_value(struct usb_hcd *hcd, u8 pin_number, u8 value)
1675 if (pin_number > 7) 1675 if (pin_number > 7)
1676 return; 1676 return;
1677 1677
1678 mask = 1u << pin_number; 1678 mask = 1u << (pin_number % 4);
1679 idx = pin_number / 4; 1679 idx = pin_number / 4;
1680 1680
1681 if (value) 1681 if (value)
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index d61fcc48099e..730b9fd26685 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -386,6 +386,9 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
386 386
387 ret = 0; 387 ret = 0;
388 virt_dev = xhci->devs[slot_id]; 388 virt_dev = xhci->devs[slot_id];
389 if (!virt_dev)
390 return -ENODEV;
391
389 cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO); 392 cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO);
390 if (!cmd) { 393 if (!cmd) {
391 xhci_dbg(xhci, "Couldn't allocate command structure.\n"); 394 xhci_dbg(xhci, "Couldn't allocate command structure.\n");
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 4fd041bec332..d7b0f97abbad 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -314,11 +314,12 @@ static void xhci_pci_remove(struct pci_dev *dev)
314 usb_remove_hcd(xhci->shared_hcd); 314 usb_remove_hcd(xhci->shared_hcd);
315 usb_put_hcd(xhci->shared_hcd); 315 usb_put_hcd(xhci->shared_hcd);
316 } 316 }
317 usb_hcd_pci_remove(dev);
318 317
319 /* Workaround for spurious wakeups at shutdown with HSW */ 318 /* Workaround for spurious wakeups at shutdown with HSW */
320 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) 319 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
321 pci_set_power_state(dev, PCI_D3hot); 320 pci_set_power_state(dev, PCI_D3hot);
321
322 usb_hcd_pci_remove(dev);
322} 323}
323 324
324#ifdef CONFIG_PM 325#ifdef CONFIG_PM
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 918e0c739b79..fd9fd12e4861 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1334,12 +1334,6 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1334 1334
1335 cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list); 1335 cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list);
1336 1336
1337 if (cmd->command_trb != xhci->cmd_ring->dequeue) {
1338 xhci_err(xhci,
1339 "Command completion event does not match command\n");
1340 return;
1341 }
1342
1343 del_timer(&xhci->cmd_timer); 1337 del_timer(&xhci->cmd_timer);
1344 1338
1345 trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); 1339 trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event);
@@ -1351,6 +1345,13 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1351 xhci_handle_stopped_cmd_ring(xhci, cmd); 1345 xhci_handle_stopped_cmd_ring(xhci, cmd);
1352 return; 1346 return;
1353 } 1347 }
1348
1349 if (cmd->command_trb != xhci->cmd_ring->dequeue) {
1350 xhci_err(xhci,
1351 "Command completion event does not match command\n");
1352 return;
1353 }
1354
1354 /* 1355 /*
1355 * Host aborted the command ring, check if the current command was 1356 * Host aborted the command ring, check if the current command was
1356 * supposed to be aborted, otherwise continue normally. 1357 * supposed to be aborted, otherwise continue normally.
@@ -3243,7 +3244,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
3243 send_addr = addr; 3244 send_addr = addr;
3244 3245
3245 /* Queue the TRBs, even if they are zero-length */ 3246 /* Queue the TRBs, even if they are zero-length */
3246 for (enqd_len = 0; enqd_len < full_len; enqd_len += trb_buff_len) { 3247 for (enqd_len = 0; first_trb || enqd_len < full_len;
3248 enqd_len += trb_buff_len) {
3247 field = TRB_TYPE(TRB_NORMAL); 3249 field = TRB_TYPE(TRB_NORMAL);
3248 3250
3249 /* TRB buffer should not cross 64KB boundaries */ 3251 /* TRB buffer should not cross 64KB boundaries */
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 52c27cab78c3..9b5b3b2281ca 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -665,7 +665,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer,
665{ 665{
666 char data[30 *3 + 4]; 666 char data[30 *3 + 4];
667 char *d = data; 667 char *d = data;
668 int m = (sizeof(data) - 1) / 3; 668 int m = (sizeof(data) - 1) / 3 - 1;
669 int bytes_read = 0; 669 int bytes_read = 0;
670 int retry_on_empty = 10; 670 int retry_on_empty = 10;
671 int retry_on_timeout = 5; 671 int retry_on_timeout = 5;
@@ -1684,7 +1684,7 @@ wait:if (ftdi->disconnected > 0) {
1684 int i = 0; 1684 int i = 0;
1685 char data[30 *3 + 4]; 1685 char data[30 *3 + 4];
1686 char *d = data; 1686 char *d = data;
1687 int m = (sizeof(data) - 1) / 3; 1687 int m = (sizeof(data) - 1) / 3 - 1;
1688 int l = 0; 1688 int l = 0;
1689 struct u132_target *target = &ftdi->target[ed]; 1689 struct u132_target *target = &ftdi->target[ed];
1690 struct u132_command *command = &ftdi->command[ 1690 struct u132_command *command = &ftdi->command[
@@ -1876,7 +1876,7 @@ more:{
1876 if (packet_bytes > 2) { 1876 if (packet_bytes > 2) {
1877 char diag[30 *3 + 4]; 1877 char diag[30 *3 + 4];
1878 char *d = diag; 1878 char *d = diag;
1879 int m = (sizeof(diag) - 1) / 3; 1879 int m = (sizeof(diag) - 1) / 3 - 1;
1880 char *b = ftdi->bulk_in_buffer; 1880 char *b = ftdi->bulk_in_buffer;
1881 int bytes_read = 0; 1881 int bytes_read = 0;
1882 diag[0] = 0; 1882 diag[0] = 0;
@@ -2053,7 +2053,7 @@ static int ftdi_elan_synchronize(struct usb_ftdi *ftdi)
2053 if (packet_bytes > 2) { 2053 if (packet_bytes > 2) {
2054 char diag[30 *3 + 4]; 2054 char diag[30 *3 + 4];
2055 char *d = diag; 2055 char *d = diag;
2056 int m = (sizeof(diag) - 1) / 3; 2056 int m = (sizeof(diag) - 1) / 3 - 1;
2057 char *b = ftdi->bulk_in_buffer; 2057 char *b = ftdi->bulk_in_buffer;
2058 int bytes_read = 0; 2058 int bytes_read = 0;
2059 unsigned char c = 0; 2059 unsigned char c = 0;
@@ -2155,7 +2155,7 @@ more:{
2155 if (packet_bytes > 2) { 2155 if (packet_bytes > 2) {
2156 char diag[30 *3 + 4]; 2156 char diag[30 *3 + 4];
2157 char *d = diag; 2157 char *d = diag;
2158 int m = (sizeof(diag) - 1) / 3; 2158 int m = (sizeof(diag) - 1) / 3 - 1;
2159 char *b = ftdi->bulk_in_buffer; 2159 char *b = ftdi->bulk_in_buffer;
2160 int bytes_read = 0; 2160 int bytes_read = 0;
2161 diag[0] = 0; 2161 diag[0] = 0;
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 6b978f04b8d7..5c8210dc6fd9 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -585,7 +585,6 @@ static void sg_timeout(unsigned long _req)
585{ 585{
586 struct usb_sg_request *req = (struct usb_sg_request *) _req; 586 struct usb_sg_request *req = (struct usb_sg_request *) _req;
587 587
588 req->status = -ETIMEDOUT;
589 usb_sg_cancel(req); 588 usb_sg_cancel(req);
590} 589}
591 590
@@ -616,8 +615,10 @@ static int perform_sglist(
616 mod_timer(&sg_timer, jiffies + 615 mod_timer(&sg_timer, jiffies +
617 msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); 616 msecs_to_jiffies(SIMPLE_IO_TIMEOUT));
618 usb_sg_wait(req); 617 usb_sg_wait(req);
619 del_timer_sync(&sg_timer); 618 if (!del_timer_sync(&sg_timer))
620 retval = req->status; 619 retval = -ETIMEDOUT;
620 else
621 retval = req->status;
621 622
622 /* FIXME check resulting data pattern */ 623 /* FIXME check resulting data pattern */
623 624
@@ -2602,7 +2603,7 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
2602 ktime_get_ts64(&start); 2603 ktime_get_ts64(&start);
2603 2604
2604 retval = usbtest_do_ioctl(intf, param_32); 2605 retval = usbtest_do_ioctl(intf, param_32);
2605 if (retval) 2606 if (retval < 0)
2606 goto free_mutex; 2607 goto free_mutex;
2607 2608
2608 ktime_get_ts64(&end); 2609 ktime_get_ts64(&end);
diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 6f6d2a7fd5a0..6523af4f8f93 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -140,6 +140,8 @@ static int omap_otg_probe(struct platform_device *pdev)
140 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id, 140 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id,
141 otg_dev->vbus); 141 otg_dev->vbus);
142 142
143 platform_set_drvdata(pdev, otg_dev);
144
143 return 0; 145 return 0;
144} 146}
145 147
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 8fbbc2d32371..ac67bab9124c 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -514,7 +514,8 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
514 if (gpio > 0) 514 if (gpio > 0)
515 dparam->enable_gpio = gpio; 515 dparam->enable_gpio = gpio;
516 516
517 if (dparam->type == USBHS_TYPE_RCAR_GEN2) 517 if (dparam->type == USBHS_TYPE_RCAR_GEN2 ||
518 dparam->type == USBHS_TYPE_RCAR_GEN3)
518 dparam->has_usb_dmac = 1; 519 dparam->has_usb_dmac = 1;
519 520
520 return info; 521 return info;
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 280ed5ff021b..857e78337324 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -871,7 +871,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
871 871
872 /* use PIO if packet is less than pio_dma_border or pipe is DCP */ 872 /* use PIO if packet is less than pio_dma_border or pipe is DCP */
873 if ((len < usbhs_get_dparam(priv, pio_dma_border)) || 873 if ((len < usbhs_get_dparam(priv, pio_dma_border)) ||
874 usbhs_pipe_is_dcp(pipe)) 874 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
875 goto usbhsf_pio_prepare_push; 875 goto usbhsf_pio_prepare_push;
876 876
877 /* check data length if this driver don't use USB-DMAC */ 877 /* check data length if this driver don't use USB-DMAC */
@@ -976,7 +976,7 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
976 976
977 /* use PIO if packet is less than pio_dma_border or pipe is DCP */ 977 /* use PIO if packet is less than pio_dma_border or pipe is DCP */
978 if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) || 978 if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) ||
979 usbhs_pipe_is_dcp(pipe)) 979 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
980 goto usbhsf_pio_prepare_pop; 980 goto usbhsf_pio_prepare_pop;
981 981
982 fifo = usbhsf_get_dma_fifo(priv, pkt); 982 fifo = usbhsf_get_dma_fifo(priv, pkt);
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 50f3363cc382..92bc83b92d10 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -617,10 +617,13 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
617 * use dmaengine if possible. 617 * use dmaengine if possible.
618 * It will use pio handler if impossible. 618 * It will use pio handler if impossible.
619 */ 619 */
620 if (usb_endpoint_dir_in(desc)) 620 if (usb_endpoint_dir_in(desc)) {
621 pipe->handler = &usbhs_fifo_dma_push_handler; 621 pipe->handler = &usbhs_fifo_dma_push_handler;
622 else 622 } else {
623 pipe->handler = &usbhs_fifo_dma_pop_handler; 623 pipe->handler = &usbhs_fifo_dma_pop_handler;
624 usbhs_xxxsts_clear(priv, BRDYSTS,
625 usbhs_pipe_number(pipe));
626 }
624 627
625 ret = 0; 628 ret = 0;
626 } 629 }
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 00820809139a..b2d767e743fc 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -648,6 +648,8 @@ static const struct usb_device_id id_table_combined[] = {
648 { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) }, 648 { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) },
649 { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) }, 649 { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) },
650 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) }, 650 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) },
651 { USB_DEVICE(FTDI_VID, FTDI_PALMSENS_PID) },
652 { USB_DEVICE(FTDI_VID, FTDI_IVIUM_XSTAT_PID) },
651 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, 653 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
652 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, 654 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
653 { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, 655 { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
@@ -1008,6 +1010,7 @@ static const struct usb_device_id id_table_combined[] = {
1008 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) }, 1010 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) },
1009 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, 1011 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
1010 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, 1012 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
1013 { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
1011 { } /* Terminating entry */ 1014 { } /* Terminating entry */
1012}; 1015};
1013 1016
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index c5d6c1e73e8e..f87a938cf005 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -406,6 +406,12 @@
406#define FTDI_4N_GALAXY_DE_3_PID 0xF3C2 406#define FTDI_4N_GALAXY_DE_3_PID 0xF3C2
407 407
408/* 408/*
409 * Ivium Technologies product IDs
410 */
411#define FTDI_PALMSENS_PID 0xf440
412#define FTDI_IVIUM_XSTAT_PID 0xf441
413
414/*
409 * Linx Technologies product ids 415 * Linx Technologies product ids
410 */ 416 */
411#define LINX_SDMUSBQSS_PID 0xF448 /* Linx SDM-USB-QS-S */ 417#define LINX_SDMUSBQSS_PID 0xF448 /* Linx SDM-USB-QS-S */
@@ -673,6 +679,12 @@
673#define INTREPID_NEOVI_PID 0x0701 679#define INTREPID_NEOVI_PID 0x0701
674 680
675/* 681/*
682 * WICED USB UART
683 */
684#define WICED_VID 0x0A5C
685#define WICED_USB20706V2_PID 0x6422
686
687/*
676 * Definitions for ID TECH (www.idt-net.com) devices 688 * Definitions for ID TECH (www.idt-net.com) devices
677 */ 689 */
678#define IDTECH_VID 0x0ACD /* ID TECH Vendor ID */ 690#define IDTECH_VID 0x0ACD /* ID TECH Vendor ID */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 8e07536c233a..bc472584a229 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -274,6 +274,12 @@ static void option_instat_callback(struct urb *urb);
274#define TELIT_PRODUCT_LE920 0x1200 274#define TELIT_PRODUCT_LE920 0x1200
275#define TELIT_PRODUCT_LE910 0x1201 275#define TELIT_PRODUCT_LE910 0x1201
276#define TELIT_PRODUCT_LE910_USBCFG4 0x1206 276#define TELIT_PRODUCT_LE910_USBCFG4 0x1206
277#define TELIT_PRODUCT_LE920A4_1207 0x1207
278#define TELIT_PRODUCT_LE920A4_1208 0x1208
279#define TELIT_PRODUCT_LE920A4_1211 0x1211
280#define TELIT_PRODUCT_LE920A4_1212 0x1212
281#define TELIT_PRODUCT_LE920A4_1213 0x1213
282#define TELIT_PRODUCT_LE920A4_1214 0x1214
277 283
278/* ZTE PRODUCTS */ 284/* ZTE PRODUCTS */
279#define ZTE_VENDOR_ID 0x19d2 285#define ZTE_VENDOR_ID 0x19d2
@@ -628,6 +634,11 @@ static const struct option_blacklist_info telit_le920_blacklist = {
628 .reserved = BIT(1) | BIT(5), 634 .reserved = BIT(1) | BIT(5),
629}; 635};
630 636
637static const struct option_blacklist_info telit_le920a4_blacklist_1 = {
638 .sendsetup = BIT(0),
639 .reserved = BIT(1),
640};
641
631static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = { 642static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = {
632 .sendsetup = BIT(2), 643 .sendsetup = BIT(2),
633 .reserved = BIT(0) | BIT(1) | BIT(3), 644 .reserved = BIT(0) | BIT(1) | BIT(3),
@@ -1203,6 +1214,16 @@ static const struct usb_device_id option_ids[] = {
1203 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, 1214 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1204 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), 1215 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
1205 .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, 1216 .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
1217 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1207) },
1218 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1208),
1219 .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
1220 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1211),
1221 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1222 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1212),
1223 .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
1224 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
1225 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
1226 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1206 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ 1227 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
1207 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), 1228 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
1208 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 1229 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
@@ -1966,6 +1987,7 @@ static const struct usb_device_id option_ids[] = {
1966 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 1987 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1967 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ 1988 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
1968 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ 1989 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
1990 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
1969 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ 1991 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */
1970 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, 1992 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
1971 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, 1993 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index b1b9bac44016..d213cf44a7e4 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1433,7 +1433,7 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[]
1433 1433
1434 rc = usb_register(udriver); 1434 rc = usb_register(udriver);
1435 if (rc) 1435 if (rc)
1436 return rc; 1436 goto failed_usb_register;
1437 1437
1438 for (sd = serial_drivers; *sd; ++sd) { 1438 for (sd = serial_drivers; *sd; ++sd) {
1439 (*sd)->usb_driver = udriver; 1439 (*sd)->usb_driver = udriver;
@@ -1451,6 +1451,8 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[]
1451 while (sd-- > serial_drivers) 1451 while (sd-- > serial_drivers)
1452 usb_serial_deregister(*sd); 1452 usb_serial_deregister(*sd);
1453 usb_deregister(udriver); 1453 usb_deregister(udriver);
1454failed_usb_register:
1455 kfree(udriver);
1454 return rc; 1456 return rc;
1455} 1457}
1456EXPORT_SYMBOL_GPL(usb_serial_register_drivers); 1458EXPORT_SYMBOL_GPL(usb_serial_register_drivers);