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

Pull USB/Thunderbolt fixes from Greg KH:
"Here are some small USB and Thunderbolt driver fixes for 5.9-rc5.

Nothing huge, just a number of bugfixes and new device ids for
problems reported:

- new USB serial driver ids

- bug fixes for syzbot reported problems

- typec driver fixes

- thunderbolt driver fixes

- revert of reported broken commit

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

* tag 'usb-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: typec: intel_pmc_mux: Do not configure SBU and HSL Orientation in Alternate modes
usb: typec: intel_pmc_mux: Do not configure Altmode HPD High
usb: core: fix slab-out-of-bounds Read in read_descriptors
Revert "usb: dwc3: meson-g12a: fix shared reset control use"
usb: typec: ucsi: acpi: Check the _DEP dependencies
usb: typec: intel_pmc_mux: Un-register the USB role switch
usb: Fix out of sync data toggle if a configured device is reconfigured
USB: serial: option: support dynamic Quectel USB compositions
USB: serial: option: add support for SIM7070/SIM7080/SIM7090 modules
thunderbolt: Use maximum USB3 link rate when reclaiming if link is not up
thunderbolt: Disable ports that are not implemented
USB: serial: ftdi_sio: add IDs for Xsens Mti USB converter

Changed files
+87 -81
drivers
+1
drivers/thunderbolt/switch.c
··· 684 684 if (res == -ENODEV) { 685 685 tb_dbg(port->sw->tb, " Port %d: not implemented\n", 686 686 port->port); 687 + port->disabled = true; 687 688 return 0; 688 689 } 689 690 return res;
+1 -1
drivers/thunderbolt/tb.h
··· 186 186 * @cap_adap: Offset of the adapter specific capability (%0 if not present) 187 187 * @cap_usb4: Offset to the USB4 port capability (%0 if not present) 188 188 * @port: Port number on switch 189 - * @disabled: Disabled by eeprom 189 + * @disabled: Disabled by eeprom or enabled but not implemented 190 190 * @bonded: true if the port is bonded (two lanes combined as one) 191 191 * @dual_link_port: If the switch is connected using two ports, points 192 192 * to the other port.
+10 -2
drivers/thunderbolt/tunnel.c
··· 951 951 int ret, max_rate, allocate_up, allocate_down; 952 952 953 953 ret = usb4_usb3_port_actual_link_rate(tunnel->src_port); 954 - if (ret <= 0) { 955 - tb_tunnel_warn(tunnel, "tunnel is not up\n"); 954 + if (ret < 0) { 955 + tb_tunnel_warn(tunnel, "failed to read actual link rate\n"); 956 956 return; 957 + } else if (!ret) { 958 + /* Use maximum link rate if the link valid is not set */ 959 + ret = usb4_usb3_port_max_link_rate(tunnel->src_port); 960 + if (ret < 0) { 961 + tb_tunnel_warn(tunnel, "failed to read maximum link rate\n"); 962 + return; 963 + } 957 964 } 965 + 958 966 /* 959 967 * 90% of the max rate can be allocated for isochronous 960 968 * transfers.
+42 -49
drivers/usb/core/message.c
··· 1205 1205 } 1206 1206 } 1207 1207 1208 + /* 1209 + * usb_disable_device_endpoints -- Disable all endpoints for a device 1210 + * @dev: the device whose endpoints are being disabled 1211 + * @skip_ep0: 0 to disable endpoint 0, 1 to skip it. 1212 + */ 1213 + static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0) 1214 + { 1215 + struct usb_hcd *hcd = bus_to_hcd(dev->bus); 1216 + int i; 1217 + 1218 + if (hcd->driver->check_bandwidth) { 1219 + /* First pass: Cancel URBs, leave endpoint pointers intact. */ 1220 + for (i = skip_ep0; i < 16; ++i) { 1221 + usb_disable_endpoint(dev, i, false); 1222 + usb_disable_endpoint(dev, i + USB_DIR_IN, false); 1223 + } 1224 + /* Remove endpoints from the host controller internal state */ 1225 + mutex_lock(hcd->bandwidth_mutex); 1226 + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1227 + mutex_unlock(hcd->bandwidth_mutex); 1228 + } 1229 + /* Second pass: remove endpoint pointers */ 1230 + for (i = skip_ep0; i < 16; ++i) { 1231 + usb_disable_endpoint(dev, i, true); 1232 + usb_disable_endpoint(dev, i + USB_DIR_IN, true); 1233 + } 1234 + } 1235 + 1208 1236 /** 1209 1237 * usb_disable_device - Disable all the endpoints for a USB device 1210 1238 * @dev: the device whose endpoints are being disabled ··· 1246 1218 void usb_disable_device(struct usb_device *dev, int skip_ep0) 1247 1219 { 1248 1220 int i; 1249 - struct usb_hcd *hcd = bus_to_hcd(dev->bus); 1250 1221 1251 1222 /* getting rid of interfaces will disconnect 1252 1223 * any drivers bound to them (a key side effect) ··· 1291 1264 1292 1265 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, 1293 1266 skip_ep0 ? "non-ep0" : "all"); 1294 - if (hcd->driver->check_bandwidth) { 1295 - /* First pass: Cancel URBs, leave endpoint pointers intact. */ 1296 - for (i = skip_ep0; i < 16; ++i) { 1297 - usb_disable_endpoint(dev, i, false); 1298 - usb_disable_endpoint(dev, i + USB_DIR_IN, false); 1299 - } 1300 - /* Remove endpoints from the host controller internal state */ 1301 - mutex_lock(hcd->bandwidth_mutex); 1302 - usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1303 - mutex_unlock(hcd->bandwidth_mutex); 1304 - /* Second pass: remove endpoint pointers */ 1305 - } 1306 - for (i = skip_ep0; i < 16; ++i) { 1307 - usb_disable_endpoint(dev, i, true); 1308 - usb_disable_endpoint(dev, i + USB_DIR_IN, true); 1309 - } 1267 + 1268 + usb_disable_device_endpoints(dev, skip_ep0); 1310 1269 } 1311 1270 1312 1271 /** ··· 1535 1522 * The caller must own the device lock. 1536 1523 * 1537 1524 * Return: Zero on success, else a negative error code. 1525 + * 1526 + * If this routine fails the device will probably be in an unusable state 1527 + * with endpoints disabled, and interfaces only partially enabled. 1538 1528 */ 1539 1529 int usb_reset_configuration(struct usb_device *dev) 1540 1530 { ··· 1553 1537 * calls during probe() are fine 1554 1538 */ 1555 1539 1556 - for (i = 1; i < 16; ++i) { 1557 - usb_disable_endpoint(dev, i, true); 1558 - usb_disable_endpoint(dev, i + USB_DIR_IN, true); 1559 - } 1540 + usb_disable_device_endpoints(dev, 1); /* skip ep0*/ 1560 1541 1561 1542 config = dev->actconfig; 1562 1543 retval = 0; ··· 1566 1553 mutex_unlock(hcd->bandwidth_mutex); 1567 1554 return -ENOMEM; 1568 1555 } 1569 - /* Make sure we have enough bandwidth for each alternate setting 0 */ 1570 - for (i = 0; i < config->desc.bNumInterfaces; i++) { 1571 - struct usb_interface *intf = config->interface[i]; 1572 - struct usb_host_interface *alt; 1573 1556 1574 - alt = usb_altnum_to_altsetting(intf, 0); 1575 - if (!alt) 1576 - alt = &intf->altsetting[0]; 1577 - if (alt != intf->cur_altsetting) 1578 - retval = usb_hcd_alloc_bandwidth(dev, NULL, 1579 - intf->cur_altsetting, alt); 1580 - if (retval < 0) 1581 - break; 1582 - } 1583 - /* If not, reinstate the old alternate settings */ 1557 + /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */ 1558 + retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL); 1584 1559 if (retval < 0) { 1585 - reset_old_alts: 1586 - for (i--; i >= 0; i--) { 1587 - struct usb_interface *intf = config->interface[i]; 1588 - struct usb_host_interface *alt; 1589 - 1590 - alt = usb_altnum_to_altsetting(intf, 0); 1591 - if (!alt) 1592 - alt = &intf->altsetting[0]; 1593 - if (alt != intf->cur_altsetting) 1594 - usb_hcd_alloc_bandwidth(dev, NULL, 1595 - alt, intf->cur_altsetting); 1596 - } 1597 1560 usb_enable_lpm(dev); 1598 1561 mutex_unlock(hcd->bandwidth_mutex); 1599 1562 return retval; ··· 1578 1589 USB_REQ_SET_CONFIGURATION, 0, 1579 1590 config->desc.bConfigurationValue, 0, 1580 1591 NULL, 0, USB_CTRL_SET_TIMEOUT); 1581 - if (retval < 0) 1582 - goto reset_old_alts; 1592 + if (retval < 0) { 1593 + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1594 + usb_enable_lpm(dev); 1595 + mutex_unlock(hcd->bandwidth_mutex); 1596 + return retval; 1597 + } 1583 1598 mutex_unlock(hcd->bandwidth_mutex); 1584 1599 1585 1600 /* re-init hc/hcd interface/endpoint state */
+5
drivers/usb/core/sysfs.c
··· 889 889 size_t srclen, n; 890 890 int cfgno; 891 891 void *src; 892 + int retval; 892 893 894 + retval = usb_lock_device_interruptible(udev); 895 + if (retval < 0) 896 + return -EINTR; 893 897 /* The binary attribute begins with the device descriptor. 894 898 * Following that are the raw descriptor entries for all the 895 899 * configurations (config plus subsidiary descriptors). ··· 918 914 off -= srclen; 919 915 } 920 916 } 917 + usb_unlock_device(udev); 921 918 return count - nleft; 922 919 } 923 920
+6 -9
drivers/usb/dwc3/dwc3-meson-g12a.c
··· 737 737 goto err_disable_clks; 738 738 } 739 739 740 - ret = reset_control_deassert(priv->reset); 740 + ret = reset_control_reset(priv->reset); 741 741 if (ret) 742 - goto err_assert_reset; 742 + goto err_disable_clks; 743 743 744 744 ret = dwc3_meson_g12a_get_phys(priv); 745 745 if (ret) 746 - goto err_assert_reset; 746 + goto err_disable_clks; 747 747 748 748 ret = priv->drvdata->setup_regmaps(priv, base); 749 749 if (ret) ··· 752 752 if (priv->vbus) { 753 753 ret = regulator_enable(priv->vbus); 754 754 if (ret) 755 - goto err_assert_reset; 755 + goto err_disable_clks; 756 756 } 757 757 758 758 /* Get dr_mode */ ··· 765 765 766 766 ret = priv->drvdata->usb_init(priv); 767 767 if (ret) 768 - goto err_assert_reset; 768 + goto err_disable_clks; 769 769 770 770 /* Init PHYs */ 771 771 for (i = 0 ; i < PHY_COUNT ; ++i) { 772 772 ret = phy_init(priv->phys[i]); 773 773 if (ret) 774 - goto err_assert_reset; 774 + goto err_disable_clks; 775 775 } 776 776 777 777 /* Set PHY Power */ ··· 808 808 err_phys_exit: 809 809 for (i = 0 ; i < PHY_COUNT ; ++i) 810 810 phy_exit(priv->phys[i]); 811 - 812 - err_assert_reset: 813 - reset_control_assert(priv->reset); 814 811 815 812 err_disable_clks: 816 813 clk_bulk_disable_unprepare(priv->drvdata->num_clks,
+1
drivers/usb/serial/ftdi_sio.c
··· 713 713 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, 714 714 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, 715 715 { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, 716 + { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) }, 716 717 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, 717 718 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, 718 719 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
+1
drivers/usb/serial/ftdi_sio_ids.h
··· 160 160 #define XSENS_AWINDA_DONGLE_PID 0x0102 161 161 #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ 162 162 #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ 163 + #define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */ 163 164 #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ 164 165 165 166 /* Xsens devices using FTDI VID */
+14 -8
drivers/usb/serial/option.c
··· 1094 1094 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), 1095 1095 .driver_info = RSVD(1) | RSVD(3) }, 1096 1096 /* Quectel products using Quectel vendor ID */ 1097 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), 1098 - .driver_info = RSVD(4) }, 1099 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), 1100 - .driver_info = RSVD(4) }, 1101 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95), 1102 - .driver_info = RSVD(4) }, 1103 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), 1104 - .driver_info = RSVD(4) }, 1097 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), 1098 + .driver_info = NUMEP2 }, 1099 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) }, 1100 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), 1101 + .driver_info = NUMEP2 }, 1102 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, 1103 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), 1104 + .driver_info = NUMEP2 }, 1105 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, 1106 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff), 1107 + .driver_info = NUMEP2 }, 1108 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) }, 1105 1109 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), 1106 1110 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, 1107 1111 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, ··· 1823 1819 { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ 1824 1820 { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ 1825 1821 .driver_info = RSVD(7) }, 1822 + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */ 1823 + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */ 1826 1824 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), 1827 1825 .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, 1828 1826 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
+2 -12
drivers/usb/typec/mux/intel_pmc_mux.c
··· 61 61 62 62 #define PMC_USB_ALTMODE_ORI_SHIFT 1 63 63 #define PMC_USB_ALTMODE_UFP_SHIFT 3 64 - #define PMC_USB_ALTMODE_ORI_AUX_SHIFT 4 65 - #define PMC_USB_ALTMODE_ORI_HSL_SHIFT 5 66 64 67 65 /* DP specific Mode Data bits */ 68 66 #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8 69 67 70 68 /* TBT specific Mode Data bits */ 71 - #define PMC_USB_ALTMODE_HPD_HIGH BIT(14) 72 69 #define PMC_USB_ALTMODE_TBT_TYPE BIT(17) 73 70 #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18) 74 71 #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20) ··· 176 179 req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; 177 180 req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; 178 181 179 - req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; 180 - req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; 181 - 182 182 req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << 183 183 PMC_USB_ALTMODE_DP_MODE_SHIFT; 184 - 185 - if (data->status & DP_STATUS_HPD_STATE) 186 - req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH; 187 184 188 185 ret = pmc_usb_command(port, (void *)&req, sizeof(req)); 189 186 if (ret) ··· 202 211 203 212 req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; 204 213 req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; 205 - 206 - req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; 207 - req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; 208 214 209 215 if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3) 210 216 req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE; ··· 485 497 for (i = 0; i < pmc->num_ports; i++) { 486 498 typec_switch_unregister(pmc->port[i].typec_sw); 487 499 typec_mux_unregister(pmc->port[i].typec_mux); 500 + usb_role_switch_unregister(pmc->port[i].usb_sw); 488 501 } 489 502 490 503 return ret; ··· 499 510 for (i = 0; i < pmc->num_ports; i++) { 500 511 typec_switch_unregister(pmc->port[i].typec_sw); 501 512 typec_mux_unregister(pmc->port[i].typec_mux); 513 + usb_role_switch_unregister(pmc->port[i].usb_sw); 502 514 } 503 515 504 516 return 0;
+4
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 112 112 113 113 static int ucsi_acpi_probe(struct platform_device *pdev) 114 114 { 115 + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); 115 116 struct ucsi_acpi *ua; 116 117 struct resource *res; 117 118 acpi_status status; 118 119 int ret; 120 + 121 + if (adev->dep_unmet) 122 + return -EPROBE_DEFER; 119 123 120 124 ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); 121 125 if (!ua)