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.11-rc3' 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 5.11-rc3.

Include in here are:

- USB gadget driver fixes for reported issues

- new usb-serial driver ids

- dma from stack bugfixes

- typec bugfixes

- dwc3 bugfixes

- xhci driver bugfixes

- other small misc usb driver bugfixes

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

* tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (35 commits)
usb: dwc3: gadget: Clear wait flag on dequeue
usb: typec: Send uevent for num_altmodes update
usb: typec: Fix copy paste error for NVIDIA alt-mode description
usb: gadget: enable super speed plus
kcov, usb: hide in_serving_softirq checks in __usb_hcd_giveback_urb
usb: uas: Add PNY USB Portable SSD to unusual_uas
usb: gadget: configfs: Preserve function ordering after bind failure
usb: gadget: select CONFIG_CRC32
usb: gadget: core: change the comment for usb_gadget_connect
usb: gadget: configfs: Fix use-after-free issue with udc_name
usb: dwc3: gadget: Restart DWC3 gadget when enabling pullup
usb: usbip: vhci_hcd: protect shift size
USB: usblp: fix DMA to stack
USB: serial: iuu_phoenix: fix DMA from stack
USB: serial: option: add LongSung M5710 module support
USB: serial: option: add Quectel EM160R-GL
USB: Gadget: dummy-hcd: Fix shift-out-of-bounds bug
usb: gadget: f_uac2: reset wMaxPacketSize
usb: dwc3: ulpi: Fix USB2.0 HS/FS/LS PHY suspend regression
usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
...

+271 -229
+5 -1
Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml
··· 11 11 12 12 properties: 13 13 compatible: 14 - items: 14 + oneOf: 15 15 - const: ti,j721e-usb 16 + - const: ti,am64-usb 17 + - items: 18 + - const: ti,j721e-usb 19 + - const: ti,am64-usb 16 20 17 21 reg: 18 22 description: module registers
+1 -1
MAINTAINERS
··· 3883 3883 CADENCE USB3 DRD IP DRIVER 3884 3884 M: Peter Chen <peter.chen@nxp.com> 3885 3885 M: Pawel Laszczak <pawell@cadence.com> 3886 - M: Roger Quadros <rogerq@ti.com> 3886 + R: Roger Quadros <rogerq@kernel.org> 3887 3887 R: Aswath Govindraju <a-govindraju@ti.com> 3888 3888 L: linux-usb@vger.kernel.org 3889 3889 S: Maintained
+5 -1
drivers/usb/chipidea/ci_hdrc_imx.c
··· 139 139 misc_pdev = of_find_device_by_node(args.np); 140 140 of_node_put(args.np); 141 141 142 - if (!misc_pdev || !platform_get_drvdata(misc_pdev)) 142 + if (!misc_pdev) 143 143 return ERR_PTR(-EPROBE_DEFER); 144 144 145 + if (!platform_get_drvdata(misc_pdev)) { 146 + put_device(&misc_pdev->dev); 147 + return ERR_PTR(-EPROBE_DEFER); 148 + } 145 149 data->dev = &misc_pdev->dev; 146 150 147 151 /*
+4
drivers/usb/class/cdc-acm.c
··· 1895 1895 { USB_DEVICE(0x04d8, 0xfd08), 1896 1896 .driver_info = IGNORE_DEVICE, 1897 1897 }, 1898 + 1899 + { USB_DEVICE(0x04d8, 0xf58b), 1900 + .driver_info = IGNORE_DEVICE, 1901 + }, 1898 1902 #endif 1899 1903 1900 1904 /*Samsung phone in firmware update mode */
+13 -3
drivers/usb/class/cdc-wdm.c
··· 465 465 if (!desc->resp_count || !--desc->resp_count) 466 466 goto out; 467 467 468 + if (test_bit(WDM_DISCONNECTING, &desc->flags)) { 469 + rv = -ENODEV; 470 + goto out; 471 + } 472 + if (test_bit(WDM_RESETTING, &desc->flags)) { 473 + rv = -EIO; 474 + goto out; 475 + } 476 + 468 477 set_bit(WDM_RESPONDING, &desc->flags); 469 478 spin_unlock_irq(&desc->iuspin); 470 479 rv = usb_submit_urb(desc->response, GFP_KERNEL); 471 480 spin_lock_irq(&desc->iuspin); 472 481 if (rv) { 473 - dev_err(&desc->intf->dev, 474 - "usb_submit_urb failed with result %d\n", rv); 482 + if (!test_bit(WDM_DISCONNECTING, &desc->flags)) 483 + dev_err(&desc->intf->dev, 484 + "usb_submit_urb failed with result %d\n", rv); 475 485 476 486 /* make sure the next notification trigger a submit */ 477 487 clear_bit(WDM_RESPONDING, &desc->flags); ··· 1037 1027 wake_up_all(&desc->wait); 1038 1028 mutex_lock(&desc->rlock); 1039 1029 mutex_lock(&desc->wlock); 1040 - kill_urbs(desc); 1041 1030 cancel_work_sync(&desc->rxwork); 1042 1031 cancel_work_sync(&desc->service_outs_intr); 1032 + kill_urbs(desc); 1043 1033 mutex_unlock(&desc->wlock); 1044 1034 mutex_unlock(&desc->rlock); 1045 1035
+19 -2
drivers/usb/class/usblp.c
··· 274 274 #define usblp_reset(usblp)\ 275 275 usblp_ctrl_msg(usblp, USBLP_REQ_RESET, USB_TYPE_CLASS, USB_DIR_OUT, USB_RECIP_OTHER, 0, NULL, 0) 276 276 277 - #define usblp_hp_channel_change_request(usblp, channel, buffer) \ 278 - usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, channel, buffer, 1) 277 + static int usblp_hp_channel_change_request(struct usblp *usblp, int channel, u8 *new_channel) 278 + { 279 + u8 *buf; 280 + int ret; 281 + 282 + buf = kzalloc(1, GFP_KERNEL); 283 + if (!buf) 284 + return -ENOMEM; 285 + 286 + ret = usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, 287 + USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, 288 + channel, buf, 1); 289 + if (ret == 0) 290 + *new_channel = buf[0]; 291 + 292 + kfree(buf); 293 + 294 + return ret; 295 + } 279 296 280 297 /* 281 298 * See the description for usblp_select_alts() below for the usage
+3 -5
drivers/usb/core/hcd.c
··· 1649 1649 urb->status = status; 1650 1650 /* 1651 1651 * This function can be called in task context inside another remote 1652 - * coverage collection section, but KCOV doesn't support that kind of 1652 + * coverage collection section, but kcov doesn't support that kind of 1653 1653 * recursion yet. Only collect coverage in softirq context for now. 1654 1654 */ 1655 - if (in_serving_softirq()) 1656 - kcov_remote_start_usb((u64)urb->dev->bus->busnum); 1655 + kcov_remote_start_usb_softirq((u64)urb->dev->bus->busnum); 1657 1656 urb->complete(urb); 1658 - if (in_serving_softirq()) 1659 - kcov_remote_stop(); 1657 + kcov_remote_stop_softirq(); 1660 1658 1661 1659 usb_anchor_resume_wakeups(anchor); 1662 1660 atomic_dec(&urb->use_count);
+1
drivers/usb/dwc3/core.h
··· 285 285 286 286 /* Global USB2 PHY Vendor Control Register */ 287 287 #define DWC3_GUSB2PHYACC_NEWREGREQ BIT(25) 288 + #define DWC3_GUSB2PHYACC_DONE BIT(24) 288 289 #define DWC3_GUSB2PHYACC_BUSY BIT(23) 289 290 #define DWC3_GUSB2PHYACC_WRITE BIT(22) 290 291 #define DWC3_GUSB2PHYACC_ADDR(n) (n << 16)
+1 -1
drivers/usb/dwc3/dwc3-meson-g12a.c
··· 754 754 755 755 ret = priv->drvdata->setup_regmaps(priv, base); 756 756 if (ret) 757 - return ret; 757 + goto err_disable_clks; 758 758 759 759 if (priv->vbus) { 760 760 ret = regulator_enable(priv->vbus);
+5 -11
drivers/usb/dwc3/gadget.c
··· 1763 1763 list_for_each_entry_safe(r, t, &dep->started_list, list) 1764 1764 dwc3_gadget_move_cancelled_request(r); 1765 1765 1766 + dep->flags &= ~DWC3_EP_WAIT_TRANSFER_COMPLETE; 1767 + 1766 1768 goto out; 1767 1769 } 1768 1770 } ··· 2085 2083 2086 2084 static void dwc3_gadget_disable_irq(struct dwc3 *dwc); 2087 2085 static void __dwc3_gadget_stop(struct dwc3 *dwc); 2086 + static int __dwc3_gadget_start(struct dwc3 *dwc); 2088 2087 2089 2088 static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) 2090 2089 { ··· 2148 2145 dwc->ev_buf->lpos = (dwc->ev_buf->lpos + count) % 2149 2146 dwc->ev_buf->length; 2150 2147 } 2148 + } else { 2149 + __dwc3_gadget_start(dwc); 2151 2150 } 2152 2151 2153 2152 ret = dwc3_gadget_run_stop(dwc, is_on, false); ··· 2324 2319 } 2325 2320 2326 2321 dwc->gadget_driver = driver; 2327 - 2328 - if (pm_runtime_active(dwc->dev)) 2329 - __dwc3_gadget_start(dwc); 2330 - 2331 2322 spin_unlock_irqrestore(&dwc->lock, flags); 2332 2323 2333 2324 return 0; ··· 2349 2348 unsigned long flags; 2350 2349 2351 2350 spin_lock_irqsave(&dwc->lock, flags); 2352 - 2353 - if (pm_runtime_suspended(dwc->dev)) 2354 - goto out; 2355 - 2356 - __dwc3_gadget_stop(dwc); 2357 - 2358 - out: 2359 2351 dwc->gadget_driver = NULL; 2360 2352 spin_unlock_irqrestore(&dwc->lock, flags); 2361 2353
+21 -17
drivers/usb/dwc3/ulpi.c
··· 7 7 * Author: Heikki Krogerus <heikki.krogerus@linux.intel.com> 8 8 */ 9 9 10 + #include <linux/delay.h> 11 + #include <linux/time64.h> 10 12 #include <linux/ulpi/regs.h> 11 13 12 14 #include "core.h" ··· 19 17 DWC3_GUSB2PHYACC_ADDR(ULPI_ACCESS_EXTENDED) | \ 20 18 DWC3_GUSB2PHYACC_EXTEND_ADDR(a) : DWC3_GUSB2PHYACC_ADDR(a)) 21 19 22 - static int dwc3_ulpi_busyloop(struct dwc3 *dwc) 20 + #define DWC3_ULPI_BASE_DELAY DIV_ROUND_UP(NSEC_PER_SEC, 60000000L) 21 + 22 + static int dwc3_ulpi_busyloop(struct dwc3 *dwc, u8 addr, bool read) 23 23 { 24 - unsigned int count = 1000; 24 + unsigned long ns = 5L * DWC3_ULPI_BASE_DELAY; 25 + unsigned int count = 10000; 25 26 u32 reg; 26 27 28 + if (addr >= ULPI_EXT_VENDOR_SPECIFIC) 29 + ns += DWC3_ULPI_BASE_DELAY; 30 + 31 + if (read) 32 + ns += DWC3_ULPI_BASE_DELAY; 33 + 34 + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 35 + if (reg & DWC3_GUSB2PHYCFG_SUSPHY) 36 + usleep_range(1000, 1200); 37 + 27 38 while (count--) { 39 + ndelay(ns); 28 40 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0)); 29 - if (!(reg & DWC3_GUSB2PHYACC_BUSY)) 41 + if (reg & DWC3_GUSB2PHYACC_DONE) 30 42 return 0; 31 43 cpu_relax(); 32 44 } ··· 54 38 u32 reg; 55 39 int ret; 56 40 57 - reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 58 - if (reg & DWC3_GUSB2PHYCFG_SUSPHY) { 59 - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 60 - dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); 61 - } 62 - 63 41 reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr); 64 42 dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg); 65 43 66 - ret = dwc3_ulpi_busyloop(dwc); 44 + ret = dwc3_ulpi_busyloop(dwc, addr, true); 67 45 if (ret) 68 46 return ret; 69 47 ··· 71 61 struct dwc3 *dwc = dev_get_drvdata(dev); 72 62 u32 reg; 73 63 74 - reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 75 - if (reg & DWC3_GUSB2PHYCFG_SUSPHY) { 76 - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 77 - dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); 78 - } 79 - 80 64 reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr); 81 65 reg |= DWC3_GUSB2PHYACC_WRITE | val; 82 66 dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg); 83 67 84 - return dwc3_ulpi_busyloop(dwc); 68 + return dwc3_ulpi_busyloop(dwc, addr, false); 85 69 } 86 70 87 71 static const struct ulpi_ops dwc3_ulpi_ops = {
+2
drivers/usb/gadget/Kconfig
··· 265 265 depends on NET 266 266 select USB_U_ETHER 267 267 select USB_F_NCM 268 + select CRC32 268 269 help 269 270 NCM is an advanced protocol for Ethernet encapsulation, allows 270 271 grouping of several ethernet frames into one USB transfer and ··· 315 314 depends on NET 316 315 select USB_U_ETHER 317 316 select USB_F_EEM 317 + select CRC32 318 318 help 319 319 CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM 320 320 and therefore can be supported by more hardware. Technically ECM and
+8 -2
drivers/usb/gadget/composite.c
··· 392 392 393 393 spin_lock_irqsave(&cdev->lock, flags); 394 394 395 - if (cdev->deactivations == 0) 395 + if (cdev->deactivations == 0) { 396 + spin_unlock_irqrestore(&cdev->lock, flags); 396 397 status = usb_gadget_deactivate(cdev->gadget); 398 + spin_lock_irqsave(&cdev->lock, flags); 399 + } 397 400 if (status == 0) 398 401 cdev->deactivations++; 399 402 ··· 427 424 status = -EINVAL; 428 425 else { 429 426 cdev->deactivations--; 430 - if (cdev->deactivations == 0) 427 + if (cdev->deactivations == 0) { 428 + spin_unlock_irqrestore(&cdev->lock, flags); 431 429 status = usb_gadget_activate(cdev->gadget); 430 + spin_lock_irqsave(&cdev->lock, flags); 431 + } 432 432 } 433 433 434 434 spin_unlock_irqrestore(&cdev->lock, flags);
+13 -6
drivers/usb/gadget/configfs.c
··· 221 221 222 222 static ssize_t gadget_dev_desc_UDC_show(struct config_item *item, char *page) 223 223 { 224 - char *udc_name = to_gadget_info(item)->composite.gadget_driver.udc_name; 224 + struct gadget_info *gi = to_gadget_info(item); 225 + char *udc_name; 226 + int ret; 225 227 226 - return sprintf(page, "%s\n", udc_name ?: ""); 228 + mutex_lock(&gi->lock); 229 + udc_name = gi->composite.gadget_driver.udc_name; 230 + ret = sprintf(page, "%s\n", udc_name ?: ""); 231 + mutex_unlock(&gi->lock); 232 + 233 + return ret; 227 234 } 228 235 229 236 static int unregister_gadget(struct gadget_info *gi) ··· 1255 1248 1256 1249 cfg = container_of(c, struct config_usb_cfg, c); 1257 1250 1258 - list_for_each_entry_safe(f, tmp, &c->functions, list) { 1251 + list_for_each_entry_safe_reverse(f, tmp, &c->functions, list) { 1259 1252 1260 - list_move_tail(&f->list, &cfg->func_list); 1253 + list_move(&f->list, &cfg->func_list); 1261 1254 if (f->unbind) { 1262 1255 dev_dbg(&gi->cdev.gadget->dev, 1263 1256 "unbind function '%s'/%p\n", ··· 1543 1536 .suspend = configfs_composite_suspend, 1544 1537 .resume = configfs_composite_resume, 1545 1538 1546 - .max_speed = USB_SPEED_SUPER, 1539 + .max_speed = USB_SPEED_SUPER_PLUS, 1547 1540 .driver = { 1548 1541 .owner = THIS_MODULE, 1549 1542 .name = "configfs-gadget", ··· 1583 1576 gi->composite.unbind = configfs_do_nothing; 1584 1577 gi->composite.suspend = NULL; 1585 1578 gi->composite.resume = NULL; 1586 - gi->composite.max_speed = USB_SPEED_SUPER; 1579 + gi->composite.max_speed = USB_SPEED_SUPER_PLUS; 1587 1580 1588 1581 spin_lock_init(&gi->spinlock); 1589 1582 mutex_init(&gi->lock);
+1
drivers/usb/gadget/function/f_printer.c
··· 1162 1162 printer_req_free(dev->in_ep, req); 1163 1163 } 1164 1164 1165 + usb_free_all_descriptors(f); 1165 1166 return ret; 1166 1167 1167 1168 }
+55 -14
drivers/usb/gadget/function/f_uac2.c
··· 271 271 272 272 .bEndpointAddress = USB_DIR_OUT, 273 273 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 274 - .wMaxPacketSize = cpu_to_le16(1023), 274 + /* .wMaxPacketSize = DYNAMIC */ 275 275 .bInterval = 1, 276 276 }; 277 277 ··· 280 280 .bDescriptorType = USB_DT_ENDPOINT, 281 281 282 282 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 283 - .wMaxPacketSize = cpu_to_le16(1024), 283 + /* .wMaxPacketSize = DYNAMIC */ 284 284 .bInterval = 4, 285 285 }; 286 286 ··· 348 348 349 349 .bEndpointAddress = USB_DIR_IN, 350 350 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 351 - .wMaxPacketSize = cpu_to_le16(1023), 351 + /* .wMaxPacketSize = DYNAMIC */ 352 352 .bInterval = 1, 353 353 }; 354 354 ··· 357 357 .bDescriptorType = USB_DT_ENDPOINT, 358 358 359 359 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 360 - .wMaxPacketSize = cpu_to_le16(1024), 360 + /* .wMaxPacketSize = DYNAMIC */ 361 361 .bInterval = 4, 362 362 }; 363 363 ··· 444 444 __le32 dRES; 445 445 } __packed; 446 446 447 - static void set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, 447 + static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, 448 448 struct usb_endpoint_descriptor *ep_desc, 449 - unsigned int factor, bool is_playback) 449 + enum usb_device_speed speed, bool is_playback) 450 450 { 451 451 int chmask, srate, ssize; 452 - u16 max_packet_size; 452 + u16 max_size_bw, max_size_ep; 453 + unsigned int factor; 454 + 455 + switch (speed) { 456 + case USB_SPEED_FULL: 457 + max_size_ep = 1023; 458 + factor = 1000; 459 + break; 460 + 461 + case USB_SPEED_HIGH: 462 + max_size_ep = 1024; 463 + factor = 8000; 464 + break; 465 + 466 + default: 467 + return -EINVAL; 468 + } 453 469 454 470 if (is_playback) { 455 471 chmask = uac2_opts->p_chmask; ··· 477 461 ssize = uac2_opts->c_ssize; 478 462 } 479 463 480 - max_packet_size = num_channels(chmask) * ssize * 464 + max_size_bw = num_channels(chmask) * ssize * 481 465 DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))); 482 - ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_packet_size, 483 - le16_to_cpu(ep_desc->wMaxPacketSize))); 466 + ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw, 467 + max_size_ep)); 468 + 469 + return 0; 484 470 } 485 471 486 472 /* Use macro to overcome line length limitation */ ··· 688 670 } 689 671 690 672 /* Calculate wMaxPacketSize according to audio bandwidth */ 691 - set_ep_max_packet_size(uac2_opts, &fs_epin_desc, 1000, true); 692 - set_ep_max_packet_size(uac2_opts, &fs_epout_desc, 1000, false); 693 - set_ep_max_packet_size(uac2_opts, &hs_epin_desc, 8000, true); 694 - set_ep_max_packet_size(uac2_opts, &hs_epout_desc, 8000, false); 673 + ret = set_ep_max_packet_size(uac2_opts, &fs_epin_desc, USB_SPEED_FULL, 674 + true); 675 + if (ret < 0) { 676 + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); 677 + return ret; 678 + } 679 + 680 + ret = set_ep_max_packet_size(uac2_opts, &fs_epout_desc, USB_SPEED_FULL, 681 + false); 682 + if (ret < 0) { 683 + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); 684 + return ret; 685 + } 686 + 687 + ret = set_ep_max_packet_size(uac2_opts, &hs_epin_desc, USB_SPEED_HIGH, 688 + true); 689 + if (ret < 0) { 690 + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); 691 + return ret; 692 + } 693 + 694 + ret = set_ep_max_packet_size(uac2_opts, &hs_epout_desc, USB_SPEED_HIGH, 695 + false); 696 + if (ret < 0) { 697 + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); 698 + return ret; 699 + } 695 700 696 701 if (EPOUT_EN(uac2_opts)) { 697 702 agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc);
+5 -4
drivers/usb/gadget/function/u_ether.c
··· 45 45 #define UETH__VERSION "29-May-2008" 46 46 47 47 /* Experiments show that both Linux and Windows hosts allow up to 16k 48 - * frame sizes. Set the max size to 15k+52 to prevent allocating 32k 48 + * frame sizes. Set the max MTU size to 15k+52 to prevent allocating 32k 49 49 * blocks and still have efficient handling. */ 50 - #define GETHER_MAX_ETH_FRAME_LEN 15412 50 + #define GETHER_MAX_MTU_SIZE 15412 51 + #define GETHER_MAX_ETH_FRAME_LEN (GETHER_MAX_MTU_SIZE + ETH_HLEN) 51 52 52 53 struct eth_dev { 53 54 /* lock is held while accessing port_usb ··· 787 786 788 787 /* MTU range: 14 - 15412 */ 789 788 net->min_mtu = ETH_HLEN; 790 - net->max_mtu = GETHER_MAX_ETH_FRAME_LEN; 789 + net->max_mtu = GETHER_MAX_MTU_SIZE; 791 790 792 791 dev->gadget = g; 793 792 SET_NETDEV_DEV(net, &g->dev); ··· 849 848 850 849 /* MTU range: 14 - 15412 */ 851 850 net->min_mtu = ETH_HLEN; 852 - net->max_mtu = GETHER_MAX_ETH_FRAME_LEN; 851 + net->max_mtu = GETHER_MAX_MTU_SIZE; 853 852 854 853 return net; 855 854 }
+3 -1
drivers/usb/gadget/legacy/acm_ms.c
··· 200 200 struct usb_descriptor_header *usb_desc; 201 201 202 202 usb_desc = usb_otg_descriptor_alloc(gadget); 203 - if (!usb_desc) 203 + if (!usb_desc) { 204 + status = -ENOMEM; 204 205 goto fail_string_ids; 206 + } 205 207 usb_otg_descriptor_init(gadget, usb_desc); 206 208 otg_desc[0] = usb_desc; 207 209 otg_desc[1] = NULL;
+1 -1
drivers/usb/gadget/udc/Kconfig
··· 90 90 91 91 config USB_FSL_USB2 92 92 tristate "Freescale Highspeed USB DR Peripheral Controller" 93 - depends on FSL_SOC || ARCH_MXC 93 + depends on FSL_SOC 94 94 help 95 95 Some of Freescale PowerPC and i.MX processors have a High Speed 96 96 Dual-Role(DR) USB controller, which supports device mode.
-1
drivers/usb/gadget/udc/Makefile
··· 23 23 obj-$(CONFIG_USB_BCM63XX_UDC) += bcm63xx_udc.o 24 24 obj-$(CONFIG_USB_FSL_USB2) += fsl_usb2_udc.o 25 25 fsl_usb2_udc-y := fsl_udc_core.o 26 - fsl_usb2_udc-$(CONFIG_ARCH_MXC) += fsl_mxc_udc.o 27 26 obj-$(CONFIG_USB_TEGRA_XUDC) += tegra-xudc.o 28 27 obj-$(CONFIG_USB_M66592) += m66592-udc.o 29 28 obj-$(CONFIG_USB_R8A66597) += r8a66597-udc.o
+1 -2
drivers/usb/gadget/udc/core.c
··· 659 659 * 660 660 * Enables the D+ (or potentially D-) pullup. The host will start 661 661 * enumerating this gadget when the pullup is active and a VBUS session 662 - * is active (the link is powered). This pullup is always enabled unless 663 - * usb_gadget_disconnect() has been used to disable it. 662 + * is active (the link is powered). 664 663 * 665 664 * Returns zero on success, else negative errno. 666 665 */
+23 -12
drivers/usb/gadget/udc/dummy_hcd.c
··· 2118 2118 dum_hcd->port_status &= ~USB_PORT_STAT_POWER; 2119 2119 set_link_state(dum_hcd); 2120 2120 break; 2121 - default: 2121 + case USB_PORT_FEAT_ENABLE: 2122 + case USB_PORT_FEAT_C_ENABLE: 2123 + case USB_PORT_FEAT_C_SUSPEND: 2124 + /* Not allowed for USB-3 */ 2125 + if (hcd->speed == HCD_USB3) 2126 + goto error; 2127 + fallthrough; 2128 + case USB_PORT_FEAT_C_CONNECTION: 2129 + case USB_PORT_FEAT_C_RESET: 2122 2130 dum_hcd->port_status &= ~(1 << wValue); 2123 2131 set_link_state(dum_hcd); 2132 + break; 2133 + default: 2134 + /* Disallow INDICATOR and C_OVER_CURRENT */ 2135 + goto error; 2124 2136 } 2125 2137 break; 2126 2138 case GetHubDescriptor: ··· 2293 2281 */ 2294 2282 dum_hcd->re_timeout = jiffies + msecs_to_jiffies(50); 2295 2283 fallthrough; 2284 + case USB_PORT_FEAT_C_CONNECTION: 2285 + case USB_PORT_FEAT_C_RESET: 2286 + case USB_PORT_FEAT_C_ENABLE: 2287 + case USB_PORT_FEAT_C_SUSPEND: 2288 + /* Not allowed for USB-3, and ignored for USB-2 */ 2289 + if (hcd->speed == HCD_USB3) 2290 + goto error; 2291 + break; 2296 2292 default: 2297 - if (hcd->speed == HCD_USB3) { 2298 - if ((dum_hcd->port_status & 2299 - USB_SS_PORT_STAT_POWER) != 0) { 2300 - dum_hcd->port_status |= (1 << wValue); 2301 - } 2302 - } else 2303 - if ((dum_hcd->port_status & 2304 - USB_PORT_STAT_POWER) != 0) { 2305 - dum_hcd->port_status |= (1 << wValue); 2306 - } 2307 - set_link_state(dum_hcd); 2293 + /* Disallow TEST, INDICATOR, and C_OVER_CURRENT */ 2294 + goto error; 2308 2295 } 2309 2296 break; 2310 2297 case GetPortErrorCount:
-122
drivers/usb/gadget/udc/fsl_mxc_udc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * Copyright (C) 2009 4 - * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de> 5 - * 6 - * Description: 7 - * Helper routines for i.MX3x SoCs from Freescale, needed by the fsl_usb2_udc.c 8 - * driver to function correctly on these systems. 9 - */ 10 - #include <linux/clk.h> 11 - #include <linux/delay.h> 12 - #include <linux/err.h> 13 - #include <linux/fsl_devices.h> 14 - #include <linux/mod_devicetable.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/io.h> 17 - 18 - #include "fsl_usb2_udc.h" 19 - 20 - static struct clk *mxc_ahb_clk; 21 - static struct clk *mxc_per_clk; 22 - static struct clk *mxc_ipg_clk; 23 - 24 - /* workaround ENGcm09152 for i.MX35 */ 25 - #define MX35_USBPHYCTRL_OFFSET 0x600 26 - #define USBPHYCTRL_OTGBASE_OFFSET 0x8 27 - #define USBPHYCTRL_EVDO (1 << 23) 28 - 29 - int fsl_udc_clk_init(struct platform_device *pdev) 30 - { 31 - struct fsl_usb2_platform_data *pdata; 32 - unsigned long freq; 33 - int ret; 34 - 35 - pdata = dev_get_platdata(&pdev->dev); 36 - 37 - mxc_ipg_clk = devm_clk_get(&pdev->dev, "ipg"); 38 - if (IS_ERR(mxc_ipg_clk)) { 39 - dev_err(&pdev->dev, "clk_get(\"ipg\") failed\n"); 40 - return PTR_ERR(mxc_ipg_clk); 41 - } 42 - 43 - mxc_ahb_clk = devm_clk_get(&pdev->dev, "ahb"); 44 - if (IS_ERR(mxc_ahb_clk)) { 45 - dev_err(&pdev->dev, "clk_get(\"ahb\") failed\n"); 46 - return PTR_ERR(mxc_ahb_clk); 47 - } 48 - 49 - mxc_per_clk = devm_clk_get(&pdev->dev, "per"); 50 - if (IS_ERR(mxc_per_clk)) { 51 - dev_err(&pdev->dev, "clk_get(\"per\") failed\n"); 52 - return PTR_ERR(mxc_per_clk); 53 - } 54 - 55 - clk_prepare_enable(mxc_ipg_clk); 56 - clk_prepare_enable(mxc_ahb_clk); 57 - clk_prepare_enable(mxc_per_clk); 58 - 59 - /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ 60 - if (!strcmp(pdev->id_entry->name, "imx-udc-mx27")) { 61 - freq = clk_get_rate(mxc_per_clk); 62 - if (pdata->phy_mode != FSL_USB2_PHY_ULPI && 63 - (freq < 59999000 || freq > 60001000)) { 64 - dev_err(&pdev->dev, "USB_CLK=%lu, should be 60MHz\n", freq); 65 - ret = -EINVAL; 66 - goto eclkrate; 67 - } 68 - } 69 - 70 - return 0; 71 - 72 - eclkrate: 73 - clk_disable_unprepare(mxc_ipg_clk); 74 - clk_disable_unprepare(mxc_ahb_clk); 75 - clk_disable_unprepare(mxc_per_clk); 76 - mxc_per_clk = NULL; 77 - return ret; 78 - } 79 - 80 - int fsl_udc_clk_finalize(struct platform_device *pdev) 81 - { 82 - struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); 83 - int ret = 0; 84 - 85 - /* workaround ENGcm09152 for i.MX35 */ 86 - if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { 87 - unsigned int v; 88 - struct resource *res = platform_get_resource 89 - (pdev, IORESOURCE_MEM, 0); 90 - void __iomem *phy_regs = ioremap(res->start + 91 - MX35_USBPHYCTRL_OFFSET, 512); 92 - if (!phy_regs) { 93 - dev_err(&pdev->dev, "ioremap for phy address fails\n"); 94 - ret = -EINVAL; 95 - goto ioremap_err; 96 - } 97 - 98 - v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); 99 - writel(v | USBPHYCTRL_EVDO, 100 - phy_regs + USBPHYCTRL_OTGBASE_OFFSET); 101 - 102 - iounmap(phy_regs); 103 - } 104 - 105 - 106 - ioremap_err: 107 - /* ULPI transceivers don't need usbpll */ 108 - if (pdata->phy_mode == FSL_USB2_PHY_ULPI) { 109 - clk_disable_unprepare(mxc_per_clk); 110 - mxc_per_clk = NULL; 111 - } 112 - 113 - return ret; 114 - } 115 - 116 - void fsl_udc_clk_release(void) 117 - { 118 - if (mxc_per_clk) 119 - clk_disable_unprepare(mxc_per_clk); 120 - clk_disable_unprepare(mxc_ahb_clk); 121 - clk_disable_unprepare(mxc_ipg_clk); 122 - }
+16 -16
drivers/usb/host/xhci.c
··· 4770 4770 { 4771 4771 unsigned long long timeout_ns; 4772 4772 4773 - /* Prevent U1 if service interval is shorter than U1 exit latency */ 4774 - if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { 4775 - if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { 4776 - dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); 4777 - return USB3_LPM_DISABLED; 4778 - } 4779 - } 4780 - 4781 4773 if (xhci->quirks & XHCI_INTEL_HOST) 4782 4774 timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); 4783 4775 else 4784 4776 timeout_ns = udev->u1_params.sel; 4777 + 4778 + /* Prevent U1 if service interval is shorter than U1 exit latency */ 4779 + if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { 4780 + if (xhci_service_interval_to_ns(desc) <= timeout_ns) { 4781 + dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); 4782 + return USB3_LPM_DISABLED; 4783 + } 4784 + } 4785 4785 4786 4786 /* The U1 timeout is encoded in 1us intervals. 4787 4787 * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. ··· 4834 4834 { 4835 4835 unsigned long long timeout_ns; 4836 4836 4837 - /* Prevent U2 if service interval is shorter than U2 exit latency */ 4838 - if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { 4839 - if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { 4840 - dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); 4841 - return USB3_LPM_DISABLED; 4842 - } 4843 - } 4844 - 4845 4837 if (xhci->quirks & XHCI_INTEL_HOST) 4846 4838 timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); 4847 4839 else 4848 4840 timeout_ns = udev->u2_params.sel; 4841 + 4842 + /* Prevent U2 if service interval is shorter than U2 exit latency */ 4843 + if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { 4844 + if (xhci_service_interval_to_ns(desc) <= timeout_ns) { 4845 + dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); 4846 + return USB3_LPM_DISABLED; 4847 + } 4848 + } 4849 4849 4850 4850 /* The U2 timeout is encoded in 256us intervals */ 4851 4851 timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000);
+3
drivers/usb/misc/yurex.c
··· 496 496 timeout = schedule_timeout(YUREX_WRITE_TIMEOUT); 497 497 finish_wait(&dev->waitq, &wait); 498 498 499 + /* make sure URB is idle after timeout or (spurious) CMD_ACK */ 500 + usb_kill_urb(dev->cntl_urb); 501 + 499 502 mutex_unlock(&dev->io_mutex); 500 503 501 504 if (retval < 0) {
+15 -5
drivers/usb/serial/iuu_phoenix.c
··· 532 532 struct device *dev = &port->dev; 533 533 int i; 534 534 int status; 535 - u8 rxcmd = IUU_UART_RX; 535 + u8 *rxcmd; 536 536 struct iuu_private *priv = usb_get_serial_port_data(port); 537 537 538 538 if (iuu_led(port, 0xF000, 0, 0, 0xFF) < 0) 539 539 return -EIO; 540 540 541 + rxcmd = kmalloc(1, GFP_KERNEL); 542 + if (!rxcmd) 543 + return -ENOMEM; 544 + 545 + rxcmd[0] = IUU_UART_RX; 546 + 541 547 for (i = 0; i < 2; i++) { 542 - status = bulk_immediate(port, &rxcmd, 1); 548 + status = bulk_immediate(port, rxcmd, 1); 543 549 if (status != IUU_OPERATION_OK) { 544 550 dev_dbg(dev, "%s - uart_flush_write error\n", __func__); 545 - return status; 551 + goto out_free; 546 552 } 547 553 548 554 status = read_immediate(port, &priv->len, 1); 549 555 if (status != IUU_OPERATION_OK) { 550 556 dev_dbg(dev, "%s - uart_flush_read error\n", __func__); 551 - return status; 557 + goto out_free; 552 558 } 553 559 554 560 if (priv->len > 0) { ··· 562 556 status = read_immediate(port, priv->buf, priv->len); 563 557 if (status != IUU_OPERATION_OK) { 564 558 dev_dbg(dev, "%s - uart_flush_read error\n", __func__); 565 - return status; 559 + goto out_free; 566 560 } 567 561 } 568 562 } 569 563 dev_dbg(dev, "%s - uart_flush_read OK!\n", __func__); 570 564 iuu_led(port, 0, 0xF000, 0, 0xFF); 565 + 566 + out_free: 567 + kfree(rxcmd); 568 + 571 569 return status; 572 570 } 573 571
+3
drivers/usb/serial/option.c
··· 1117 1117 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), 1118 1118 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, 1119 1119 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, 1120 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0xff, 0x30) }, /* EM160R-GL */ 1121 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0, 0) }, 1120 1122 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x30) }, 1121 1123 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, 1122 1124 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), ··· 2059 2057 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ 2060 2058 .driver_info = RSVD(6) }, 2061 2059 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */ 2060 + { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ 2062 2061 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ 2063 2062 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ 2064 2063 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */
+7
drivers/usb/storage/unusual_uas.h
··· 91 91 US_FL_BROKEN_FUA), 92 92 93 93 /* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */ 94 + UNUSUAL_DEV(0x154b, 0xf00b, 0x0000, 0x9999, 95 + "PNY", 96 + "Pro Elite SSD", 97 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 98 + US_FL_NO_ATA_1X), 99 + 100 + /* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */ 94 101 UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999, 95 102 "PNY", 96 103 "Pro Elite SSD",
+1 -1
drivers/usb/typec/altmodes/Kconfig
··· 20 20 to enable support for VirtualLink devices with NVIDIA GPUs. 21 21 22 22 To compile this driver as a module, choose M here: the 23 - module will be called typec_displayport. 23 + module will be called typec_nvidia. 24 24 25 25 endmenu
+2
drivers/usb/typec/class.c
··· 766 766 return ret; 767 767 768 768 sysfs_notify(&partner->dev.kobj, NULL, "number_of_alternate_modes"); 769 + kobject_uevent(&partner->dev.kobj, KOBJ_CHANGE); 769 770 770 771 return 0; 771 772 } ··· 924 923 return ret; 925 924 926 925 sysfs_notify(&plug->dev.kobj, NULL, "number_of_alternate_modes"); 926 + kobject_uevent(&plug->dev.kobj, KOBJ_CHANGE); 927 927 928 928 return 0; 929 929 }
+11
drivers/usb/typec/mux/intel_pmc_mux.c
··· 207 207 pmc_usb_mux_dp_hpd(struct pmc_usb_port *port, struct typec_displayport_data *dp) 208 208 { 209 209 u8 msg[2] = { }; 210 + int ret; 210 211 211 212 msg[0] = PMC_USB_DP_HPD; 212 213 msg[0] |= port->usb3_port << PMC_USB_MSG_USB3_PORT_SHIFT; 214 + 215 + /* Configure HPD first if HPD,IRQ comes together */ 216 + if (!IOM_PORT_HPD_ASSERTED(port->iom_status) && 217 + dp->status & DP_STATUS_IRQ_HPD && 218 + dp->status & DP_STATUS_HPD_STATE) { 219 + msg[1] = PMC_USB_DP_HPD_LVL; 220 + ret = pmc_usb_command(port, msg, sizeof(msg)); 221 + if (ret) 222 + return ret; 223 + } 213 224 214 225 if (dp->status & DP_STATUS_IRQ_HPD) 215 226 msg[1] = PMC_USB_DP_HPD_IRQ;
+2
drivers/usb/usbip/vhci_hcd.c
··· 396 396 default: 397 397 usbip_dbg_vhci_rh(" ClearPortFeature: default %x\n", 398 398 wValue); 399 + if (wValue >= 32) 400 + goto error; 399 401 vhci_hcd->port_status[rhport] &= ~(1 << wValue); 400 402 break; 401 403 }
+21
include/linux/kcov.h
··· 52 52 kcov_remote_start(kcov_remote_handle(KCOV_SUBSYSTEM_USB, id)); 53 53 } 54 54 55 + /* 56 + * The softirq flavor of kcov_remote_*() functions is introduced as a temporary 57 + * work around for kcov's lack of nested remote coverage sections support in 58 + * task context. Adding suport for nested sections is tracked in: 59 + * https://bugzilla.kernel.org/show_bug.cgi?id=210337 60 + */ 61 + 62 + static inline void kcov_remote_start_usb_softirq(u64 id) 63 + { 64 + if (in_serving_softirq()) 65 + kcov_remote_start_usb(id); 66 + } 67 + 68 + static inline void kcov_remote_stop_softirq(void) 69 + { 70 + if (in_serving_softirq()) 71 + kcov_remote_stop(); 72 + } 73 + 55 74 #else 56 75 57 76 static inline void kcov_task_init(struct task_struct *t) {} ··· 85 66 } 86 67 static inline void kcov_remote_start_common(u64 id) {} 87 68 static inline void kcov_remote_start_usb(u64 id) {} 69 + static inline void kcov_remote_start_usb_softirq(u64 id) {} 70 + static inline void kcov_remote_stop_softirq(void) {} 88 71 89 72 #endif /* CONFIG_KCOV */ 90 73 #endif /* _LINUX_KCOV_H */