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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull USB fixes from Greg KH:
"Here are a number of small USB driver fixes for reported problems.
They include:

- dwc2 driver fixes

- xhci driver fixes

- cdnsp driver fixes

- typec driver fix

- gadget u_ether driver fix

- new quirk additions

- usb gadget endpoint calculation fix

- usb serial new device ids

- revert of a xhci-dbg change that broke early debug booting

All changes, except for the revert, have been in linux-next with no
reported problems. The revert was from yesterday, and it was reported
by the developers affected that it resolved their problem"

* tag 'usb-5.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
Revert "usb: early: convert to readl_poll_timeout_atomic()"
usb: typec: tcpm: fix tcpm unregister port but leave a pending timer
usb: cdnsp: Fix lack of spin_lock_irqsave/spin_lock_restore
USB: NO_LPM quirk Lenovo USB-C to Ethernet Adapher(RTL8153-04)
usb: xhci: Extend support for runtime power management for AMD's Yellow carp.
usb: dwc2: fix STM ID/VBUS detection startup delay in dwc2_driver_probe
USB: gadget: bRequestType is a bitfield, not a enum
USB: serial: option: add Telit FN990 compositions
USB: serial: cp210x: fix CP2105 GPIO registration
usb: cdnsp: Fix incorrect status for control request
usb: cdnsp: Fix issue in cdnsp_log_ep trace event
usb: cdnsp: Fix incorrect calling of cdnsp_died function
usb: xhci-mtk: fix list_del warning when enable list debug
usb: gadget: u_ether: fix race in setting MAC address in setup phase

+87 -35
+12
drivers/usb/cdns3/cdnsp-gadget.c
··· 1541 1541 { 1542 1542 struct cdnsp_device *pdev = gadget_to_cdnsp(gadget); 1543 1543 struct cdns *cdns = dev_get_drvdata(pdev->dev); 1544 + unsigned long flags; 1544 1545 1545 1546 trace_cdnsp_pullup(is_on); 1547 + 1548 + /* 1549 + * Disable events handling while controller is being 1550 + * enabled/disabled. 1551 + */ 1552 + disable_irq(cdns->dev_irq); 1553 + spin_lock_irqsave(&pdev->lock, flags); 1546 1554 1547 1555 if (!is_on) { 1548 1556 cdnsp_reset_device(pdev); ··· 1558 1550 } else { 1559 1551 cdns_set_vbus(cdns); 1560 1552 } 1553 + 1554 + spin_unlock_irqrestore(&pdev->lock, flags); 1555 + enable_irq(cdns->dev_irq); 1556 + 1561 1557 return 0; 1562 1558 } 1563 1559
+10 -1
drivers/usb/cdns3/cdnsp-ring.c
··· 1029 1029 return; 1030 1030 } 1031 1031 1032 + *status = 0; 1033 + 1032 1034 cdnsp_finish_td(pdev, td, event, pep, status); 1033 1035 } 1034 1036 ··· 1525 1523 spin_lock_irqsave(&pdev->lock, flags); 1526 1524 1527 1525 if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) { 1528 - cdnsp_died(pdev); 1526 + /* 1527 + * While removing or stopping driver there may still be deferred 1528 + * not handled interrupt which should not be treated as error. 1529 + * Driver should simply ignore it. 1530 + */ 1531 + if (pdev->gadget_driver) 1532 + cdnsp_died(pdev); 1533 + 1529 1534 spin_unlock_irqrestore(&pdev->lock, flags); 1530 1535 return IRQ_HANDLED; 1531 1536 }
+2 -2
drivers/usb/cdns3/cdnsp-trace.h
··· 57 57 __entry->first_prime_det = pep->stream_info.first_prime_det; 58 58 __entry->drbls_count = pep->stream_info.drbls_count; 59 59 ), 60 - TP_printk("%s: SID: %08x ep state: %x stream: enabled: %d num %d " 60 + TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d " 61 61 "tds %d, first prime: %d drbls %d", 62 - __get_str(name), __entry->state, __entry->stream_id, 62 + __get_str(name), __entry->stream_id, __entry->state, 63 63 __entry->enabled, __entry->num_streams, __entry->td_count, 64 64 __entry->first_prime_det, __entry->drbls_count) 65 65 );
+3
drivers/usb/core/quirks.c
··· 434 434 { USB_DEVICE(0x1532, 0x0116), .driver_info = 435 435 USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, 436 436 437 + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ 438 + { USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, 439 + 437 440 /* Lenovo Powered USB-C Travel Hub (4X90S92381, RTL8153 GigE) */ 438 441 { USB_DEVICE(0x17ef, 0x721e), .driver_info = USB_QUIRK_NO_LPM }, 439 442
+3
drivers/usb/dwc2/platform.c
··· 575 575 ggpio |= GGPIO_STM32_OTG_GCCFG_IDEN; 576 576 ggpio |= GGPIO_STM32_OTG_GCCFG_VBDEN; 577 577 dwc2_writel(hsotg, ggpio, GGPIO); 578 + 579 + /* ID/VBUS detection startup time */ 580 + usleep_range(5000, 7000); 578 581 } 579 582 580 583 retval = dwc2_drd_init(hsotg);
+11 -4
drivers/usb/early/xhci-dbc.c
··· 14 14 #include <linux/pci_ids.h> 15 15 #include <linux/memblock.h> 16 16 #include <linux/io.h> 17 - #include <linux/iopoll.h> 18 17 #include <asm/pci-direct.h> 19 18 #include <asm/fixmap.h> 20 19 #include <linux/bcd.h> ··· 135 136 { 136 137 u32 result; 137 138 138 - return readl_poll_timeout_atomic(ptr, result, 139 - ((result & mask) == done), 140 - delay, wait); 139 + /* Can not use readl_poll_timeout_atomic() for early boot things */ 140 + do { 141 + result = readl(ptr); 142 + result &= mask; 143 + if (result == done) 144 + return 0; 145 + udelay(delay); 146 + wait -= delay; 147 + } while (wait > 0); 148 + 149 + return -ETIMEDOUT; 141 150 } 142 151 143 152 static void __init xdbc_bios_handoff(void)
+3 -3
drivers/usb/gadget/composite.c
··· 1680 1680 u8 endp; 1681 1681 1682 1682 if (w_length > USB_COMP_EP0_BUFSIZ) { 1683 - if (ctrl->bRequestType == USB_DIR_OUT) { 1684 - goto done; 1685 - } else { 1683 + if (ctrl->bRequestType & USB_DIR_IN) { 1686 1684 /* Cast away the const, we are going to overwrite on purpose. */ 1687 1685 __le16 *temp = (__le16 *)&ctrl->wLength; 1688 1686 1689 1687 *temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ); 1690 1688 w_length = USB_COMP_EP0_BUFSIZ; 1689 + } else { 1690 + goto done; 1691 1691 } 1692 1692 } 1693 1693
+6 -10
drivers/usb/gadget/function/u_ether.c
··· 17 17 #include <linux/etherdevice.h> 18 18 #include <linux/ethtool.h> 19 19 #include <linux/if_vlan.h> 20 + #include <linux/etherdevice.h> 20 21 21 22 #include "u_ether.h" 22 23 ··· 864 863 { 865 864 struct eth_dev *dev; 866 865 struct usb_gadget *g; 867 - struct sockaddr sa; 868 866 int status; 869 867 870 868 if (!net->dev.parent) 871 869 return -EINVAL; 872 870 dev = netdev_priv(net); 873 871 g = dev->gadget; 872 + 873 + net->addr_assign_type = NET_ADDR_RANDOM; 874 + eth_hw_addr_set(net, dev->dev_mac); 875 + 874 876 status = register_netdev(net); 875 877 if (status < 0) { 876 878 dev_dbg(&g->dev, "register_netdev failed, %d\n", status); 877 879 return status; 878 880 } else { 879 881 INFO(dev, "HOST MAC %pM\n", dev->host_mac); 882 + INFO(dev, "MAC %pM\n", dev->dev_mac); 880 883 881 884 /* two kinds of host-initiated state changes: 882 885 * - iff DATA transfer is active, carrier is "on" ··· 888 883 */ 889 884 netif_carrier_off(net); 890 885 } 891 - sa.sa_family = net->type; 892 - memcpy(sa.sa_data, dev->dev_mac, ETH_ALEN); 893 - rtnl_lock(); 894 - status = dev_set_mac_address(net, &sa, NULL); 895 - rtnl_unlock(); 896 - if (status) 897 - pr_warn("cannot set self ethernet address: %d\n", status); 898 - else 899 - INFO(dev, "MAC %pM\n", dev->dev_mac); 900 886 901 887 return status; 902 888 }
+3 -3
drivers/usb/gadget/legacy/dbgp.c
··· 346 346 u16 len = 0; 347 347 348 348 if (length > DBGP_REQ_LEN) { 349 - if (ctrl->bRequestType == USB_DIR_OUT) { 350 - return err; 351 - } else { 349 + if (ctrl->bRequestType & USB_DIR_IN) { 352 350 /* Cast away the const, we are going to overwrite on purpose. */ 353 351 __le16 *temp = (__le16 *)&ctrl->wLength; 354 352 355 353 *temp = cpu_to_le16(DBGP_REQ_LEN); 356 354 length = DBGP_REQ_LEN; 355 + } else { 356 + return err; 357 357 } 358 358 } 359 359
+3 -3
drivers/usb/gadget/legacy/inode.c
··· 1334 1334 u16 w_length = le16_to_cpu(ctrl->wLength); 1335 1335 1336 1336 if (w_length > RBUF_SIZE) { 1337 - if (ctrl->bRequestType == USB_DIR_OUT) { 1338 - return value; 1339 - } else { 1337 + if (ctrl->bRequestType & USB_DIR_IN) { 1340 1338 /* Cast away the const, we are going to overwrite on purpose. */ 1341 1339 __le16 *temp = (__le16 *)&ctrl->wLength; 1342 1340 1343 1341 *temp = cpu_to_le16(RBUF_SIZE); 1344 1342 w_length = RBUF_SIZE; 1343 + } else { 1344 + return value; 1345 1345 } 1346 1346 } 1347 1347
+1 -1
drivers/usb/host/xhci-mtk-sch.c
··· 781 781 782 782 ret = xhci_check_bandwidth(hcd, udev); 783 783 if (!ret) 784 - INIT_LIST_HEAD(&mtk->bw_ep_chk_list); 784 + list_del_init(&mtk->bw_ep_chk_list); 785 785 786 786 return ret; 787 787 }
+5 -1
drivers/usb/host/xhci-pci.c
··· 71 71 #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e 72 72 #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 73 73 #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 74 + #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 0x161c 75 + #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8 0x161f 74 76 75 77 #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042 76 78 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 ··· 332 330 pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || 333 331 pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || 334 332 pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || 335 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6)) 333 + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 || 334 + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 || 335 + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8)) 336 336 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; 337 337 338 338 if (xhci->quirks & XHCI_RESET_ON_RESUME)
+4 -2
drivers/usb/serial/cp210x.c
··· 1635 1635 1636 1636 /* 2 banks of GPIO - One for the pins taken from each serial port */ 1637 1637 if (intf_num == 0) { 1638 + priv->gc.ngpio = 2; 1639 + 1638 1640 if (mode.eci == CP210X_PIN_MODE_MODEM) { 1639 1641 /* mark all GPIOs of this interface as reserved */ 1640 1642 priv->gpio_altfunc = 0xff; ··· 1647 1645 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & 1648 1646 CP210X_ECI_GPIO_MODE_MASK) >> 1649 1647 CP210X_ECI_GPIO_MODE_OFFSET); 1650 - priv->gc.ngpio = 2; 1651 1648 } else if (intf_num == 1) { 1649 + priv->gc.ngpio = 3; 1650 + 1652 1651 if (mode.sci == CP210X_PIN_MODE_MODEM) { 1653 1652 /* mark all GPIOs of this interface as reserved */ 1654 1653 priv->gpio_altfunc = 0xff; ··· 1660 1657 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & 1661 1658 CP210X_SCI_GPIO_MODE_MASK) >> 1662 1659 CP210X_SCI_GPIO_MODE_OFFSET); 1663 - priv->gc.ngpio = 3; 1664 1660 } else { 1665 1661 return -ENODEV; 1666 1662 }
+8
drivers/usb/serial/option.c
··· 1219 1219 .driver_info = NCTRL(2) | RSVD(3) }, 1220 1220 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ 1221 1221 .driver_info = NCTRL(0) | RSVD(1) }, 1222 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990 (rmnet) */ 1223 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, 1224 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990 (MBIM) */ 1225 + .driver_info = NCTRL(0) | RSVD(1) }, 1226 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990 (RNDIS) */ 1227 + .driver_info = NCTRL(2) | RSVD(3) }, 1228 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ 1229 + .driver_info = NCTRL(0) | RSVD(1) }, 1222 1230 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), 1223 1231 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, 1224 1232 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
+13 -5
drivers/usb/typec/tcpm/tcpm.c
··· 324 324 325 325 bool attached; 326 326 bool connected; 327 + bool registered; 327 328 bool pd_supported; 328 329 enum typec_port_type port_type; 329 330 ··· 6292 6291 { 6293 6292 struct tcpm_port *port = container_of(timer, struct tcpm_port, state_machine_timer); 6294 6293 6295 - kthread_queue_work(port->wq, &port->state_machine); 6294 + if (port->registered) 6295 + kthread_queue_work(port->wq, &port->state_machine); 6296 6296 return HRTIMER_NORESTART; 6297 6297 } 6298 6298 ··· 6301 6299 { 6302 6300 struct tcpm_port *port = container_of(timer, struct tcpm_port, vdm_state_machine_timer); 6303 6301 6304 - kthread_queue_work(port->wq, &port->vdm_state_machine); 6302 + if (port->registered) 6303 + kthread_queue_work(port->wq, &port->vdm_state_machine); 6305 6304 return HRTIMER_NORESTART; 6306 6305 } 6307 6306 ··· 6310 6307 { 6311 6308 struct tcpm_port *port = container_of(timer, struct tcpm_port, enable_frs_timer); 6312 6309 6313 - kthread_queue_work(port->wq, &port->enable_frs); 6310 + if (port->registered) 6311 + kthread_queue_work(port->wq, &port->enable_frs); 6314 6312 return HRTIMER_NORESTART; 6315 6313 } 6316 6314 ··· 6319 6315 { 6320 6316 struct tcpm_port *port = container_of(timer, struct tcpm_port, send_discover_timer); 6321 6317 6322 - kthread_queue_work(port->wq, &port->send_discover_work); 6318 + if (port->registered) 6319 + kthread_queue_work(port->wq, &port->send_discover_work); 6323 6320 return HRTIMER_NORESTART; 6324 6321 } 6325 6322 ··· 6408 6403 typec_port_register_altmodes(port->typec_port, 6409 6404 &tcpm_altmode_ops, port, 6410 6405 port->port_altmode, ALTMODE_DISCOVERY_MAX); 6406 + port->registered = true; 6411 6407 6412 6408 mutex_lock(&port->lock); 6413 6409 tcpm_init(port); ··· 6430 6424 { 6431 6425 int i; 6432 6426 6427 + port->registered = false; 6428 + kthread_destroy_worker(port->wq); 6429 + 6433 6430 hrtimer_cancel(&port->send_discover_timer); 6434 6431 hrtimer_cancel(&port->enable_frs_timer); 6435 6432 hrtimer_cancel(&port->vdm_state_machine_timer); ··· 6444 6435 typec_unregister_port(port->typec_port); 6445 6436 usb_role_switch_put(port->role_sw); 6446 6437 tcpm_debugfs_exit(port); 6447 - kthread_destroy_worker(port->wq); 6448 6438 } 6449 6439 EXPORT_SYMBOL_GPL(tcpm_unregister_port); 6450 6440