Merge tag 'usb-4.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here is a number of USB gadget and other driver fixes for 4.18-rc3.

There's a bunch of them here, most of them being gadget driver and
xhci host controller fixes for reported issues (as normal), but there
are also some new device ids, and some fixes for the typec code.

There is an acpi core patch in here that was acked by the acpi
maintainer as it is needed for the typec fixes in order to properly
solve a problem in that driver.

All of these have been in linux-next this week with no reported
issues"

* tag 'usb-4.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (33 commits)
usb: chipidea: host: fix disconnection detect issue
usb: typec: tcpm: fix logbuffer index is wrong if _tcpm_log is re-entered
typec: tcpm: Fix a msecs vs jiffies bug
NFC: pn533: Fix wrong GFP flag usage
usb: cdc_acm: Add quirk for Uniden UBC125 scanner
staging/typec: fix tcpci_rt1711h build errors
usb: typec: ucsi: Fix for incorrect status data issue
usb: typec: ucsi: acpi: Workaround for cache mode issue
acpi: Add helper for deactivating memory region
usb: xhci: increase CRS timeout value
usb: xhci: tegra: fix runtime PM error handling
usb: xhci: remove the code build warning
xhci: Fix kernel oops in trace_xhci_free_virt_device
xhci: Fix perceived dead host due to runtime suspend race with event handler
dwc2: gadget: Fix ISOC IN DDMA PID bitfield value calculation
usb: gadget: dwc2: fix memory leak in gadget_init()
usb: gadget: composite: fix delayed_status race condition when set_interface
usb: dwc2: fix isoc split in transfer with no data
usb: dwc2: alloc dma aligned buffer for isoc split in
usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub
...

Changed files
+373 -66
Documentation
drivers
include
linux
+1 -1
Documentation/usb/gadget_configfs.txt
··· 226 226 where <config name>.<number> specify the configuration and <function> is 227 227 a symlink to a function being removed from the configuration, e.g.: 228 228 229 - $ rm configfs/c.1/ncm.usb0 229 + $ rm configs/c.1/ncm.usb0 230 230 231 231 ... 232 232 ...
+72
drivers/acpi/osl.c
··· 45 45 #include <linux/uaccess.h> 46 46 #include <linux/io-64-nonatomic-lo-hi.h> 47 47 48 + #include "acpica/accommon.h" 49 + #include "acpica/acnamesp.h" 48 50 #include "internal.h" 49 51 50 52 #define _COMPONENT ACPI_OS_SERVICES ··· 1491 1489 return acpi_check_resource_conflict(&res); 1492 1490 } 1493 1491 EXPORT_SYMBOL(acpi_check_region); 1492 + 1493 + static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level, 1494 + void *_res, void **return_value) 1495 + { 1496 + struct acpi_mem_space_context **mem_ctx; 1497 + union acpi_operand_object *handler_obj; 1498 + union acpi_operand_object *region_obj2; 1499 + union acpi_operand_object *region_obj; 1500 + struct resource *res = _res; 1501 + acpi_status status; 1502 + 1503 + region_obj = acpi_ns_get_attached_object(handle); 1504 + if (!region_obj) 1505 + return AE_OK; 1506 + 1507 + handler_obj = region_obj->region.handler; 1508 + if (!handler_obj) 1509 + return AE_OK; 1510 + 1511 + if (region_obj->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) 1512 + return AE_OK; 1513 + 1514 + if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) 1515 + return AE_OK; 1516 + 1517 + region_obj2 = acpi_ns_get_secondary_object(region_obj); 1518 + if (!region_obj2) 1519 + return AE_OK; 1520 + 1521 + mem_ctx = (void *)&region_obj2->extra.region_context; 1522 + 1523 + if (!(mem_ctx[0]->address >= res->start && 1524 + mem_ctx[0]->address < res->end)) 1525 + return AE_OK; 1526 + 1527 + status = handler_obj->address_space.setup(region_obj, 1528 + ACPI_REGION_DEACTIVATE, 1529 + NULL, (void **)mem_ctx); 1530 + if (ACPI_SUCCESS(status)) 1531 + region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); 1532 + 1533 + return status; 1534 + } 1535 + 1536 + /** 1537 + * acpi_release_memory - Release any mappings done to a memory region 1538 + * @handle: Handle to namespace node 1539 + * @res: Memory resource 1540 + * @level: A level that terminates the search 1541 + * 1542 + * Walks through @handle and unmaps all SystemMemory Operation Regions that 1543 + * overlap with @res and that have already been activated (mapped). 1544 + * 1545 + * This is a helper that allows drivers to place special requirements on memory 1546 + * region that may overlap with operation regions, primarily allowing them to 1547 + * safely map the region as non-cached memory. 1548 + * 1549 + * The unmapped Operation Regions will be automatically remapped next time they 1550 + * are called, so the drivers do not need to do anything else. 1551 + */ 1552 + acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, 1553 + u32 level) 1554 + { 1555 + if (!(res->flags & IORESOURCE_MEM)) 1556 + return AE_TYPE; 1557 + 1558 + return acpi_walk_namespace(ACPI_TYPE_REGION, handle, level, 1559 + acpi_deactivate_mem_region, NULL, res, NULL); 1560 + } 1561 + EXPORT_SYMBOL_GPL(acpi_release_memory); 1494 1562 1495 1563 /* 1496 1564 * Let drivers know whether the resource checks are effective
+2 -2
drivers/nfc/pn533/usb.c
··· 74 74 struct sk_buff *skb = NULL; 75 75 76 76 if (!urb->status) { 77 - skb = alloc_skb(urb->actual_length, GFP_KERNEL); 77 + skb = alloc_skb(urb->actual_length, GFP_ATOMIC); 78 78 if (!skb) { 79 79 nfc_err(&phy->udev->dev, "failed to alloc memory\n"); 80 80 } else { ··· 186 186 187 187 if (dev->protocol_type == PN533_PROTO_REQ_RESP) { 188 188 /* request for response for sent packet directly */ 189 - rc = pn533_submit_urb_for_response(phy, GFP_ATOMIC); 189 + rc = pn533_submit_urb_for_response(phy, GFP_KERNEL); 190 190 if (rc) 191 191 goto error; 192 192 } else if (dev->protocol_type == PN533_PROTO_REQ_ACK_RESP) {
+1
drivers/staging/typec/Kconfig
··· 11 11 12 12 config TYPEC_RT1711H 13 13 tristate "Richtek RT1711H Type-C chip driver" 14 + depends on I2C 14 15 select TYPEC_TCPCI 15 16 help 16 17 Richtek RT1711H Type-C chip driver that works with
+4 -1
drivers/usb/chipidea/host.c
··· 124 124 125 125 hcd->power_budget = ci->platdata->power_budget; 126 126 hcd->tpl_support = ci->platdata->tpl_support; 127 - if (ci->phy || ci->usb_phy) 127 + if (ci->phy || ci->usb_phy) { 128 128 hcd->skip_phy_initialization = 1; 129 + if (ci->usb_phy) 130 + hcd->usb_phy = ci->usb_phy; 131 + } 129 132 130 133 ehci = hcd_to_ehci(hcd); 131 134 ehci->caps = ci->hw_bank.cap;
+3
drivers/usb/class/cdc-acm.c
··· 1758 1758 { USB_DEVICE(0x11ca, 0x0201), /* VeriFone Mx870 Gadget Serial */ 1759 1759 .driver_info = SINGLE_RX_URB, 1760 1760 }, 1761 + { USB_DEVICE(0x1965, 0x0018), /* Uniden UBC125XLT */ 1762 + .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1763 + }, 1761 1764 { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */ 1762 1765 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1763 1766 },
+3
drivers/usb/dwc2/core.h
··· 1004 1004 * @frame_list_sz: Frame list size 1005 1005 * @desc_gen_cache: Kmem cache for generic descriptors 1006 1006 * @desc_hsisoc_cache: Kmem cache for hs isochronous descriptors 1007 + * @unaligned_cache: Kmem cache for DMA mode to handle non-aligned buf 1007 1008 * 1008 1009 * These are for peripheral mode: 1009 1010 * ··· 1178 1177 u32 frame_list_sz; 1179 1178 struct kmem_cache *desc_gen_cache; 1180 1179 struct kmem_cache *desc_hsisoc_cache; 1180 + struct kmem_cache *unaligned_cache; 1181 + #define DWC2_KMEM_UNALIGNED_BUF_SIZE 1024 1181 1182 1182 1183 #endif /* CONFIG_USB_DWC2_HOST || CONFIG_USB_DWC2_DUAL_ROLE */ 1183 1184
+12 -8
drivers/usb/dwc2/gadget.c
··· 812 812 u32 index; 813 813 u32 maxsize = 0; 814 814 u32 mask = 0; 815 + u8 pid = 0; 815 816 816 817 maxsize = dwc2_gadget_get_desc_params(hs_ep, &mask); 817 818 ··· 841 840 ((len << DEV_DMA_NBYTES_SHIFT) & mask)); 842 841 843 842 if (hs_ep->dir_in) { 844 - desc->status |= ((hs_ep->mc << DEV_DMA_ISOC_PID_SHIFT) & 843 + if (len) 844 + pid = DIV_ROUND_UP(len, hs_ep->ep.maxpacket); 845 + else 846 + pid = 1; 847 + desc->status |= ((pid << DEV_DMA_ISOC_PID_SHIFT) & 845 848 DEV_DMA_ISOC_PID_MASK) | 846 849 ((len % hs_ep->ep.maxpacket) ? 847 850 DEV_DMA_SHORT : 0) | ··· 889 884 struct dwc2_dma_desc *desc; 890 885 891 886 if (list_empty(&hs_ep->queue)) { 887 + hs_ep->target_frame = TARGET_FRAME_INITIAL; 892 888 dev_dbg(hsotg->dev, "%s: No requests in queue\n", __func__); 893 889 return; 894 890 } ··· 2761 2755 */ 2762 2756 tmp = dwc2_hsotg_read_frameno(hsotg); 2763 2757 2764 - dwc2_hsotg_complete_request(hsotg, ep, get_ep_head(ep), 0); 2765 - 2766 2758 if (using_desc_dma(hsotg)) { 2767 2759 if (ep->target_frame == TARGET_FRAME_INITIAL) { 2768 2760 /* Start first ISO Out */ ··· 2821 2817 2822 2818 tmp = dwc2_hsotg_read_frameno(hsotg); 2823 2819 if (using_desc_dma(hsotg)) { 2824 - dwc2_hsotg_complete_request(hsotg, hs_ep, 2825 - get_ep_head(hs_ep), 0); 2826 - 2827 2820 hs_ep->target_frame = tmp; 2828 2821 dwc2_gadget_incr_frame_num(hs_ep); 2829 2822 dwc2_gadget_start_isoc_ddma(hs_ep); ··· 4740 4739 } 4741 4740 4742 4741 ret = usb_add_gadget_udc(dev, &hsotg->gadget); 4743 - if (ret) 4742 + if (ret) { 4743 + dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep, 4744 + hsotg->ctrl_req); 4744 4745 return ret; 4745 - 4746 + } 4746 4747 dwc2_hsotg_dump(hsotg); 4747 4748 4748 4749 return 0; ··· 4758 4755 int dwc2_hsotg_remove(struct dwc2_hsotg *hsotg) 4759 4756 { 4760 4757 usb_del_gadget_udc(&hsotg->gadget); 4758 + dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep, hsotg->ctrl_req); 4761 4759 4762 4760 return 0; 4763 4761 }
+87 -6
drivers/usb/dwc2/hcd.c
··· 1567 1567 } 1568 1568 1569 1569 if (hsotg->params.host_dma) { 1570 - dwc2_writel((u32)chan->xfer_dma, 1571 - hsotg->regs + HCDMA(chan->hc_num)); 1570 + dma_addr_t dma_addr; 1571 + 1572 + if (chan->align_buf) { 1573 + if (dbg_hc(chan)) 1574 + dev_vdbg(hsotg->dev, "align_buf\n"); 1575 + dma_addr = chan->align_buf; 1576 + } else { 1577 + dma_addr = chan->xfer_dma; 1578 + } 1579 + dwc2_writel((u32)dma_addr, hsotg->regs + HCDMA(chan->hc_num)); 1580 + 1572 1581 if (dbg_hc(chan)) 1573 1582 dev_vdbg(hsotg->dev, "Wrote %08lx to HCDMA(%d)\n", 1574 - (unsigned long)chan->xfer_dma, chan->hc_num); 1583 + (unsigned long)dma_addr, chan->hc_num); 1575 1584 } 1576 1585 1577 1586 /* Start the split */ ··· 2634 2625 } 2635 2626 } 2636 2627 2628 + static int dwc2_alloc_split_dma_aligned_buf(struct dwc2_hsotg *hsotg, 2629 + struct dwc2_qh *qh, 2630 + struct dwc2_host_chan *chan) 2631 + { 2632 + if (!hsotg->unaligned_cache || 2633 + chan->max_packet > DWC2_KMEM_UNALIGNED_BUF_SIZE) 2634 + return -ENOMEM; 2635 + 2636 + if (!qh->dw_align_buf) { 2637 + qh->dw_align_buf = kmem_cache_alloc(hsotg->unaligned_cache, 2638 + GFP_ATOMIC | GFP_DMA); 2639 + if (!qh->dw_align_buf) 2640 + return -ENOMEM; 2641 + } 2642 + 2643 + qh->dw_align_buf_dma = dma_map_single(hsotg->dev, qh->dw_align_buf, 2644 + DWC2_KMEM_UNALIGNED_BUF_SIZE, 2645 + DMA_FROM_DEVICE); 2646 + 2647 + if (dma_mapping_error(hsotg->dev, qh->dw_align_buf_dma)) { 2648 + dev_err(hsotg->dev, "can't map align_buf\n"); 2649 + chan->align_buf = 0; 2650 + return -EINVAL; 2651 + } 2652 + 2653 + chan->align_buf = qh->dw_align_buf_dma; 2654 + return 0; 2655 + } 2656 + 2637 2657 #define DWC2_USB_DMA_ALIGN 4 2638 2658 2639 2659 struct dma_aligned_buffer { ··· 2839 2801 2840 2802 /* Set the transfer attributes */ 2841 2803 dwc2_hc_init_xfer(hsotg, chan, qtd); 2804 + 2805 + /* For non-dword aligned buffers */ 2806 + if (hsotg->params.host_dma && qh->do_split && 2807 + chan->ep_is_in && (chan->xfer_dma & 0x3)) { 2808 + dev_vdbg(hsotg->dev, "Non-aligned buffer\n"); 2809 + if (dwc2_alloc_split_dma_aligned_buf(hsotg, qh, chan)) { 2810 + dev_err(hsotg->dev, 2811 + "Failed to allocate memory to handle non-aligned buffer\n"); 2812 + /* Add channel back to free list */ 2813 + chan->align_buf = 0; 2814 + chan->multi_count = 0; 2815 + list_add_tail(&chan->hc_list_entry, 2816 + &hsotg->free_hc_list); 2817 + qtd->in_process = 0; 2818 + qh->channel = NULL; 2819 + return -ENOMEM; 2820 + } 2821 + } else { 2822 + /* 2823 + * We assume that DMA is always aligned in non-split 2824 + * case or split out case. Warn if not. 2825 + */ 2826 + WARN_ON_ONCE(hsotg->params.host_dma && 2827 + (chan->xfer_dma & 0x3)); 2828 + chan->align_buf = 0; 2829 + } 2842 2830 2843 2831 if (chan->ep_type == USB_ENDPOINT_XFER_INT || 2844 2832 chan->ep_type == USB_ENDPOINT_XFER_ISOC) ··· 5310 5246 } 5311 5247 } 5312 5248 5249 + if (hsotg->params.host_dma) { 5250 + /* 5251 + * Create kmem caches to handle non-aligned buffer 5252 + * in Buffer DMA mode. 5253 + */ 5254 + hsotg->unaligned_cache = kmem_cache_create("dwc2-unaligned-dma", 5255 + DWC2_KMEM_UNALIGNED_BUF_SIZE, 4, 5256 + SLAB_CACHE_DMA, NULL); 5257 + if (!hsotg->unaligned_cache) 5258 + dev_err(hsotg->dev, 5259 + "unable to create dwc2 unaligned cache\n"); 5260 + } 5261 + 5313 5262 hsotg->otg_port = 1; 5314 5263 hsotg->frame_list = NULL; 5315 5264 hsotg->frame_list_dma = 0; ··· 5357 5280 return 0; 5358 5281 5359 5282 error4: 5360 - kmem_cache_destroy(hsotg->desc_gen_cache); 5283 + kmem_cache_destroy(hsotg->unaligned_cache); 5361 5284 kmem_cache_destroy(hsotg->desc_hsisoc_cache); 5285 + kmem_cache_destroy(hsotg->desc_gen_cache); 5362 5286 error3: 5363 5287 dwc2_hcd_release(hsotg); 5364 5288 error2: ··· 5400 5322 usb_remove_hcd(hcd); 5401 5323 hsotg->priv = NULL; 5402 5324 5403 - kmem_cache_destroy(hsotg->desc_gen_cache); 5325 + kmem_cache_destroy(hsotg->unaligned_cache); 5404 5326 kmem_cache_destroy(hsotg->desc_hsisoc_cache); 5327 + kmem_cache_destroy(hsotg->desc_gen_cache); 5405 5328 5406 5329 dwc2_hcd_release(hsotg); 5407 5330 usb_put_hcd(hcd); ··· 5514 5435 dwc2_writel(hprt0, hsotg->regs + HPRT0); 5515 5436 5516 5437 /* Wait for the HPRT0.PrtSusp register field to be set */ 5517 - if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 300)) 5438 + if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 3000)) 5518 5439 dev_warn(hsotg->dev, "Suspend wasn't generated\n"); 5519 5440 5520 5441 /* ··· 5694 5615 __func__); 5695 5616 return ret; 5696 5617 } 5618 + 5619 + dwc2_hcd_rem_wakeup(hsotg); 5697 5620 5698 5621 hsotg->hibernated = 0; 5699 5622 hsotg->bus_suspended = 0;
+8
drivers/usb/dwc2/hcd.h
··· 76 76 * (micro)frame 77 77 * @xfer_buf: Pointer to current transfer buffer position 78 78 * @xfer_dma: DMA address of xfer_buf 79 + * @align_buf: In Buffer DMA mode this will be used if xfer_buf is not 80 + * DWORD aligned 79 81 * @xfer_len: Total number of bytes to transfer 80 82 * @xfer_count: Number of bytes transferred so far 81 83 * @start_pkt_count: Packet count at start of transfer ··· 135 133 136 134 u8 *xfer_buf; 137 135 dma_addr_t xfer_dma; 136 + dma_addr_t align_buf; 138 137 u32 xfer_len; 139 138 u32 xfer_count; 140 139 u16 start_pkt_count; ··· 305 302 * speed. Note that this is in "schedule slice" which 306 303 * is tightly packed. 307 304 * @ntd: Actual number of transfer descriptors in a list 305 + * @dw_align_buf: Used instead of original buffer if its physical address 306 + * is not dword-aligned 307 + * @dw_align_buf_dma: DMA address for dw_align_buf 308 308 * @qtd_list: List of QTDs for this QH 309 309 * @channel: Host channel currently processing transfers for this QH 310 310 * @qh_list_entry: Entry for QH in either the periodic or non-periodic ··· 356 350 struct dwc2_hs_transfer_time hs_transfers[DWC2_HS_SCHEDULE_UFRAMES]; 357 351 u32 ls_start_schedule_slice; 358 352 u16 ntd; 353 + u8 *dw_align_buf; 354 + dma_addr_t dw_align_buf_dma; 359 355 struct list_head qtd_list; 360 356 struct dwc2_host_chan *channel; 361 357 struct list_head qh_list_entry;
+9 -2
drivers/usb/dwc2/hcd_intr.c
··· 942 942 frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; 943 943 len = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd, 944 944 DWC2_HC_XFER_COMPLETE, NULL); 945 - if (!len) { 945 + if (!len && !qtd->isoc_split_offset) { 946 946 qtd->complete_split = 0; 947 - qtd->isoc_split_offset = 0; 948 947 return 0; 949 948 } 950 949 951 950 frame_desc->actual_length += len; 951 + 952 + if (chan->align_buf) { 953 + dev_vdbg(hsotg->dev, "non-aligned buffer\n"); 954 + dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma, 955 + DWC2_KMEM_UNALIGNED_BUF_SIZE, DMA_FROM_DEVICE); 956 + memcpy(qtd->urb->buf + (chan->xfer_dma - qtd->urb->dma), 957 + chan->qh->dw_align_buf, len); 958 + } 952 959 953 960 qtd->isoc_split_offset += len; 954 961
+4 -1
drivers/usb/dwc2/hcd_queue.c
··· 383 383 /* Get the map and adjust if this is a multi_tt hub */ 384 384 map = qh->dwc_tt->periodic_bitmaps; 385 385 if (qh->dwc_tt->usb_tt->multi) 386 - map += DWC2_ELEMENTS_PER_LS_BITMAP * qh->ttport; 386 + map += DWC2_ELEMENTS_PER_LS_BITMAP * (qh->ttport - 1); 387 387 388 388 return map; 389 389 } ··· 1696 1696 1697 1697 if (qh->desc_list) 1698 1698 dwc2_hcd_qh_free_ddma(hsotg, qh); 1699 + else if (hsotg->unaligned_cache && qh->dw_align_buf) 1700 + kmem_cache_free(hsotg->unaligned_cache, qh->dw_align_buf); 1701 + 1699 1702 kfree(qh); 1700 1703 } 1701 1704
+13 -10
drivers/usb/dwc3/core.c
··· 1272 1272 if (!dwc->clks) 1273 1273 return -ENOMEM; 1274 1274 1275 - dwc->num_clks = ARRAY_SIZE(dwc3_core_clks); 1276 1275 dwc->dev = dev; 1277 1276 1278 1277 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 1306 1307 if (IS_ERR(dwc->reset)) 1307 1308 return PTR_ERR(dwc->reset); 1308 1309 1309 - ret = clk_bulk_get(dev, dwc->num_clks, dwc->clks); 1310 - if (ret == -EPROBE_DEFER) 1311 - return ret; 1312 - /* 1313 - * Clocks are optional, but new DT platforms should support all clocks 1314 - * as required by the DT-binding. 1315 - */ 1316 - if (ret) 1317 - dwc->num_clks = 0; 1310 + if (dev->of_node) { 1311 + dwc->num_clks = ARRAY_SIZE(dwc3_core_clks); 1312 + 1313 + ret = clk_bulk_get(dev, dwc->num_clks, dwc->clks); 1314 + if (ret == -EPROBE_DEFER) 1315 + return ret; 1316 + /* 1317 + * Clocks are optional, but new DT platforms should support all 1318 + * clocks as required by the DT-binding. 1319 + */ 1320 + if (ret) 1321 + dwc->num_clks = 0; 1322 + } 1318 1323 1319 1324 ret = reset_control_deassert(dwc->reset); 1320 1325 if (ret)
+2 -1
drivers/usb/dwc3/dwc3-of-simple.c
··· 165 165 166 166 reset_control_put(simple->resets); 167 167 168 - pm_runtime_put_sync(dev); 169 168 pm_runtime_disable(dev); 169 + pm_runtime_put_noidle(dev); 170 + pm_runtime_set_suspended(dev); 170 171 171 172 return 0; 172 173 }
+2
drivers/usb/dwc3/dwc3-pci.c
··· 34 34 #define PCI_DEVICE_ID_INTEL_GLK 0x31aa 35 35 #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee 36 36 #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e 37 + #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee 37 38 38 39 #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" 39 40 #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 ··· 290 289 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, 291 290 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPLP), }, 292 291 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPH), }, 292 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICLLP), }, 293 293 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, 294 294 { } /* Terminating Entry */ 295 295 };
+5 -8
drivers/usb/dwc3/dwc3-qcom.c
··· 490 490 qcom->dwc3 = of_find_device_by_node(dwc3_np); 491 491 if (!qcom->dwc3) { 492 492 dev_err(&pdev->dev, "failed to get dwc3 platform device\n"); 493 + ret = -ENODEV; 493 494 goto depopulate; 494 495 } 495 496 ··· 548 547 return 0; 549 548 } 550 549 551 - #ifdef CONFIG_PM_SLEEP 552 - static int dwc3_qcom_pm_suspend(struct device *dev) 550 + static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev) 553 551 { 554 552 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 555 553 int ret = 0; ··· 560 560 return ret; 561 561 } 562 562 563 - static int dwc3_qcom_pm_resume(struct device *dev) 563 + static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev) 564 564 { 565 565 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 566 566 int ret; ··· 571 571 572 572 return ret; 573 573 } 574 - #endif 575 574 576 - #ifdef CONFIG_PM 577 - static int dwc3_qcom_runtime_suspend(struct device *dev) 575 + static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev) 578 576 { 579 577 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 580 578 581 579 return dwc3_qcom_suspend(qcom); 582 580 } 583 581 584 - static int dwc3_qcom_runtime_resume(struct device *dev) 582 + static int __maybe_unused dwc3_qcom_runtime_resume(struct device *dev) 585 583 { 586 584 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 587 585 588 586 return dwc3_qcom_resume(qcom); 589 587 } 590 - #endif 591 588 592 589 static const struct dev_pm_ops dwc3_qcom_dev_pm_ops = { 593 590 SET_SYSTEM_SLEEP_PM_OPS(dwc3_qcom_pm_suspend, dwc3_qcom_pm_resume)
+3
drivers/usb/gadget/composite.c
··· 1719 1719 */ 1720 1720 if (w_value && !f->get_alt) 1721 1721 break; 1722 + 1723 + spin_lock(&cdev->lock); 1722 1724 value = f->set_alt(f, w_index, w_value); 1723 1725 if (value == USB_GADGET_DELAYED_STATUS) { 1724 1726 DBG(cdev, ··· 1730 1728 DBG(cdev, "delayed_status count %d\n", 1731 1729 cdev->delayed_status); 1732 1730 } 1731 + spin_unlock(&cdev->lock); 1733 1732 break; 1734 1733 case USB_REQ_GET_INTERFACE: 1735 1734 if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE))
+18 -8
drivers/usb/gadget/function/f_fs.c
··· 215 215 216 216 struct mm_struct *mm; 217 217 struct work_struct work; 218 + struct work_struct cancellation_work; 218 219 219 220 struct usb_ep *ep; 220 221 struct usb_request *req; ··· 1073 1072 return 0; 1074 1073 } 1075 1074 1075 + static void ffs_aio_cancel_worker(struct work_struct *work) 1076 + { 1077 + struct ffs_io_data *io_data = container_of(work, struct ffs_io_data, 1078 + cancellation_work); 1079 + 1080 + ENTER(); 1081 + 1082 + usb_ep_dequeue(io_data->ep, io_data->req); 1083 + } 1084 + 1076 1085 static int ffs_aio_cancel(struct kiocb *kiocb) 1077 1086 { 1078 1087 struct ffs_io_data *io_data = kiocb->private; 1079 - struct ffs_epfile *epfile = kiocb->ki_filp->private_data; 1088 + struct ffs_data *ffs = io_data->ffs; 1080 1089 int value; 1081 1090 1082 1091 ENTER(); 1083 1092 1084 - spin_lock_irq(&epfile->ffs->eps_lock); 1085 - 1086 - if (likely(io_data && io_data->ep && io_data->req)) 1087 - value = usb_ep_dequeue(io_data->ep, io_data->req); 1088 - else 1093 + if (likely(io_data && io_data->ep && io_data->req)) { 1094 + INIT_WORK(&io_data->cancellation_work, ffs_aio_cancel_worker); 1095 + queue_work(ffs->io_completion_wq, &io_data->cancellation_work); 1096 + value = -EINPROGRESS; 1097 + } else { 1089 1098 value = -EINVAL; 1090 - 1091 - spin_unlock_irq(&epfile->ffs->eps_lock); 1099 + } 1092 1100 1093 1101 return value; 1094 1102 }
+2 -2
drivers/usb/host/xhci-mem.c
··· 886 886 887 887 dev = xhci->devs[slot_id]; 888 888 889 - trace_xhci_free_virt_device(dev); 890 - 891 889 xhci->dcbaa->dev_context_ptrs[slot_id] = 0; 892 890 if (!dev) 893 891 return; 892 + 893 + trace_xhci_free_virt_device(dev); 894 894 895 895 if (dev->tt_info) 896 896 old_active_eps = dev->tt_info->active_eps;
+3 -3
drivers/usb/host/xhci-tegra.c
··· 481 481 unsigned long mask; 482 482 unsigned int port; 483 483 bool idle, enable; 484 - int err; 484 + int err = 0; 485 485 486 486 memset(&rsp, 0, sizeof(rsp)); 487 487 ··· 1223 1223 pm_runtime_disable(&pdev->dev); 1224 1224 usb_put_hcd(tegra->hcd); 1225 1225 disable_xusbc: 1226 - if (!&pdev->dev.pm_domain) 1226 + if (!pdev->dev.pm_domain) 1227 1227 tegra_powergate_power_off(TEGRA_POWERGATE_XUSBC); 1228 1228 disable_xusba: 1229 - if (!&pdev->dev.pm_domain) 1229 + if (!pdev->dev.pm_domain) 1230 1230 tegra_powergate_power_off(TEGRA_POWERGATE_XUSBA); 1231 1231 put_padctl: 1232 1232 tegra_xusb_padctl_put(tegra->padctl);
+31 -5
drivers/usb/host/xhci-trace.h
··· 171 171 TP_ARGS(ring, trb) 172 172 ); 173 173 174 + DECLARE_EVENT_CLASS(xhci_log_free_virt_dev, 175 + TP_PROTO(struct xhci_virt_device *vdev), 176 + TP_ARGS(vdev), 177 + TP_STRUCT__entry( 178 + __field(void *, vdev) 179 + __field(unsigned long long, out_ctx) 180 + __field(unsigned long long, in_ctx) 181 + __field(u8, fake_port) 182 + __field(u8, real_port) 183 + __field(u16, current_mel) 184 + 185 + ), 186 + TP_fast_assign( 187 + __entry->vdev = vdev; 188 + __entry->in_ctx = (unsigned long long) vdev->in_ctx->dma; 189 + __entry->out_ctx = (unsigned long long) vdev->out_ctx->dma; 190 + __entry->fake_port = (u8) vdev->fake_port; 191 + __entry->real_port = (u8) vdev->real_port; 192 + __entry->current_mel = (u16) vdev->current_mel; 193 + ), 194 + TP_printk("vdev %p ctx %llx | %llx fake_port %d real_port %d current_mel %d", 195 + __entry->vdev, __entry->in_ctx, __entry->out_ctx, 196 + __entry->fake_port, __entry->real_port, __entry->current_mel 197 + ) 198 + ); 199 + 200 + DEFINE_EVENT(xhci_log_free_virt_dev, xhci_free_virt_device, 201 + TP_PROTO(struct xhci_virt_device *vdev), 202 + TP_ARGS(vdev) 203 + ); 204 + 174 205 DECLARE_EVENT_CLASS(xhci_log_virt_dev, 175 206 TP_PROTO(struct xhci_virt_device *vdev), 176 207 TP_ARGS(vdev), ··· 235 204 ); 236 205 237 206 DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device, 238 - TP_PROTO(struct xhci_virt_device *vdev), 239 - TP_ARGS(vdev) 240 - ); 241 - 242 - DEFINE_EVENT(xhci_log_virt_dev, xhci_free_virt_device, 243 207 TP_PROTO(struct xhci_virt_device *vdev), 244 208 TP_ARGS(vdev) 245 209 );
+43 -4
drivers/usb/host/xhci.c
··· 908 908 spin_unlock_irqrestore(&xhci->lock, flags); 909 909 } 910 910 911 + static bool xhci_pending_portevent(struct xhci_hcd *xhci) 912 + { 913 + struct xhci_port **ports; 914 + int port_index; 915 + u32 status; 916 + u32 portsc; 917 + 918 + status = readl(&xhci->op_regs->status); 919 + if (status & STS_EINT) 920 + return true; 921 + /* 922 + * Checking STS_EINT is not enough as there is a lag between a change 923 + * bit being set and the Port Status Change Event that it generated 924 + * being written to the Event Ring. See note in xhci 1.1 section 4.19.2. 925 + */ 926 + 927 + port_index = xhci->usb2_rhub.num_ports; 928 + ports = xhci->usb2_rhub.ports; 929 + while (port_index--) { 930 + portsc = readl(ports[port_index]->addr); 931 + if (portsc & PORT_CHANGE_MASK || 932 + (portsc & PORT_PLS_MASK) == XDEV_RESUME) 933 + return true; 934 + } 935 + port_index = xhci->usb3_rhub.num_ports; 936 + ports = xhci->usb3_rhub.ports; 937 + while (port_index--) { 938 + portsc = readl(ports[port_index]->addr); 939 + if (portsc & PORT_CHANGE_MASK || 940 + (portsc & PORT_PLS_MASK) == XDEV_RESUME) 941 + return true; 942 + } 943 + return false; 944 + } 945 + 911 946 /* 912 947 * Stop HC (not bus-specific) 913 948 * ··· 1044 1009 */ 1045 1010 int xhci_resume(struct xhci_hcd *xhci, bool hibernated) 1046 1011 { 1047 - u32 command, temp = 0, status; 1012 + u32 command, temp = 0; 1048 1013 struct usb_hcd *hcd = xhci_to_hcd(xhci); 1049 1014 struct usb_hcd *secondary_hcd; 1050 1015 int retval = 0; ··· 1078 1043 command = readl(&xhci->op_regs->command); 1079 1044 command |= CMD_CRS; 1080 1045 writel(command, &xhci->op_regs->command); 1046 + /* 1047 + * Some controllers take up to 55+ ms to complete the controller 1048 + * restore so setting the timeout to 100ms. Xhci specification 1049 + * doesn't mention any timeout value. 1050 + */ 1081 1051 if (xhci_handshake(&xhci->op_regs->status, 1082 - STS_RESTORE, 0, 10 * 1000)) { 1052 + STS_RESTORE, 0, 100 * 1000)) { 1083 1053 xhci_warn(xhci, "WARN: xHC restore state timeout\n"); 1084 1054 spin_unlock_irq(&xhci->lock); 1085 1055 return -ETIMEDOUT; ··· 1174 1134 done: 1175 1135 if (retval == 0) { 1176 1136 /* Resume root hubs only when have pending events. */ 1177 - status = readl(&xhci->op_regs->status); 1178 - if (status & STS_EINT) { 1137 + if (xhci_pending_portevent(xhci)) { 1179 1138 usb_hcd_resume_root_hub(xhci->shared_hcd); 1180 1139 usb_hcd_resume_root_hub(hcd); 1181 1140 }
+4
drivers/usb/host/xhci.h
··· 382 382 #define PORT_PLC (1 << 22) 383 383 /* port configure error change - port failed to configure its link partner */ 384 384 #define PORT_CEC (1 << 23) 385 + #define PORT_CHANGE_MASK (PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \ 386 + PORT_RC | PORT_PLC | PORT_CEC) 387 + 388 + 385 389 /* Cold Attach Status - xHC can set this bit to report device attached during 386 390 * Sx state. Warm port reset should be perfomed to clear this bit and move port 387 391 * to connected state.
+14
drivers/usb/serial/cp210x.c
··· 95 95 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ 96 96 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 97 97 { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ 98 + { USB_DEVICE(0x10C4, 0x817C) }, /* CESINEL MEDCAL N Power Quality Monitor */ 99 + { USB_DEVICE(0x10C4, 0x817D) }, /* CESINEL MEDCAL NT Power Quality Monitor */ 100 + { USB_DEVICE(0x10C4, 0x817E) }, /* CESINEL MEDCAL S Power Quality Monitor */ 98 101 { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ 99 102 { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ 100 103 { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ ··· 115 112 { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ 116 113 { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ 117 114 { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ 115 + { USB_DEVICE(0x10C4, 0x82EF) }, /* CESINEL FALCO 6105 AC Power Supply */ 116 + { USB_DEVICE(0x10C4, 0x82F1) }, /* CESINEL MEDCAL EFD Earth Fault Detector */ 117 + { USB_DEVICE(0x10C4, 0x82F2) }, /* CESINEL MEDCAL ST Network Analyzer */ 118 118 { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */ 119 119 { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ 120 120 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ ··· 130 124 { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */ 131 125 { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ 132 126 { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */ 127 + { USB_DEVICE(0x10C4, 0x851E) }, /* CESINEL MEDCAL PT Network Analyzer */ 133 128 { USB_DEVICE(0x10C4, 0x85A7) }, /* LifeScan OneTouch Verio IQ */ 129 + { USB_DEVICE(0x10C4, 0x85B8) }, /* CESINEL ReCon T Energy Logger */ 134 130 { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ 135 131 { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ 136 132 { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ ··· 142 134 { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ 143 135 { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ 144 136 { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ 137 + { USB_DEVICE(0x10C4, 0x88FB) }, /* CESINEL MEDCAL STII Network Analyzer */ 138 + { USB_DEVICE(0x10C4, 0x8938) }, /* CESINEL MEDCAL S II Network Analyzer */ 145 139 { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ 146 140 { USB_DEVICE(0x10C4, 0x8962) }, /* Brim Brothers charging dock */ 147 141 { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ 148 142 { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ 143 + { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ 149 144 { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ 150 145 { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ 151 146 { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ 152 147 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 153 148 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 149 + { USB_DEVICE(0x10C4, 0xEA63) }, /* Silicon Labs Windows Update (CP2101-4/CP2102N) */ 154 150 { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ 155 151 { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ 152 + { USB_DEVICE(0x10C4, 0xEA7A) }, /* Silicon Labs Windows Update (CP2105) */ 153 + { USB_DEVICE(0x10C4, 0xEA7B) }, /* Silicon Labs Windows Update (CP2108) */ 156 154 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ 157 155 { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ 158 156 { USB_DEVICE(0x10C4, 0xF003) }, /* Elan Digital Systems USBpulse100 */
+6 -4
drivers/usb/typec/tcpm.c
··· 418 418 u64 ts_nsec = local_clock(); 419 419 unsigned long rem_nsec; 420 420 421 + mutex_lock(&port->logbuffer_lock); 421 422 if (!port->logbuffer[port->logbuffer_head]) { 422 423 port->logbuffer[port->logbuffer_head] = 423 424 kzalloc(LOG_BUFFER_ENTRY_SIZE, GFP_KERNEL); 424 - if (!port->logbuffer[port->logbuffer_head]) 425 + if (!port->logbuffer[port->logbuffer_head]) { 426 + mutex_unlock(&port->logbuffer_lock); 425 427 return; 428 + } 426 429 } 427 430 428 431 vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args); 429 - 430 - mutex_lock(&port->logbuffer_lock); 431 432 432 433 if (tcpm_log_full(port)) { 433 434 port->logbuffer_head = max(port->logbuffer_head - 1, 0); ··· 3044 3043 tcpm_port_is_sink(port) && 3045 3044 time_is_after_jiffies(port->delayed_runtime)) { 3046 3045 tcpm_set_state(port, SNK_DISCOVERY, 3047 - port->delayed_runtime - jiffies); 3046 + jiffies_to_msecs(port->delayed_runtime - 3047 + jiffies)); 3048 3048 break; 3049 3049 } 3050 3050 tcpm_set_state(port, unattached_state(port), 0);
+13
drivers/usb/typec/ucsi/ucsi.c
··· 350 350 } 351 351 352 352 if (con->status.change & UCSI_CONSTAT_CONNECT_CHANGE) { 353 + typec_set_pwr_role(con->port, con->status.pwr_dir); 354 + 355 + switch (con->status.partner_type) { 356 + case UCSI_CONSTAT_PARTNER_TYPE_UFP: 357 + typec_set_data_role(con->port, TYPEC_HOST); 358 + break; 359 + case UCSI_CONSTAT_PARTNER_TYPE_DFP: 360 + typec_set_data_role(con->port, TYPEC_DEVICE); 361 + break; 362 + default: 363 + break; 364 + } 365 + 353 366 if (con->status.connected) 354 367 ucsi_register_partner(con); 355 368 else
+5
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 79 79 return -ENODEV; 80 80 } 81 81 82 + /* This will make sure we can use ioremap_nocache() */ 83 + status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1); 84 + if (ACPI_FAILURE(status)) 85 + return -ENOMEM; 86 + 82 87 /* 83 88 * NOTE: The memory region for the data structures is used also in an 84 89 * operation region, which means ACPI has already reserved it. Therefore
+3
include/linux/acpi.h
··· 443 443 int acpi_check_region(resource_size_t start, resource_size_t n, 444 444 const char *name); 445 445 446 + acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, 447 + u32 level); 448 + 446 449 int acpi_resources_are_enforced(void); 447 450 448 451 #ifdef CONFIG_HIBERNATION