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

Pull USB fixes from Greg KH:
"Here are a number of tiny USB fixes for 5.13-rc6.

There are more than I would normally like, but there's been a bunch of
people banging on the gadget and dwc3 and typec code recently for I
think an Android release, which has resulted in a number of small
fixes. It's nice to see companies send fixes upstream for this type of
work, a notable change from years ago.

Anyway, fixes in here are:

- usb-serial device id updates

- usb-serial cp210x driver fixes for broken firmware versions

- typec fixes for crazy charging devices and other reported problems

- dwc3 fixes for reported problems found

- gadget fixes for reported problems

- tiny xhci fixes

- other small fixes for reported issues.

- revert of a problem fix found by linux-next testing

All of these have passed 0-day and linux-next testing with no reported
problems (the revert for the found linux-next build problem included)"

* tag 'usb-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (44 commits)
Revert "usb: gadget: fsl: Re-enable driver for ARM SoCs"
usb: typec: mux: Fix copy-paste mistake in typec_mux_match
usb: typec: ucsi: Clear PPM capability data in ucsi_init() error path
usb: gadget: fsl: Re-enable driver for ARM SoCs
usb: typec: wcove: Use LE to CPU conversion when accessing msg->header
USB: serial: cp210x: fix CP2102N-A01 modem control
USB: serial: cp210x: fix alternate function for CP2102N QFN20
usb: misc: brcmstb-usb-pinmap: check return value after calling platform_get_resource()
usb: dwc3: ep0: fix NULL pointer exception
usb: gadget: eem: fix wrong eem header operation
usb: typec: intel_pmc_mux: Put ACPI device using acpi_dev_put()
usb: typec: intel_pmc_mux: Add missed error check for devm_ioremap_resource()
usb: typec: intel_pmc_mux: Put fwnode in error case during ->probe()
usb: typec: tcpm: Do not finish VDM AMS for retrying Responses
usb: fix various gadget panics on 10gbps cabling
usb: fix various gadgets null ptr deref on 10gbps cabling.
usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoir
usb: f_ncm: only first packet of aggregate needs to start timer
USB: f_ncm: ncm_bitrate (speed) is unsigned
MAINTAINERS: usb: add entry for isp1760
...

+357 -144
+15
Documentation/devicetree/bindings/connector/usb-connector.yaml
··· 149 149 maxItems: 6 150 150 $ref: /schemas/types.yaml#/definitions/uint32-array 151 151 152 + sink-vdos-v1: 153 + description: An array of u32 with each entry, a Vendor Defined Message Object (VDO), 154 + providing additional information corresponding to the product, the detailed bit 155 + definitions and the order of each VDO can be found in 156 + "USB Power Delivery Specification Revision 2.0, Version 1.3" chapter 6.4.4.3.1 Discover 157 + Identity. User can specify the VDO array via VDO_IDH/_CERT/_PRODUCT/_CABLE/_AMA defined in 158 + dt-bindings/usb/pd.h. 159 + minItems: 3 160 + maxItems: 6 161 + $ref: /schemas/types.yaml#/definitions/uint32-array 162 + 152 163 op-sink-microwatt: 153 164 description: Sink required operating power in microwatt, if source can't 154 165 offer the power, Capability Mismatch is set. Required for power sink and ··· 217 206 SNK_DISCOVERY) and the actual currrent limit after reception of PS_Ready for PD link or during 218 207 SNK_READY for non-pd link. 219 208 type: boolean 209 + 210 + dependencies: 211 + sink-vdos-v1: [ 'sink-vdos' ] 212 + sink-vdos: [ 'sink-vdos-v1' ] 220 213 221 214 required: 222 215 - compatible
+7
MAINTAINERS
··· 18873 18873 F: drivers/usb/host/isp116x* 18874 18874 F: include/linux/usb/isp116x.h 18875 18875 18876 + USB ISP1760 DRIVER 18877 + M: Rui Miguel Silva <rui.silva@linaro.org> 18878 + L: linux-usb@vger.kernel.org 18879 + S: Maintained 18880 + F: drivers/usb/isp1760/* 18881 + F: Documentation/devicetree/bindings/usb/nxp,isp1760.yaml 18882 + 18876 18883 USB LAN78XX ETHERNET DRIVER 18877 18884 M: Woojung Huh <woojung.huh@microchip.com> 18878 18885 M: UNGLinuxDriver@microchip.com
+3 -5
drivers/usb/cdns3/cdns3-gadget.c
··· 2007 2007 else 2008 2008 mask = BIT(priv_ep->num); 2009 2009 2010 - if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) { 2010 + if (priv_ep->type != USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) { 2011 2011 cdns3_set_register_bit(&regs->tdl_from_trb, mask); 2012 2012 cdns3_set_register_bit(&regs->tdl_beh, mask); 2013 2013 cdns3_set_register_bit(&regs->tdl_beh2, mask); ··· 2046 2046 case USB_ENDPOINT_XFER_INT: 2047 2047 ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT); 2048 2048 2049 - if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) || 2050 - priv_dev->dev_ver > DEV_VER_V2) 2049 + if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) 2051 2050 ep_cfg |= EP_CFG_TDL_CHK; 2052 2051 break; 2053 2052 case USB_ENDPOINT_XFER_BULK: 2054 2053 ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK); 2055 2054 2056 - if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) || 2057 - priv_dev->dev_ver > DEV_VER_V2) 2055 + if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) 2058 2056 ep_cfg |= EP_CFG_TDL_CHK; 2059 2057 break; 2060 2058 default:
+4 -3
drivers/usb/cdns3/cdnsp-ring.c
··· 1517 1517 { 1518 1518 struct cdnsp_device *pdev = (struct cdnsp_device *)data; 1519 1519 union cdnsp_trb *event_ring_deq; 1520 + unsigned long flags; 1520 1521 int counter = 0; 1521 1522 1522 - spin_lock(&pdev->lock); 1523 + spin_lock_irqsave(&pdev->lock, flags); 1523 1524 1524 1525 if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) { 1525 1526 cdnsp_died(pdev); 1526 - spin_unlock(&pdev->lock); 1527 + spin_unlock_irqrestore(&pdev->lock, flags); 1527 1528 return IRQ_HANDLED; 1528 1529 } 1529 1530 ··· 1540 1539 1541 1540 cdnsp_update_erst_dequeue(pdev, event_ring_deq, 1); 1542 1541 1543 - spin_unlock(&pdev->lock); 1542 + spin_unlock_irqrestore(&pdev->lock, flags); 1544 1543 1545 1544 return IRQ_HANDLED; 1546 1545 }
-6
drivers/usb/dwc3/core.c
··· 1690 1690 return 0; 1691 1691 } 1692 1692 1693 - static void dwc3_shutdown(struct platform_device *pdev) 1694 - { 1695 - dwc3_remove(pdev); 1696 - } 1697 - 1698 1693 #ifdef CONFIG_PM 1699 1694 static int dwc3_core_init_for_resume(struct dwc3 *dwc) 1700 1695 { ··· 2007 2012 static struct platform_driver dwc3_driver = { 2008 2013 .probe = dwc3_probe, 2009 2014 .remove = dwc3_remove, 2010 - .shutdown = dwc3_shutdown, 2011 2015 .driver = { 2012 2016 .name = "dwc3", 2013 2017 .of_match_table = of_match_ptr(of_dwc3_match),
+3
drivers/usb/dwc3/debug.h
··· 413 413 414 414 415 415 #ifdef CONFIG_DEBUG_FS 416 + extern void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep); 416 417 extern void dwc3_debugfs_init(struct dwc3 *d); 417 418 extern void dwc3_debugfs_exit(struct dwc3 *d); 418 419 #else 420 + static inline void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep) 421 + { } 419 422 static inline void dwc3_debugfs_init(struct dwc3 *d) 420 423 { } 421 424 static inline void dwc3_debugfs_exit(struct dwc3 *d)
+2 -19
drivers/usb/dwc3/debugfs.c
··· 886 886 } 887 887 } 888 888 889 - static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep, 890 - struct dentry *parent) 889 + void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep) 891 890 { 892 891 struct dentry *dir; 893 892 894 - dir = debugfs_create_dir(dep->name, parent); 893 + dir = debugfs_create_dir(dep->name, dep->dwc->root); 895 894 dwc3_debugfs_create_endpoint_files(dep, dir); 896 - } 897 - 898 - static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc, 899 - struct dentry *parent) 900 - { 901 - int i; 902 - 903 - for (i = 0; i < dwc->num_eps; i++) { 904 - struct dwc3_ep *dep = dwc->eps[i]; 905 - 906 - if (!dep) 907 - continue; 908 - 909 - dwc3_debugfs_create_endpoint_dir(dep, parent); 910 - } 911 895 } 912 896 913 897 void dwc3_debugfs_init(struct dwc3 *dwc) ··· 924 940 &dwc3_testmode_fops); 925 941 debugfs_create_file("link_state", 0644, root, dwc, 926 942 &dwc3_link_state_fops); 927 - dwc3_debugfs_create_endpoint_dirs(dwc, root); 928 943 } 929 944 } 930 945
+10 -3
drivers/usb/dwc3/dwc3-meson-g12a.c
··· 651 651 return PTR_ERR(priv->usb_glue_regmap); 652 652 653 653 /* Create a regmap for each USB2 PHY control register set */ 654 - for (i = 0; i < priv->usb2_ports; i++) { 654 + for (i = 0; i < priv->drvdata->num_phys; i++) { 655 655 struct regmap_config u2p_regmap_config = { 656 656 .reg_bits = 8, 657 657 .val_bits = 32, 658 658 .reg_stride = 4, 659 659 .max_register = U2P_R1, 660 660 }; 661 + 662 + if (!strstr(priv->drvdata->phy_names[i], "usb2")) 663 + continue; 661 664 662 665 u2p_regmap_config.name = devm_kasprintf(priv->dev, GFP_KERNEL, 663 666 "u2p-%d", i); ··· 775 772 776 773 ret = priv->drvdata->usb_init(priv); 777 774 if (ret) 778 - goto err_disable_clks; 775 + goto err_disable_regulator; 779 776 780 777 /* Init PHYs */ 781 778 for (i = 0 ; i < PHY_COUNT ; ++i) { 782 779 ret = phy_init(priv->phys[i]); 783 780 if (ret) 784 - goto err_disable_clks; 781 + goto err_disable_regulator; 785 782 } 786 783 787 784 /* Set PHY Power */ ··· 818 815 err_phys_exit: 819 816 for (i = 0 ; i < PHY_COUNT ; ++i) 820 817 phy_exit(priv->phys[i]); 818 + 819 + err_disable_regulator: 820 + if (priv->vbus) 821 + regulator_disable(priv->vbus); 821 822 822 823 err_disable_clks: 823 824 clk_bulk_disable_unprepare(priv->drvdata->num_clks,
+3
drivers/usb/dwc3/ep0.c
··· 292 292 epnum |= 1; 293 293 294 294 dep = dwc->eps[epnum]; 295 + if (dep == NULL) 296 + return NULL; 297 + 295 298 if (dep->flags & DWC3_EP_ENABLED) 296 299 return dep; 297 300
+12 -6
drivers/usb/dwc3/gadget.c
··· 2261 2261 } 2262 2262 2263 2263 /* 2264 - * Synchronize any pending event handling before executing the controller 2265 - * halt routine. 2264 + * Synchronize and disable any further event handling while controller 2265 + * is being enabled/disabled. 2266 2266 */ 2267 - if (!is_on) { 2268 - dwc3_gadget_disable_irq(dwc); 2269 - synchronize_irq(dwc->irq_gadget); 2270 - } 2267 + disable_irq(dwc->irq_gadget); 2271 2268 2272 2269 spin_lock_irqsave(&dwc->lock, flags); 2273 2270 ··· 2302 2305 2303 2306 ret = dwc3_gadget_run_stop(dwc, is_on, false); 2304 2307 spin_unlock_irqrestore(&dwc->lock, flags); 2308 + enable_irq(dwc->irq_gadget); 2309 + 2305 2310 pm_runtime_put(dwc->dev); 2306 2311 2307 2312 return ret; ··· 2753 2754 INIT_LIST_HEAD(&dep->started_list); 2754 2755 INIT_LIST_HEAD(&dep->cancelled_list); 2755 2756 2757 + dwc3_debugfs_create_endpoint_dir(dep); 2758 + 2756 2759 return 0; 2757 2760 } 2758 2761 ··· 2798 2797 list_del(&dep->endpoint.ep_list); 2799 2798 } 2800 2799 2800 + debugfs_remove_recursive(debugfs_lookup(dep->name, dwc->root)); 2801 2801 kfree(dep); 2802 2802 } 2803 2803 } ··· 4048 4046 dwc3_gadget_free_endpoints(dwc); 4049 4047 err4: 4050 4048 usb_put_gadget(dwc->gadget); 4049 + dwc->gadget = NULL; 4051 4050 err3: 4052 4051 dma_free_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc->bounce, 4053 4052 dwc->bounce_addr); ··· 4068 4065 4069 4066 void dwc3_gadget_exit(struct dwc3 *dwc) 4070 4067 { 4068 + if (!dwc->gadget) 4069 + return; 4070 + 4071 4071 usb_del_gadget(dwc->gadget); 4072 4072 dwc3_gadget_free_endpoints(dwc); 4073 4073 usb_put_gadget(dwc->gadget);
+8
drivers/usb/gadget/config.c
··· 164 164 { 165 165 struct usb_gadget *g = f->config->cdev->gadget; 166 166 167 + /* super-speed-plus descriptor falls back to super-speed one, 168 + * if such a descriptor was provided, thus avoiding a NULL 169 + * pointer dereference if a 5gbps capable gadget is used with 170 + * a 10gbps capable config (device port + cable + host port) 171 + */ 172 + if (!ssp) 173 + ssp = ss; 174 + 167 175 if (fs) { 168 176 f->fs_descriptors = usb_copy_descriptors(fs); 169 177 if (!f->fs_descriptors)
+1 -1
drivers/usb/gadget/function/f_ecm.c
··· 791 791 fs_ecm_notify_desc.bEndpointAddress; 792 792 793 793 status = usb_assign_descriptors(f, ecm_fs_function, ecm_hs_function, 794 - ecm_ss_function, NULL); 794 + ecm_ss_function, ecm_ss_function); 795 795 if (status) 796 796 goto fail; 797 797
+3 -3
drivers/usb/gadget/function/f_eem.c
··· 302 302 eem_ss_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress; 303 303 304 304 status = usb_assign_descriptors(f, eem_fs_function, eem_hs_function, 305 - eem_ss_function, NULL); 305 + eem_ss_function, eem_ss_function); 306 306 if (status) 307 307 goto fail; 308 308 ··· 495 495 skb2 = skb_clone(skb, GFP_ATOMIC); 496 496 if (unlikely(!skb2)) { 497 497 DBG(cdev, "unable to unframe EEM packet\n"); 498 - continue; 498 + goto next; 499 499 } 500 500 skb_trim(skb2, len - ETH_FCS_LEN); 501 501 ··· 505 505 GFP_ATOMIC); 506 506 if (unlikely(!skb3)) { 507 507 dev_kfree_skb_any(skb2); 508 - continue; 508 + goto next; 509 509 } 510 510 dev_kfree_skb_any(skb2); 511 511 skb_queue_tail(list, skb3);
+3
drivers/usb/gadget/function/f_fs.c
··· 3567 3567 ffs->func = NULL; 3568 3568 } 3569 3569 3570 + /* Drain any pending AIO completions */ 3571 + drain_workqueue(ffs->io_completion_wq); 3572 + 3570 3573 if (!--opts->refcnt) 3571 3574 functionfs_unbind(ffs); 3572 3575
+2 -1
drivers/usb/gadget/function/f_hid.c
··· 802 802 hidg_fs_out_ep_desc.bEndpointAddress; 803 803 804 804 status = usb_assign_descriptors(f, hidg_fs_descriptors, 805 - hidg_hs_descriptors, hidg_ss_descriptors, NULL); 805 + hidg_hs_descriptors, hidg_ss_descriptors, 806 + hidg_ss_descriptors); 806 807 if (status) 807 808 goto fail; 808 809
+1 -1
drivers/usb/gadget/function/f_loopback.c
··· 207 207 ss_loop_sink_desc.bEndpointAddress = fs_loop_sink_desc.bEndpointAddress; 208 208 209 209 ret = usb_assign_descriptors(f, fs_loopback_descs, hs_loopback_descs, 210 - ss_loopback_descs, NULL); 210 + ss_loopback_descs, ss_loopback_descs); 211 211 if (ret) 212 212 return ret; 213 213
+5 -5
drivers/usb/gadget/function/f_ncm.c
··· 583 583 data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget)); 584 584 data[1] = data[0]; 585 585 586 - DBG(cdev, "notify speed %d\n", ncm_bitrate(cdev->gadget)); 586 + DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget)); 587 587 ncm->notify_state = NCM_NOTIFY_CONNECT; 588 588 break; 589 589 } ··· 1101 1101 ncm->ndp_dgram_count = 1; 1102 1102 1103 1103 /* Note: we skip opts->next_ndp_index */ 1104 - } 1105 1104 1106 - /* Delay the timer. */ 1107 - hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS, 1108 - HRTIMER_MODE_REL_SOFT); 1105 + /* Start the timer. */ 1106 + hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS, 1107 + HRTIMER_MODE_REL_SOFT); 1108 + } 1109 1109 1110 1110 /* Add the datagram position entries */ 1111 1111 ntb_ndp = skb_put_zero(ncm->skb_tx_ndp, dgram_idx_len);
+2 -1
drivers/usb/gadget/function/f_printer.c
··· 1101 1101 ss_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress; 1102 1102 1103 1103 ret = usb_assign_descriptors(f, fs_printer_function, 1104 - hs_printer_function, ss_printer_function, NULL); 1104 + hs_printer_function, ss_printer_function, 1105 + ss_printer_function); 1105 1106 if (ret) 1106 1107 return ret; 1107 1108
+1 -1
drivers/usb/gadget/function/f_rndis.c
··· 789 789 ss_notify_desc.bEndpointAddress = fs_notify_desc.bEndpointAddress; 790 790 791 791 status = usb_assign_descriptors(f, eth_fs_function, eth_hs_function, 792 - eth_ss_function, NULL); 792 + eth_ss_function, eth_ss_function); 793 793 if (status) 794 794 goto fail; 795 795
+1 -1
drivers/usb/gadget/function/f_serial.c
··· 233 233 gser_ss_out_desc.bEndpointAddress = gser_fs_out_desc.bEndpointAddress; 234 234 235 235 status = usb_assign_descriptors(f, gser_fs_function, gser_hs_function, 236 - gser_ss_function, NULL); 236 + gser_ss_function, gser_ss_function); 237 237 if (status) 238 238 goto fail; 239 239 dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n",
+2 -1
drivers/usb/gadget/function/f_sourcesink.c
··· 431 431 ss_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress; 432 432 433 433 ret = usb_assign_descriptors(f, fs_source_sink_descs, 434 - hs_source_sink_descs, ss_source_sink_descs, NULL); 434 + hs_source_sink_descs, ss_source_sink_descs, 435 + ss_source_sink_descs); 435 436 if (ret) 436 437 return ret; 437 438
+1 -1
drivers/usb/gadget/function/f_subset.c
··· 358 358 fs_subset_out_desc.bEndpointAddress; 359 359 360 360 status = usb_assign_descriptors(f, fs_eth_function, hs_eth_function, 361 - ss_eth_function, NULL); 361 + ss_eth_function, ss_eth_function); 362 362 if (status) 363 363 goto fail; 364 364
+2 -1
drivers/usb/gadget/function/f_tcm.c
··· 2057 2057 uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; 2058 2058 2059 2059 ret = usb_assign_descriptors(f, uasp_fs_function_desc, 2060 - uasp_hs_function_desc, uasp_ss_function_desc, NULL); 2060 + uasp_hs_function_desc, uasp_ss_function_desc, 2061 + uasp_ss_function_desc); 2061 2062 if (ret) 2062 2063 goto ep_fail; 2063 2064
+6 -1
drivers/usb/host/xhci-pci.c
··· 59 59 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 60 60 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e 61 61 62 + #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 62 63 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 63 64 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba 64 65 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb ··· 182 181 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2) || 183 182 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) 184 183 xhci->quirks |= XHCI_U2_DISABLE_WAKE; 184 + 185 + if (pdev->vendor == PCI_VENDOR_ID_AMD && 186 + pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI) 187 + xhci->quirks |= XHCI_BROKEN_D3COLD; 185 188 186 189 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { 187 190 xhci->quirks |= XHCI_LPM_SUPPORT; ··· 544 539 * Systems with the TI redriver that loses port status change events 545 540 * need to have the registers polled during D3, so avoid D3cold. 546 541 */ 547 - if (xhci->quirks & XHCI_COMP_MODE_QUIRK) 542 + if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_BROKEN_D3COLD)) 548 543 pci_d3cold_disable(pdev); 549 544 550 545 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
+1
drivers/usb/host/xhci.h
··· 1892 1892 #define XHCI_DISABLE_SPARSE BIT_ULL(38) 1893 1893 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) 1894 1894 #define XHCI_NO_SOFT_RETRY BIT_ULL(40) 1895 + #define XHCI_BROKEN_D3COLD BIT_ULL(41) 1895 1896 1896 1897 unsigned int num_active_eps; 1897 1898 unsigned int limit_active_eps;
+2
drivers/usb/misc/brcmstb-usb-pinmap.c
··· 263 263 return -EINVAL; 264 264 265 265 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 266 + if (!r) 267 + return -EINVAL; 266 268 267 269 pdata = devm_kzalloc(&pdev->dev, 268 270 sizeof(*pdata) +
+1 -2
drivers/usb/musb/musb_core.c
··· 2009 2009 schedule_delayed_work(&musb->irq_work, 2010 2010 msecs_to_jiffies(1000)); 2011 2011 musb->quirk_retries--; 2012 - break; 2013 2012 } 2014 - fallthrough; 2013 + break; 2015 2014 case MUSB_QUIRK_B_INVALID_VBUS_91: 2016 2015 if (musb->quirk_retries && !musb->flush_irq_work) { 2017 2016 musb_dbg(musb,
+78 -6
drivers/usb/serial/cp210x.c
··· 252 252 u8 gpio_input; 253 253 #endif 254 254 u8 partnum; 255 + u32 fw_version; 255 256 speed_t min_speed; 256 257 speed_t max_speed; 257 258 bool use_actual_rate; 259 + bool no_flow_control; 258 260 }; 259 261 260 262 enum cp210x_event_state { ··· 400 398 401 399 /* CP210X_VENDOR_SPECIFIC values */ 402 400 #define CP210X_READ_2NCONFIG 0x000E 401 + #define CP210X_GET_FW_VER_2N 0x0010 403 402 #define CP210X_READ_LATCH 0x00C2 404 403 #define CP210X_GET_PARTNUM 0x370B 405 404 #define CP210X_GET_PORTCONFIG 0x370C ··· 539 536 #define CP210X_2NCONFIG_GPIO_MODE_IDX 581 540 537 #define CP210X_2NCONFIG_GPIO_RSTLATCH_IDX 587 541 538 #define CP210X_2NCONFIG_GPIO_CONTROL_IDX 600 539 + 540 + /* CP2102N QFN20 port configuration values */ 541 + #define CP2102N_QFN20_GPIO2_TXLED_MODE BIT(2) 542 + #define CP2102N_QFN20_GPIO3_RXLED_MODE BIT(3) 543 + #define CP2102N_QFN20_GPIO1_RS485_MODE BIT(4) 544 + #define CP2102N_QFN20_GPIO0_CLK_MODE BIT(6) 542 545 543 546 /* CP210X_VENDOR_SPECIFIC, CP210X_WRITE_LATCH call writes these 0x2 bytes. */ 544 547 struct cp210x_gpio_write { ··· 1131 1122 static void cp210x_set_flow_control(struct tty_struct *tty, 1132 1123 struct usb_serial_port *port, struct ktermios *old_termios) 1133 1124 { 1125 + struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); 1134 1126 struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); 1135 1127 struct cp210x_special_chars chars; 1136 1128 struct cp210x_flow_ctl flow_ctl; 1137 1129 u32 flow_repl; 1138 1130 u32 ctl_hs; 1139 1131 int ret; 1132 + 1133 + /* 1134 + * Some CP2102N interpret ulXonLimit as ulFlowReplace (erratum 1135 + * CP2102N_E104). Report back that flow control is not supported. 1136 + */ 1137 + if (priv->no_flow_control) { 1138 + tty->termios.c_cflag &= ~CRTSCTS; 1139 + tty->termios.c_iflag &= ~(IXON | IXOFF); 1140 + } 1140 1141 1141 1142 if (old_termios && 1142 1143 C_CRTSCTS(tty) == (old_termios->c_cflag & CRTSCTS) && ··· 1204 1185 port_priv->crtscts = false; 1205 1186 } 1206 1187 1207 - if (I_IXOFF(tty)) 1188 + if (I_IXOFF(tty)) { 1208 1189 flow_repl |= CP210X_SERIAL_AUTO_RECEIVE; 1209 - else 1190 + 1191 + flow_ctl.ulXonLimit = cpu_to_le32(128); 1192 + flow_ctl.ulXoffLimit = cpu_to_le32(128); 1193 + } else { 1210 1194 flow_repl &= ~CP210X_SERIAL_AUTO_RECEIVE; 1195 + } 1211 1196 1212 1197 if (I_IXON(tty)) 1213 1198 flow_repl |= CP210X_SERIAL_AUTO_TRANSMIT; 1214 1199 else 1215 1200 flow_repl &= ~CP210X_SERIAL_AUTO_TRANSMIT; 1216 - 1217 - flow_ctl.ulXonLimit = cpu_to_le32(128); 1218 - flow_ctl.ulXoffLimit = cpu_to_le32(128); 1219 1201 1220 1202 dev_dbg(&port->dev, "%s - ctrl = 0x%02x, flow = 0x%02x\n", __func__, 1221 1203 ctl_hs, flow_repl); ··· 1753 1733 priv->gpio_pushpull = (gpio_pushpull >> 3) & 0x0f; 1754 1734 1755 1735 /* 0 indicates GPIO mode, 1 is alternate function */ 1756 - priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; 1736 + if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN20) { 1737 + /* QFN20 is special... */ 1738 + if (gpio_ctrl & CP2102N_QFN20_GPIO0_CLK_MODE) /* GPIO 0 */ 1739 + priv->gpio_altfunc |= BIT(0); 1740 + if (gpio_ctrl & CP2102N_QFN20_GPIO1_RS485_MODE) /* GPIO 1 */ 1741 + priv->gpio_altfunc |= BIT(1); 1742 + if (gpio_ctrl & CP2102N_QFN20_GPIO2_TXLED_MODE) /* GPIO 2 */ 1743 + priv->gpio_altfunc |= BIT(2); 1744 + if (gpio_ctrl & CP2102N_QFN20_GPIO3_RXLED_MODE) /* GPIO 3 */ 1745 + priv->gpio_altfunc |= BIT(3); 1746 + } else { 1747 + priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; 1748 + } 1757 1749 1758 1750 if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN28) { 1759 1751 /* ··· 1940 1908 priv->use_actual_rate = use_actual_rate; 1941 1909 } 1942 1910 1911 + static int cp210x_get_fw_version(struct usb_serial *serial, u16 value) 1912 + { 1913 + struct cp210x_serial_private *priv = usb_get_serial_data(serial); 1914 + u8 ver[3]; 1915 + int ret; 1916 + 1917 + ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, value, 1918 + ver, sizeof(ver)); 1919 + if (ret) 1920 + return ret; 1921 + 1922 + dev_dbg(&serial->interface->dev, "%s - %d.%d.%d\n", __func__, 1923 + ver[0], ver[1], ver[2]); 1924 + 1925 + priv->fw_version = ver[0] << 16 | ver[1] << 8 | ver[2]; 1926 + 1927 + return 0; 1928 + } 1929 + 1930 + static void cp210x_determine_quirks(struct usb_serial *serial) 1931 + { 1932 + struct cp210x_serial_private *priv = usb_get_serial_data(serial); 1933 + int ret; 1934 + 1935 + switch (priv->partnum) { 1936 + case CP210X_PARTNUM_CP2102N_QFN28: 1937 + case CP210X_PARTNUM_CP2102N_QFN24: 1938 + case CP210X_PARTNUM_CP2102N_QFN20: 1939 + ret = cp210x_get_fw_version(serial, CP210X_GET_FW_VER_2N); 1940 + if (ret) 1941 + break; 1942 + if (priv->fw_version <= 0x10004) 1943 + priv->no_flow_control = true; 1944 + break; 1945 + default: 1946 + break; 1947 + } 1948 + } 1949 + 1943 1950 static int cp210x_attach(struct usb_serial *serial) 1944 1951 { 1945 1952 int result; ··· 1999 1928 2000 1929 usb_set_serial_data(serial, priv); 2001 1930 1931 + cp210x_determine_quirks(serial); 2002 1932 cp210x_init_max_speed(serial); 2003 1933 2004 1934 result = cp210x_gpio_init(serial);
+1
drivers/usb/serial/ftdi_sio.c
··· 611 611 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 612 612 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) }, 613 613 { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) }, 614 + { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) }, 614 615 { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, 615 616 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, 616 617 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
+1
drivers/usb/serial/ftdi_sio_ids.h
··· 581 581 #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ 582 582 #define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */ 583 583 #define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */ 584 + #define FTDI_NT_ORIONMX_PID 0x7c93 /* OrionMX */ 584 585 585 586 /* 586 587 * Synapse Wireless product ids (FTDI_VID)
+5 -3
drivers/usb/serial/omninet.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * USB ZyXEL omni.net LCD PLUS driver 3 + * USB ZyXEL omni.net driver 4 4 * 5 5 * Copyright (C) 2013,2017 Johan Hovold <johan@kernel.org> 6 6 * ··· 22 22 #include <linux/usb/serial.h> 23 23 24 24 #define DRIVER_AUTHOR "Alessandro Zummo" 25 - #define DRIVER_DESC "USB ZyXEL omni.net LCD PLUS Driver" 25 + #define DRIVER_DESC "USB ZyXEL omni.net Driver" 26 26 27 27 #define ZYXEL_VENDOR_ID 0x0586 28 28 #define ZYXEL_OMNINET_ID 0x1000 29 + #define ZYXEL_OMNI_56K_PLUS_ID 0x1500 29 30 /* This one seems to be a re-branded ZyXEL device */ 30 31 #define BT_IGNITIONPRO_ID 0x2000 31 32 ··· 41 40 42 41 static const struct usb_device_id id_table[] = { 43 42 { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, 43 + { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNI_56K_PLUS_ID) }, 44 44 { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) }, 45 45 { } /* Terminating entry */ 46 46 }; ··· 52 50 .owner = THIS_MODULE, 53 51 .name = "omninet", 54 52 }, 55 - .description = "ZyXEL - omni.net lcd plus usb", 53 + .description = "ZyXEL - omni.net usb", 56 54 .id_table = id_table, 57 55 .num_bulk_out = 2, 58 56 .calc_num_ports = omninet_calc_num_ports,
+3 -3
drivers/usb/serial/quatech2.c
··· 416 416 417 417 /* flush the port transmit buffer */ 418 418 i = usb_control_msg(serial->dev, 419 - usb_rcvctrlpipe(serial->dev, 0), 419 + usb_sndctrlpipe(serial->dev, 0), 420 420 QT2_FLUSH_DEVICE, 0x40, 1, 421 421 port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); 422 422 ··· 426 426 427 427 /* flush the port receive buffer */ 428 428 i = usb_control_msg(serial->dev, 429 - usb_rcvctrlpipe(serial->dev, 0), 429 + usb_sndctrlpipe(serial->dev, 0), 430 430 QT2_FLUSH_DEVICE, 0x40, 0, 431 431 port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); 432 432 ··· 639 639 int status; 640 640 641 641 /* power on unit */ 642 - status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 642 + status = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 643 643 0xc2, 0x40, 0x8000, 0, NULL, 0, 644 644 QT2_USB_TIMEOUT); 645 645 if (status < 0) {
+1 -1
drivers/usb/typec/mux.c
··· 239 239 dev = class_find_device(&typec_mux_class, NULL, fwnode, 240 240 mux_fwnode_match); 241 241 242 - return dev ? to_typec_switch(dev) : ERR_PTR(-EPROBE_DEFER); 242 + return dev ? to_typec_mux(dev) : ERR_PTR(-EPROBE_DEFER); 243 243 } 244 244 245 245 /**
+11 -4
drivers/usb/typec/mux/intel_pmc_mux.c
··· 582 582 acpi_dev_free_resource_list(&resource_list); 583 583 584 584 if (!pmc->iom_base) { 585 - put_device(&adev->dev); 585 + acpi_dev_put(adev); 586 586 return -ENOMEM; 587 + } 588 + 589 + if (IS_ERR(pmc->iom_base)) { 590 + acpi_dev_put(adev); 591 + return PTR_ERR(pmc->iom_base); 587 592 } 588 593 589 594 pmc->iom_adev = adev; ··· 641 636 break; 642 637 643 638 ret = pmc_usb_register_port(pmc, i, fwnode); 644 - if (ret) 639 + if (ret) { 640 + fwnode_handle_put(fwnode); 645 641 goto err_remove_ports; 642 + } 646 643 } 647 644 648 645 platform_set_drvdata(pdev, pmc); ··· 658 651 usb_role_switch_unregister(pmc->port[i].usb_sw); 659 652 } 660 653 661 - put_device(&pmc->iom_adev->dev); 654 + acpi_dev_put(pmc->iom_adev); 662 655 663 656 return ret; 664 657 } ··· 674 667 usb_role_switch_unregister(pmc->port[i].usb_sw); 675 668 } 676 669 677 - put_device(&pmc->iom_adev->dev); 670 + acpi_dev_put(pmc->iom_adev); 678 671 679 672 return 0; 680 673 }
+77 -46
drivers/usb/typec/tcpm/tcpm.c
··· 401 401 unsigned int nr_src_pdo; 402 402 u32 snk_pdo[PDO_MAX_OBJECTS]; 403 403 unsigned int nr_snk_pdo; 404 + u32 snk_vdo_v1[VDO_MAX_OBJECTS]; 405 + unsigned int nr_snk_vdo_v1; 404 406 u32 snk_vdo[VDO_MAX_OBJECTS]; 405 407 unsigned int nr_snk_vdo; 406 408 ··· 1549 1547 if (PD_VDO_VID(p[0]) != USB_SID_PD) 1550 1548 break; 1551 1549 1552 - if (PD_VDO_SVDM_VER(p[0]) < svdm_version) 1550 + if (PD_VDO_SVDM_VER(p[0]) < svdm_version) { 1553 1551 typec_partner_set_svdm_version(port->partner, 1554 1552 PD_VDO_SVDM_VER(p[0])); 1553 + svdm_version = PD_VDO_SVDM_VER(p[0]); 1554 + } 1555 1555 1556 - tcpm_ams_start(port, DISCOVER_IDENTITY); 1557 - /* 6.4.4.3.1: Only respond as UFP (device) */ 1558 - if (port->data_role == TYPEC_DEVICE && 1556 + port->ams = DISCOVER_IDENTITY; 1557 + /* 1558 + * PD2.0 Spec 6.10.3: respond with NAK as DFP (data host) 1559 + * PD3.1 Spec 6.4.4.2.5.1: respond with NAK if "invalid field" or 1560 + * "wrong configuation" or "Unrecognized" 1561 + */ 1562 + if ((port->data_role == TYPEC_DEVICE || svdm_version >= SVDM_VER_2_0) && 1559 1563 port->nr_snk_vdo) { 1560 - /* 1561 - * Product Type DFP and Connector Type are not defined in SVDM 1562 - * version 1.0 and shall be set to zero. 1563 - */ 1564 - if (typec_get_negotiated_svdm_version(typec) < SVDM_VER_2_0) 1565 - response[1] = port->snk_vdo[0] & ~IDH_DFP_MASK 1566 - & ~IDH_CONN_MASK; 1567 - else 1568 - response[1] = port->snk_vdo[0]; 1569 - for (i = 1; i < port->nr_snk_vdo; i++) 1570 - response[i + 1] = port->snk_vdo[i]; 1571 - rlen = port->nr_snk_vdo + 1; 1564 + if (svdm_version < SVDM_VER_2_0) { 1565 + for (i = 0; i < port->nr_snk_vdo_v1; i++) 1566 + response[i + 1] = port->snk_vdo_v1[i]; 1567 + rlen = port->nr_snk_vdo_v1 + 1; 1568 + 1569 + } else { 1570 + for (i = 0; i < port->nr_snk_vdo; i++) 1571 + response[i + 1] = port->snk_vdo[i]; 1572 + rlen = port->nr_snk_vdo + 1; 1573 + } 1572 1574 } 1573 1575 break; 1574 1576 case CMD_DISCOVER_SVID: 1575 - tcpm_ams_start(port, DISCOVER_SVIDS); 1577 + port->ams = DISCOVER_SVIDS; 1576 1578 break; 1577 1579 case CMD_DISCOVER_MODES: 1578 - tcpm_ams_start(port, DISCOVER_MODES); 1580 + port->ams = DISCOVER_MODES; 1579 1581 break; 1580 1582 case CMD_ENTER_MODE: 1581 - tcpm_ams_start(port, DFP_TO_UFP_ENTER_MODE); 1583 + port->ams = DFP_TO_UFP_ENTER_MODE; 1582 1584 break; 1583 1585 case CMD_EXIT_MODE: 1584 - tcpm_ams_start(port, DFP_TO_UFP_EXIT_MODE); 1586 + port->ams = DFP_TO_UFP_EXIT_MODE; 1585 1587 break; 1586 1588 case CMD_ATTENTION: 1587 - tcpm_ams_start(port, ATTENTION); 1588 1589 /* Attention command does not have response */ 1589 1590 *adev_action = ADEV_ATTENTION; 1590 1591 return 0; ··· 1942 1937 tcpm_log(port, "VDM Tx error, retry"); 1943 1938 port->vdm_retries++; 1944 1939 port->vdm_state = VDM_STATE_READY; 1940 + if (PD_VDO_SVDM(vdo_hdr) && PD_VDO_CMDT(vdo_hdr) == CMDT_INIT) 1941 + tcpm_ams_finish(port); 1942 + } else { 1945 1943 tcpm_ams_finish(port); 1946 1944 } 1947 1945 break; ··· 2191 2183 2192 2184 if (!type) { 2193 2185 tcpm_log(port, "Alert message received with no type"); 2186 + tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP); 2194 2187 return; 2195 2188 } 2196 2189 2197 2190 /* Just handling non-battery alerts for now */ 2198 2191 if (!(type & USB_PD_ADO_TYPE_BATT_STATUS_CHANGE)) { 2199 - switch (port->state) { 2200 - case SRC_READY: 2201 - case SNK_READY: 2192 + if (port->pwr_role == TYPEC_SOURCE) { 2193 + port->upcoming_state = GET_STATUS_SEND; 2194 + tcpm_ams_start(port, GETTING_SOURCE_SINK_STATUS); 2195 + } else { 2196 + /* 2197 + * Do not check SinkTxOk here in case the Source doesn't set its Rp to 2198 + * SinkTxOk in time. 2199 + */ 2200 + port->ams = GETTING_SOURCE_SINK_STATUS; 2202 2201 tcpm_set_state(port, GET_STATUS_SEND, 0); 2203 - break; 2204 - default: 2205 - tcpm_queue_message(port, PD_MSG_CTRL_WAIT); 2206 - break; 2207 2202 } 2203 + } else { 2204 + tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP); 2208 2205 } 2209 2206 } 2210 2207 ··· 2453 2440 tcpm_pd_handle_state(port, BIST_RX, BIST, 0); 2454 2441 break; 2455 2442 case PD_DATA_ALERT: 2456 - tcpm_handle_alert(port, msg->payload, cnt); 2443 + if (port->state != SRC_READY && port->state != SNK_READY) 2444 + tcpm_pd_handle_state(port, port->pwr_role == TYPEC_SOURCE ? 2445 + SRC_SOFT_RESET_WAIT_SNK_TX : SNK_SOFT_RESET, 2446 + NONE_AMS, 0); 2447 + else 2448 + tcpm_handle_alert(port, msg->payload, cnt); 2457 2449 break; 2458 2450 case PD_DATA_BATT_STATUS: 2459 2451 case PD_DATA_GET_COUNTRY_INFO: ··· 2782 2764 2783 2765 switch (type) { 2784 2766 case PD_EXT_STATUS: 2785 - /* 2786 - * If PPS related events raised then get PPS status to clear 2787 - * (see USB PD 3.0 Spec, 6.5.2.4) 2788 - */ 2789 - if (msg->ext_msg.data[USB_PD_EXT_SDB_EVENT_FLAGS] & 2790 - USB_PD_EXT_SDB_PPS_EVENTS) 2791 - tcpm_pd_handle_state(port, GET_PPS_STATUS_SEND, 2792 - GETTING_SOURCE_SINK_STATUS, 0); 2793 - 2794 - else 2795 - tcpm_pd_handle_state(port, ready_state(port), NONE_AMS, 0); 2796 - break; 2797 2767 case PD_EXT_PPS_STATUS: 2798 - /* 2799 - * For now the PPS status message is used to clear events 2800 - * and nothing more. 2801 - */ 2802 - tcpm_pd_handle_state(port, ready_state(port), NONE_AMS, 0); 2768 + if (port->ams == GETTING_SOURCE_SINK_STATUS) { 2769 + tcpm_ams_finish(port); 2770 + tcpm_set_state(port, ready_state(port), 0); 2771 + } else { 2772 + /* unexpected Status or PPS_Status Message */ 2773 + tcpm_pd_handle_state(port, port->pwr_role == TYPEC_SOURCE ? 2774 + SRC_SOFT_RESET_WAIT_SNK_TX : SNK_SOFT_RESET, 2775 + NONE_AMS, 0); 2776 + } 2803 2777 break; 2804 2778 case PD_EXT_SOURCE_CAP_EXT: 2805 2779 case PD_EXT_GET_BATT_CAP: ··· 5957 5947 return ret; 5958 5948 } 5959 5949 5950 + /* If sink-vdos is found, sink-vdos-v1 is expected for backward compatibility. */ 5951 + if (port->nr_snk_vdo) { 5952 + ret = fwnode_property_count_u32(fwnode, "sink-vdos-v1"); 5953 + if (ret < 0) 5954 + return ret; 5955 + else if (ret == 0) 5956 + return -ENODATA; 5957 + 5958 + port->nr_snk_vdo_v1 = min(ret, VDO_MAX_OBJECTS); 5959 + ret = fwnode_property_read_u32_array(fwnode, "sink-vdos-v1", 5960 + port->snk_vdo_v1, 5961 + port->nr_snk_vdo_v1); 5962 + if (ret < 0) 5963 + return ret; 5964 + } 5965 + 5960 5966 return 0; 5961 5967 } 5962 5968 ··· 6337 6311 void tcpm_unregister_port(struct tcpm_port *port) 6338 6312 { 6339 6313 int i; 6314 + 6315 + hrtimer_cancel(&port->send_discover_timer); 6316 + hrtimer_cancel(&port->enable_frs_timer); 6317 + hrtimer_cancel(&port->vdm_state_machine_timer); 6318 + hrtimer_cancel(&port->state_machine_timer); 6340 6319 6341 6320 tcpm_reset_port(port); 6342 6321 for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++)
+1 -1
drivers/usb/typec/tcpm/wcove.c
··· 378 378 const u8 *data = (void *)msg; 379 379 int i; 380 380 381 - for (i = 0; i < pd_header_cnt(msg->header) * 4 + 2; i++) { 381 + for (i = 0; i < pd_header_cnt_le(msg->header) * 4 + 2; i++) { 382 382 ret = regmap_write(wcove->regmap, USBC_TX_DATA + i, 383 383 data[i]); 384 384 if (ret)
+1
drivers/usb/typec/ucsi/ucsi.c
··· 1253 1253 } 1254 1254 1255 1255 err_reset: 1256 + memset(&ucsi->cap, 0, sizeof(ucsi->cap)); 1256 1257 ucsi_reset_ppm(ucsi); 1257 1258 err: 1258 1259 return ret;
+76 -13
include/dt-bindings/usb/pd.h
··· 106 106 * <20:16> :: Reserved, Shall be set to zero 107 107 * <15:0> :: USB-IF assigned VID for this cable vendor 108 108 */ 109 + 110 + /* PD Rev2.0 definition */ 111 + #define IDH_PTYPE_UNDEF 0 112 + 109 113 /* SOP Product Type (UFP) */ 110 114 #define IDH_PTYPE_NOT_UFP 0 111 115 #define IDH_PTYPE_HUB 1 ··· 167 163 #define UFP_VDO_VER1_2 2 168 164 169 165 /* Device Capability */ 170 - #define DEV_USB2_CAPABLE BIT(0) 171 - #define DEV_USB2_BILLBOARD BIT(1) 172 - #define DEV_USB3_CAPABLE BIT(2) 173 - #define DEV_USB4_CAPABLE BIT(3) 166 + #define DEV_USB2_CAPABLE (1 << 0) 167 + #define DEV_USB2_BILLBOARD (1 << 1) 168 + #define DEV_USB3_CAPABLE (1 << 2) 169 + #define DEV_USB4_CAPABLE (1 << 3) 174 170 175 171 /* Connector Type */ 176 172 #define UFP_RECEPTACLE 2 ··· 195 191 196 192 /* Alternate Modes */ 197 193 #define UFP_ALTMODE_NOT_SUPP 0 198 - #define UFP_ALTMODE_TBT3 BIT(0) 199 - #define UFP_ALTMODE_RECFG BIT(1) 200 - #define UFP_ALTMODE_NO_RECFG BIT(2) 194 + #define UFP_ALTMODE_TBT3 (1 << 0) 195 + #define UFP_ALTMODE_RECFG (1 << 1) 196 + #define UFP_ALTMODE_NO_RECFG (1 << 2) 201 197 202 198 /* USB Highest Speed */ 203 199 #define UFP_USB2_ONLY 0 ··· 221 217 * <4:0> :: Port number 222 218 */ 223 219 #define DFP_VDO_VER1_1 1 224 - #define HOST_USB2_CAPABLE BIT(0) 225 - #define HOST_USB3_CAPABLE BIT(1) 226 - #define HOST_USB4_CAPABLE BIT(2) 220 + #define HOST_USB2_CAPABLE (1 << 0) 221 + #define HOST_USB3_CAPABLE (1 << 1) 222 + #define HOST_USB4_CAPABLE (1 << 2) 227 223 #define DFP_RECEPTACLE 2 228 224 #define DFP_CAPTIVE 3 229 225 ··· 232 228 | ((pnum) & 0x1f)) 233 229 234 230 /* 235 - * Passive Cable VDO 231 + * Cable VDO (for both Passive and Active Cable VDO in PD Rev2.0) 232 + * --------- 233 + * <31:28> :: Cable HW version 234 + * <27:24> :: Cable FW version 235 + * <23:20> :: Reserved, Shall be set to zero 236 + * <19:18> :: type-C to Type-A/B/C/Captive (00b == A, 01 == B, 10 == C, 11 == Captive) 237 + * <17> :: Reserved, Shall be set to zero 238 + * <16:13> :: cable latency (0001 == <10ns(~1m length)) 239 + * <12:11> :: cable termination type (11b == both ends active VCONN req) 240 + * <10> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) 241 + * <9> :: SSTX2 Directionality support 242 + * <8> :: SSRX1 Directionality support 243 + * <7> :: SSRX2 Directionality support 244 + * <6:5> :: Vbus current handling capability (01b == 3A, 10b == 5A) 245 + * <4> :: Vbus through cable (0b == no, 1b == yes) 246 + * <3> :: SOP" controller present? (0b == no, 1b == yes) 247 + * <2:0> :: USB SS Signaling support 248 + * 249 + * Passive Cable VDO (PD Rev3.0+) 236 250 * --------- 237 251 * <31:28> :: Cable HW version 238 252 * <27:24> :: Cable FW version ··· 266 244 * <4:3> :: Reserved, Shall be set to zero 267 245 * <2:0> :: USB highest speed 268 246 * 269 - * Active Cable VDO 1 247 + * Active Cable VDO 1 (PD Rev3.0+) 270 248 * --------- 271 249 * <31:28> :: Cable HW version 272 250 * <27:24> :: Cable FW version ··· 288 266 #define CABLE_VDO_VER1_0 0 289 267 #define CABLE_VDO_VER1_3 3 290 268 291 - /* Connector Type */ 269 + /* Connector Type (_ATYPE and _BTYPE are for PD Rev2.0 only) */ 270 + #define CABLE_ATYPE 0 271 + #define CABLE_BTYPE 1 292 272 #define CABLE_CTYPE 2 293 273 #define CABLE_CAPTIVE 3 294 274 ··· 327 303 #define CABLE_CURR_3A 1 328 304 #define CABLE_CURR_5A 2 329 305 306 + /* USB SuperSpeed Signaling Support (PD Rev2.0) */ 307 + #define CABLE_USBSS_U2_ONLY 0 308 + #define CABLE_USBSS_U31_GEN1 1 309 + #define CABLE_USBSS_U31_GEN2 2 310 + 330 311 /* USB Highest Speed */ 331 312 #define CABLE_USB2_ONLY 0 332 313 #define CABLE_USB32_GEN1 1 333 314 #define CABLE_USB32_4_GEN2 2 334 315 #define CABLE_USB4_GEN3 3 335 316 317 + #define VDO_CABLE(hw, fw, cbl, lat, term, tx1d, tx2d, rx1d, rx2d, cur, vps, sopp, usbss) \ 318 + (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18 \ 319 + | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11 | (tx1d) << 10 \ 320 + | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7 | ((cur) & 0x3) << 5 \ 321 + | (vps) << 4 | (sopp) << 3 | ((usbss) & 0x7)) 336 322 #define VDO_PCABLE(hw, fw, ver, conn, lat, term, vbm, cur, spd) \ 337 323 (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 | ((ver) & 0x7) << 21 \ 338 324 | ((conn) & 0x3) << 18 | ((lat) & 0xf) << 13 | ((term) & 0x3) << 11 \ ··· 406 372 | (trans) << 11 | (phy) << 10 | (ele) << 9 | (u4) << 8 \ 407 373 | ((hops) & 0x3) << 6 | (u2) << 5 | (u32) << 4 | (lane) << 3 \ 408 374 | (iso) << 2 | (gen)) 375 + 376 + /* 377 + * AMA VDO (PD Rev2.0) 378 + * --------- 379 + * <31:28> :: Cable HW version 380 + * <27:24> :: Cable FW version 381 + * <23:12> :: Reserved, Shall be set to zero 382 + * <11> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) 383 + * <10> :: SSTX2 Directionality support 384 + * <9> :: SSRX1 Directionality support 385 + * <8> :: SSRX2 Directionality support 386 + * <7:5> :: Vconn power 387 + * <4> :: Vconn power required 388 + * <3> :: Vbus power required 389 + * <2:0> :: USB SS Signaling support 390 + */ 391 + #define VDO_AMA(hw, fw, tx1d, tx2d, rx1d, rx2d, vcpwr, vcr, vbr, usbss) \ 392 + (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 \ 393 + | (tx1d) << 11 | (tx2d) << 10 | (rx1d) << 9 | (rx2d) << 8 \ 394 + | ((vcpwr) & 0x7) << 5 | (vcr) << 4 | (vbr) << 3 \ 395 + | ((usbss) & 0x7)) 396 + 397 + #define PD_VDO_AMA_VCONN_REQ(vdo) (((vdo) >> 4) & 1) 398 + #define PD_VDO_AMA_VBUS_REQ(vdo) (((vdo) >> 3) & 1) 399 + 400 + #define AMA_USBSS_U2_ONLY 0 401 + #define AMA_USBSS_U31_GEN1 1 402 + #define AMA_USBSS_U31_GEN2 2 403 + #define AMA_USBSS_BBONLY 3 409 404 410 405 /* 411 406 * VPD VDO
+1 -1
include/linux/usb/pd.h
··· 460 460 #define PD_T_RECEIVER_RESPONSE 15 /* 15ms max */ 461 461 #define PD_T_SOURCE_ACTIVITY 45 462 462 #define PD_T_SINK_ACTIVITY 135 463 - #define PD_T_SINK_WAIT_CAP 240 463 + #define PD_T_SINK_WAIT_CAP 310 /* 310 - 620 ms */ 464 464 #define PD_T_PS_TRANSITION 500 465 465 #define PD_T_SRC_TRANSITION 35 466 466 #define PD_T_DRP_SNK 40
-4
include/linux/usb/pd_ext_sdb.h
··· 24 24 #define USB_PD_EXT_SDB_EVENT_OVP BIT(3) 25 25 #define USB_PD_EXT_SDB_EVENT_CF_CV_MODE BIT(4) 26 26 27 - #define USB_PD_EXT_SDB_PPS_EVENTS (USB_PD_EXT_SDB_EVENT_OCP | \ 28 - USB_PD_EXT_SDB_EVENT_OTP | \ 29 - USB_PD_EXT_SDB_EVENT_OVP) 30 - 31 27 #endif /* __LINUX_USB_PD_EXT_SDB_H */