Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull USB fixes from Greg KH:
"Here are four small USB fixes for 5.2-rc6.

They include two xhci bugfixes, a chipidea fix, and a small dwc2 fix.
Nothing major, just nice things to get resolved for reported issues.

All have been in linux-next with no reported issues"

* tag 'usb-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
xhci: detect USB 3.2 capable host controllers correctly
usb: xhci: Don't try to recover an endpoint if port is in error state.
usb: dwc2: Use generic PHY width in params setup
usb: chipidea: udc: workaround for endpoint conflict issue

+72 -15
+20
drivers/usb/chipidea/udc.c
··· 1622 1622 static int ci_udc_start(struct usb_gadget *gadget, 1623 1623 struct usb_gadget_driver *driver); 1624 1624 static int ci_udc_stop(struct usb_gadget *gadget); 1625 + 1626 + /* Match ISOC IN from the highest endpoint */ 1627 + static struct usb_ep *ci_udc_match_ep(struct usb_gadget *gadget, 1628 + struct usb_endpoint_descriptor *desc, 1629 + struct usb_ss_ep_comp_descriptor *comp_desc) 1630 + { 1631 + struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); 1632 + struct usb_ep *ep; 1633 + 1634 + if (usb_endpoint_xfer_isoc(desc) && usb_endpoint_dir_in(desc)) { 1635 + list_for_each_entry_reverse(ep, &ci->gadget.ep_list, ep_list) { 1636 + if (ep->caps.dir_in && !ep->claimed) 1637 + return ep; 1638 + } 1639 + } 1640 + 1641 + return NULL; 1642 + } 1643 + 1625 1644 /** 1626 1645 * Device operations part of the API to the USB controller hardware, 1627 1646 * which don't involve endpoints (or i/o) ··· 1654 1635 .vbus_draw = ci_udc_vbus_draw, 1655 1636 .udc_start = ci_udc_start, 1656 1637 .udc_stop = ci_udc_stop, 1638 + .match_ep = ci_udc_match_ep, 1657 1639 }; 1658 1640 1659 1641 static int init_eps(struct ci_hdrc *ci)
+9
drivers/usb/dwc2/params.c
··· 253 253 val = (hsotg->hw_params.utmi_phy_data_width == 254 254 GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16; 255 255 256 + if (hsotg->phy) { 257 + /* 258 + * If using the generic PHY framework, check if the PHY bus 259 + * width is 8-bit and set the phyif appropriately. 260 + */ 261 + if (phy_get_bus_width(hsotg->phy) == 8) 262 + val = 8; 263 + } 264 + 256 265 hsotg->params.phy_utmi_width = val; 257 266 } 258 267
-9
drivers/usb/dwc2/platform.c
··· 271 271 272 272 hsotg->plat = dev_get_platdata(hsotg->dev); 273 273 274 - if (hsotg->phy) { 275 - /* 276 - * If using the generic PHY framework, check if the PHY bus 277 - * width is 8-bit and set the phyif appropriately. 278 - */ 279 - if (phy_get_bus_width(hsotg->phy) == 8) 280 - hsotg->params.phy_utmi_width = 8; 281 - } 282 - 283 274 /* Clock */ 284 275 hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg"); 285 276 if (IS_ERR(hsotg->clk)) {
+14 -1
drivers/usb/host/xhci-ring.c
··· 1612 1612 usb_hcd_resume_root_hub(hcd); 1613 1613 } 1614 1614 1615 - if (hcd->speed >= HCD_USB3 && (portsc & PORT_PLS_MASK) == XDEV_INACTIVE) 1615 + if (hcd->speed >= HCD_USB3 && 1616 + (portsc & PORT_PLS_MASK) == XDEV_INACTIVE) { 1617 + slot_id = xhci_find_slot_id_by_port(hcd, xhci, hcd_portnum + 1); 1618 + if (slot_id && xhci->devs[slot_id]) 1619 + xhci->devs[slot_id]->flags |= VDEV_PORT_ERROR; 1616 1620 bus_state->port_remote_wakeup &= ~(1 << hcd_portnum); 1621 + } 1617 1622 1618 1623 if ((portsc & PORT_PLC) && (portsc & PORT_PLS_MASK) == XDEV_RESUME) { 1619 1624 xhci_dbg(xhci, "port resume event for port %d\n", port_id); ··· 1806 1801 { 1807 1802 struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; 1808 1803 struct xhci_command *command; 1804 + 1805 + /* 1806 + * Avoid resetting endpoint if link is inactive. Can cause host hang. 1807 + * Device will be reset soon to recover the link so don't do anything 1808 + */ 1809 + if (xhci->devs[slot_id]->flags & VDEV_PORT_ERROR) 1810 + return; 1811 + 1809 1812 command = xhci_alloc_command(xhci, false, GFP_ATOMIC); 1810 1813 if (!command) 1811 1814 return;
+20 -5
drivers/usb/host/xhci.c
··· 1466 1466 xhci_dbg(xhci, "urb submitted during PCI suspend\n"); 1467 1467 return -ESHUTDOWN; 1468 1468 } 1469 + if (xhci->devs[slot_id]->flags & VDEV_PORT_ERROR) { 1470 + xhci_dbg(xhci, "Can't queue urb, port error, link inactive\n"); 1471 + return -ENODEV; 1472 + } 1469 1473 1470 1474 if (usb_endpoint_xfer_isoc(&urb->ep->desc)) 1471 1475 num_tds = urb->number_of_packets; ··· 3758 3754 } 3759 3755 /* If necessary, update the number of active TTs on this root port */ 3760 3756 xhci_update_tt_active_eps(xhci, virt_dev, old_active_eps); 3757 + virt_dev->flags = 0; 3761 3758 ret = 0; 3762 3759 3763 3760 command_cleanup: ··· 5065 5060 } else { 5066 5061 /* 5067 5062 * Some 3.1 hosts return sbrn 0x30, use xhci supported protocol 5068 - * minor revision instead of sbrn 5063 + * minor revision instead of sbrn. Minor revision is a two digit 5064 + * BCD containing minor and sub-minor numbers, only show minor. 5069 5065 */ 5070 - minor_rev = xhci->usb3_rhub.min_rev; 5071 - if (minor_rev) { 5066 + minor_rev = xhci->usb3_rhub.min_rev / 0x10; 5067 + 5068 + switch (minor_rev) { 5069 + case 2: 5070 + hcd->speed = HCD_USB32; 5071 + hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; 5072 + hcd->self.root_hub->rx_lanes = 2; 5073 + hcd->self.root_hub->tx_lanes = 2; 5074 + break; 5075 + case 1: 5072 5076 hcd->speed = HCD_USB31; 5073 5077 hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; 5078 + break; 5074 5079 } 5075 - xhci_info(xhci, "Host supports USB 3.%x %s SuperSpeed\n", 5080 + xhci_info(xhci, "Host supports USB 3.%x %sSuperSpeed\n", 5076 5081 minor_rev, 5077 - minor_rev ? "Enhanced" : ""); 5082 + minor_rev ? "Enhanced " : ""); 5078 5083 5079 5084 xhci->usb3_rhub.hcd = hcd; 5080 5085 /* xHCI private pointer was set in xhci_pci_probe for the second
+9
drivers/usb/host/xhci.h
··· 1010 1010 u8 real_port; 1011 1011 struct xhci_interval_bw_table *bw_table; 1012 1012 struct xhci_tt_bw_info *tt_info; 1013 + /* 1014 + * flags for state tracking based on events and issued commands. 1015 + * Software can not rely on states from output contexts because of 1016 + * latency between events and xHC updating output context values. 1017 + * See xhci 1.1 section 4.8.3 for more details 1018 + */ 1019 + unsigned long flags; 1020 + #define VDEV_PORT_ERROR BIT(0) /* Port error, link inactive */ 1021 + 1013 1022 /* The current max exit latency for the enabled USB3 link states. */ 1014 1023 u16 current_mel; 1015 1024 /* Used for the debugfs interfaces. */