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

Configure Feed

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

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

Pull USB/Thunderbolt fixes from Greg KH:
"Here are a number of small USB driver fixes for 5.6-rc3.

Included in here are:
- MAINTAINER file updates
- USB gadget driver fixes
- usb core quirk additions and fixes for regressions
- xhci driver fixes
- usb serial driver id additions and fixes
- thunderbolt bugfix

Thunderbolt patches come in through here now that USB4 is really
thunderbolt.

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

* tag 'usb-5.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (34 commits)
USB: misc: iowarrior: add support for the 100 device
thunderbolt: Prevent crash if non-active NVMem file is read
usb: gadget: udc-xilinx: Fix xudc_stop() kernel-doc format
USB: misc: iowarrior: add support for the 28 and 28L devices
USB: misc: iowarrior: add support for 2 OEMed devices
USB: Fix novation SourceControl XL after suspend
xhci: Fix memory leak when caching protocol extended capability PSI tables - take 2
Revert "xhci: Fix memory leak when caching protocol extended capability PSI tables"
MAINTAINERS: Sort entries in database for THUNDERBOLT
usb: dwc3: debug: fix string position formatting mixup with ret and len
usb: gadget: serial: fix Tx stall after buffer overflow
usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags
usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
usb: dwc2: Fix in ISOC request length checking
usb: gadget: composite: Support more than 500mA MaxPower
usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus
usb: gadget: u_audio: Fix high-speed max packet size
usb: dwc3: gadget: Check for IOC/LST bit in TRB->ctrl fields
USB: core: clean up endpoint-descriptor parsing
USB: quirks: blacklist duplicate ep on Sound Devices USBPre2
...

+327 -140
+10 -10
MAINTAINERS
··· 16552 16552 M: Mika Westerberg <mika.westerberg@linux.intel.com> 16553 16553 M: Yehezkel Bernat <YehezkelShB@gmail.com> 16554 16554 L: linux-usb@vger.kernel.org 16555 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git 16556 16555 S: Maintained 16556 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git 16557 16557 F: Documentation/admin-guide/thunderbolt.rst 16558 16558 F: drivers/thunderbolt/ 16559 16559 F: include/linux/thunderbolt.h ··· 17392 17392 F: include/linux/usb.h 17393 17393 F: include/linux/usb/ 17394 17394 17395 - USB TYPEC PI3USB30532 MUX DRIVER 17396 - M: Hans de Goede <hdegoede@redhat.com> 17395 + USB TYPEC BUS FOR ALTERNATE MODES 17396 + M: Heikki Krogerus <heikki.krogerus@linux.intel.com> 17397 17397 L: linux-usb@vger.kernel.org 17398 17398 S: Maintained 17399 - F: drivers/usb/typec/mux/pi3usb30532.c 17399 + F: Documentation/ABI/testing/sysfs-bus-typec 17400 + F: Documentation/driver-api/usb/typec_bus.rst 17401 + F: drivers/usb/typec/altmodes/ 17402 + F: include/linux/usb/typec_altmode.h 17400 17403 17401 17404 USB TYPEC CLASS 17402 17405 M: Heikki Krogerus <heikki.krogerus@linux.intel.com> ··· 17410 17407 F: drivers/usb/typec/ 17411 17408 F: include/linux/usb/typec.h 17412 17409 17413 - USB TYPEC BUS FOR ALTERNATE MODES 17414 - M: Heikki Krogerus <heikki.krogerus@linux.intel.com> 17410 + USB TYPEC PI3USB30532 MUX DRIVER 17411 + M: Hans de Goede <hdegoede@redhat.com> 17415 17412 L: linux-usb@vger.kernel.org 17416 17413 S: Maintained 17417 - F: Documentation/ABI/testing/sysfs-bus-typec 17418 - F: Documentation/driver-api/usb/typec_bus.rst 17419 - F: drivers/usb/typec/altmodes/ 17420 - F: include/linux/usb/typec_altmode.h 17414 + F: drivers/usb/typec/mux/pi3usb30532.c 17421 17415 17422 17416 USB TYPEC PORT CONTROLLER DRIVERS 17423 17417 M: Guenter Roeck <linux@roeck-us.net>
+7
drivers/thunderbolt/switch.c
··· 348 348 return ret; 349 349 } 350 350 351 + static int tb_switch_nvm_no_read(void *priv, unsigned int offset, void *val, 352 + size_t bytes) 353 + { 354 + return -EPERM; 355 + } 356 + 351 357 static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val, 352 358 size_t bytes) 353 359 { ··· 399 393 config.read_only = true; 400 394 } else { 401 395 config.name = "nvm_non_active"; 396 + config.reg_read = tb_switch_nvm_no_read; 402 397 config.reg_write = tb_switch_nvm_write; 403 398 config.root_only = true; 404 399 }
+19 -12
drivers/usb/core/config.c
··· 256 256 struct usb_host_interface *ifp, int num_ep, 257 257 unsigned char *buffer, int size) 258 258 { 259 + struct usb_device *udev = to_usb_device(ddev); 259 260 unsigned char *buffer0 = buffer; 260 261 struct usb_endpoint_descriptor *d; 261 262 struct usb_host_endpoint *endpoint; ··· 298 297 goto skip_to_next_endpoint_or_interface_descriptor; 299 298 } 300 299 300 + /* Ignore blacklisted endpoints */ 301 + if (udev->quirks & USB_QUIRK_ENDPOINT_BLACKLIST) { 302 + if (usb_endpoint_is_blacklisted(udev, ifp, d)) { 303 + dev_warn(ddev, "config %d interface %d altsetting %d has a blacklisted endpoint with address 0x%X, skipping\n", 304 + cfgno, inum, asnum, 305 + d->bEndpointAddress); 306 + goto skip_to_next_endpoint_or_interface_descriptor; 307 + } 308 + } 309 + 301 310 endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; 302 311 ++ifp->desc.bNumEndpoints; 303 312 ··· 322 311 j = 255; 323 312 if (usb_endpoint_xfer_int(d)) { 324 313 i = 1; 325 - switch (to_usb_device(ddev)->speed) { 314 + switch (udev->speed) { 326 315 case USB_SPEED_SUPER_PLUS: 327 316 case USB_SPEED_SUPER: 328 317 case USB_SPEED_HIGH: ··· 343 332 /* 344 333 * This quirk fixes bIntervals reported in ms. 345 334 */ 346 - if (to_usb_device(ddev)->quirks & 347 - USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) { 335 + if (udev->quirks & USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) { 348 336 n = clamp(fls(d->bInterval) + 3, i, j); 349 337 i = j = n; 350 338 } ··· 351 341 * This quirk fixes bIntervals reported in 352 342 * linear microframes. 353 343 */ 354 - if (to_usb_device(ddev)->quirks & 355 - USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL) { 344 + if (udev->quirks & USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL) { 356 345 n = clamp(fls(d->bInterval), i, j); 357 346 i = j = n; 358 347 } ··· 368 359 } else if (usb_endpoint_xfer_isoc(d)) { 369 360 i = 1; 370 361 j = 16; 371 - switch (to_usb_device(ddev)->speed) { 362 + switch (udev->speed) { 372 363 case USB_SPEED_HIGH: 373 364 n = 7; /* 8 ms = 2^(7-1) uframes */ 374 365 break; ··· 390 381 * explicitly forbidden by the USB spec. In an attempt to make 391 382 * them usable, we will try treating them as Interrupt endpoints. 392 383 */ 393 - if (to_usb_device(ddev)->speed == USB_SPEED_LOW && 394 - usb_endpoint_xfer_bulk(d)) { 384 + if (udev->speed == USB_SPEED_LOW && usb_endpoint_xfer_bulk(d)) { 395 385 dev_warn(ddev, "config %d interface %d altsetting %d " 396 386 "endpoint 0x%X is Bulk; changing to Interrupt\n", 397 387 cfgno, inum, asnum, d->bEndpointAddress); ··· 414 406 415 407 /* Find the highest legal maxpacket size for this endpoint */ 416 408 i = 0; /* additional transactions per microframe */ 417 - switch (to_usb_device(ddev)->speed) { 409 + switch (udev->speed) { 418 410 case USB_SPEED_LOW: 419 411 maxpacket_maxes = low_speed_maxpacket_maxes; 420 412 break; ··· 450 442 * maxpacket sizes other than 512. High speed HCDs may not 451 443 * be able to handle that particular bug, so let's warn... 452 444 */ 453 - if (to_usb_device(ddev)->speed == USB_SPEED_HIGH 454 - && usb_endpoint_xfer_bulk(d)) { 445 + if (udev->speed == USB_SPEED_HIGH && usb_endpoint_xfer_bulk(d)) { 455 446 if (maxp != 512) 456 447 dev_warn(ddev, "config %d interface %d altsetting %d " 457 448 "bulk endpoint 0x%X has invalid maxpacket %d\n", ··· 459 452 } 460 453 461 454 /* Parse a possible SuperSpeed endpoint companion descriptor */ 462 - if (to_usb_device(ddev)->speed >= USB_SPEED_SUPER) 455 + if (udev->speed >= USB_SPEED_SUPER) 463 456 usb_parse_ss_endpoint_companion(ddev, cfgno, 464 457 inum, asnum, endpoint, buffer, size); 465 458
+15 -5
drivers/usb/core/hub.c
··· 38 38 #include "otg_whitelist.h" 39 39 40 40 #define USB_VENDOR_GENESYS_LOGIC 0x05e3 41 + #define USB_VENDOR_SMSC 0x0424 41 42 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 43 + #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02 42 44 43 45 #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ 44 46 #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ ··· 1219 1217 #ifdef CONFIG_PM 1220 1218 udev->reset_resume = 1; 1221 1219 #endif 1222 - /* Don't set the change_bits when the device 1223 - * was powered off. 1224 - */ 1225 - if (test_bit(port1, hub->power_bits)) 1226 - set_bit(port1, hub->change_bits); 1227 1220 1228 1221 } else { 1229 1222 /* The power session is gone; tell hub_wq */ ··· 1728 1731 kfree(hub->buffer); 1729 1732 1730 1733 pm_suspend_ignore_children(&intf->dev, false); 1734 + 1735 + if (hub->quirk_disable_autosuspend) 1736 + usb_autopm_put_interface(intf); 1737 + 1731 1738 kref_put(&hub->kref, hub_release); 1732 1739 } 1733 1740 ··· 1863 1862 1864 1863 if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND) 1865 1864 hub->quirk_check_port_auto_suspend = 1; 1865 + 1866 + if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND) { 1867 + hub->quirk_disable_autosuspend = 1; 1868 + usb_autopm_get_interface(intf); 1869 + } 1866 1870 1867 1871 if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) 1868 1872 return 0; ··· 5605 5599 } 5606 5600 5607 5601 static const struct usb_device_id hub_id_table[] = { 5602 + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_CLASS, 5603 + .idVendor = USB_VENDOR_SMSC, 5604 + .bInterfaceClass = USB_CLASS_HUB, 5605 + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, 5608 5606 { .match_flags = USB_DEVICE_ID_MATCH_VENDOR 5609 5607 | USB_DEVICE_ID_MATCH_INT_CLASS, 5610 5608 .idVendor = USB_VENDOR_GENESYS_LOGIC,
+1
drivers/usb/core/hub.h
··· 61 61 unsigned quiescing:1; 62 62 unsigned disconnected:1; 63 63 unsigned in_reset:1; 64 + unsigned quirk_disable_autosuspend:1; 64 65 65 66 unsigned quirk_check_port_auto_suspend:1; 66 67
+40
drivers/usb/core/quirks.c
··· 354 354 { USB_DEVICE(0x0904, 0x6103), .driver_info = 355 355 USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, 356 356 357 + /* Sound Devices USBPre2 */ 358 + { USB_DEVICE(0x0926, 0x0202), .driver_info = 359 + USB_QUIRK_ENDPOINT_BLACKLIST }, 360 + 357 361 /* Keytouch QWERTY Panel keyboard */ 358 362 { USB_DEVICE(0x0926, 0x3333), .driver_info = 359 363 USB_QUIRK_CONFIG_INTF_STRINGS }, ··· 449 445 /* INTEL VALUE SSD */ 450 446 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, 451 447 448 + /* novation SoundControl XL */ 449 + { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME }, 450 + 452 451 { } /* terminating entry must be last */ 453 452 }; 454 453 ··· 478 471 479 472 { } /* terminating entry must be last */ 480 473 }; 474 + 475 + /* 476 + * Entries for blacklisted endpoints that should be ignored when parsing 477 + * configuration descriptors. 478 + * 479 + * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST. 480 + */ 481 + static const struct usb_device_id usb_endpoint_blacklist[] = { 482 + { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 }, 483 + { } 484 + }; 485 + 486 + bool usb_endpoint_is_blacklisted(struct usb_device *udev, 487 + struct usb_host_interface *intf, 488 + struct usb_endpoint_descriptor *epd) 489 + { 490 + const struct usb_device_id *id; 491 + unsigned int address; 492 + 493 + for (id = usb_endpoint_blacklist; id->match_flags; ++id) { 494 + if (!usb_match_device(udev, id)) 495 + continue; 496 + 497 + if (!usb_match_one_id_intf(udev, intf, id)) 498 + continue; 499 + 500 + address = id->driver_info; 501 + if (address == epd->bEndpointAddress) 502 + return true; 503 + } 504 + 505 + return false; 506 + } 481 507 482 508 static bool usb_match_any_interface(struct usb_device *udev, 483 509 const struct usb_device_id *id)
+3
drivers/usb/core/usb.h
··· 37 37 extern void usb_detect_quirks(struct usb_device *udev); 38 38 extern void usb_detect_interface_quirks(struct usb_device *udev); 39 39 extern void usb_release_quirk_list(void); 40 + extern bool usb_endpoint_is_blacklisted(struct usb_device *udev, 41 + struct usb_host_interface *intf, 42 + struct usb_endpoint_descriptor *epd); 40 43 extern int usb_remove_device(struct usb_device *udev); 41 44 42 45 extern int usb_get_device_descriptor(struct usb_device *dev,
+23 -17
drivers/usb/dwc2/gadget.c
··· 1083 1083 else 1084 1084 packets = 1; /* send one packet if length is zero. */ 1085 1085 1086 - if (hs_ep->isochronous && length > (hs_ep->mc * hs_ep->ep.maxpacket)) { 1087 - dev_err(hsotg->dev, "req length > maxpacket*mc\n"); 1088 - return; 1089 - } 1090 - 1091 1086 if (dir_in && index != 0) 1092 1087 if (hs_ep->isochronous) 1093 1088 epsize = DXEPTSIZ_MC(packets); ··· 1386 1391 req->actual = 0; 1387 1392 req->status = -EINPROGRESS; 1388 1393 1394 + /* Don't queue ISOC request if length greater than mps*mc */ 1395 + if (hs_ep->isochronous && 1396 + req->length > (hs_ep->mc * hs_ep->ep.maxpacket)) { 1397 + dev_err(hs->dev, "req length > maxpacket*mc\n"); 1398 + return -EINVAL; 1399 + } 1400 + 1389 1401 /* In DDMA mode for ISOC's don't queue request if length greater 1390 1402 * than descriptor limits. 1391 1403 */ ··· 1634 1632 struct dwc2_hsotg_ep *ep0 = hsotg->eps_out[0]; 1635 1633 struct dwc2_hsotg_ep *ep; 1636 1634 __le16 reply; 1635 + u16 status; 1637 1636 int ret; 1638 1637 1639 1638 dev_dbg(hsotg->dev, "%s: USB_REQ_GET_STATUS\n", __func__); ··· 1646 1643 1647 1644 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1648 1645 case USB_RECIP_DEVICE: 1649 - /* 1650 - * bit 0 => self powered 1651 - * bit 1 => remote wakeup 1652 - */ 1653 - reply = cpu_to_le16(0); 1646 + status = 1 << USB_DEVICE_SELF_POWERED; 1647 + status |= hsotg->remote_wakeup_allowed << 1648 + USB_DEVICE_REMOTE_WAKEUP; 1649 + reply = cpu_to_le16(status); 1654 1650 break; 1655 1651 1656 1652 case USB_RECIP_INTERFACE: ··· 1760 1758 case USB_RECIP_DEVICE: 1761 1759 switch (wValue) { 1762 1760 case USB_DEVICE_REMOTE_WAKEUP: 1763 - hsotg->remote_wakeup_allowed = 1; 1761 + if (set) 1762 + hsotg->remote_wakeup_allowed = 1; 1763 + else 1764 + hsotg->remote_wakeup_allowed = 0; 1764 1765 break; 1765 1766 1766 1767 case USB_DEVICE_TEST_MODE: ··· 1773 1768 return -EINVAL; 1774 1769 1775 1770 hsotg->test_mode = wIndex >> 8; 1776 - ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); 1777 - if (ret) { 1778 - dev_err(hsotg->dev, 1779 - "%s: failed to send reply\n", __func__); 1780 - return ret; 1781 - } 1782 1771 break; 1783 1772 default: 1784 1773 return -ENOENT; 1774 + } 1775 + 1776 + ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0); 1777 + if (ret) { 1778 + dev_err(hsotg->dev, 1779 + "%s: failed to send reply\n", __func__); 1780 + return ret; 1785 1781 } 1786 1782 break; 1787 1783
+15 -24
drivers/usb/dwc3/debug.h
··· 256 256 u8 epnum = event->endpoint_number; 257 257 size_t len; 258 258 int status; 259 - int ret; 260 259 261 - ret = snprintf(str, size, "ep%d%s: ", epnum >> 1, 260 + len = scnprintf(str, size, "ep%d%s: ", epnum >> 1, 262 261 (epnum & 1) ? "in" : "out"); 263 - if (ret < 0) 264 - return "UNKNOWN"; 265 262 266 263 status = event->status; 267 264 268 265 switch (event->endpoint_event) { 269 266 case DWC3_DEPEVT_XFERCOMPLETE: 270 - len = strlen(str); 271 - snprintf(str + len, size - len, "Transfer Complete (%c%c%c)", 267 + len += scnprintf(str + len, size - len, 268 + "Transfer Complete (%c%c%c)", 272 269 status & DEPEVT_STATUS_SHORT ? 'S' : 's', 273 270 status & DEPEVT_STATUS_IOC ? 'I' : 'i', 274 271 status & DEPEVT_STATUS_LST ? 'L' : 'l'); 275 272 276 - len = strlen(str); 277 - 278 273 if (epnum <= 1) 279 - snprintf(str + len, size - len, " [%s]", 274 + scnprintf(str + len, size - len, " [%s]", 280 275 dwc3_ep0_state_string(ep0state)); 281 276 break; 282 277 case DWC3_DEPEVT_XFERINPROGRESS: 283 - len = strlen(str); 284 - 285 - snprintf(str + len, size - len, "Transfer In Progress [%d] (%c%c%c)", 278 + scnprintf(str + len, size - len, 279 + "Transfer In Progress [%d] (%c%c%c)", 286 280 event->parameters, 287 281 status & DEPEVT_STATUS_SHORT ? 'S' : 's', 288 282 status & DEPEVT_STATUS_IOC ? 'I' : 'i', 289 283 status & DEPEVT_STATUS_LST ? 'M' : 'm'); 290 284 break; 291 285 case DWC3_DEPEVT_XFERNOTREADY: 292 - len = strlen(str); 293 - 294 - snprintf(str + len, size - len, "Transfer Not Ready [%d]%s", 286 + len += scnprintf(str + len, size - len, 287 + "Transfer Not Ready [%d]%s", 295 288 event->parameters, 296 289 status & DEPEVT_STATUS_TRANSFER_ACTIVE ? 297 290 " (Active)" : " (Not Active)"); 298 - 299 - len = strlen(str); 300 291 301 292 /* Control Endpoints */ 302 293 if (epnum <= 1) { ··· 295 304 296 305 switch (phase) { 297 306 case DEPEVT_STATUS_CONTROL_DATA: 298 - snprintf(str + ret, size - ret, 307 + scnprintf(str + len, size - len, 299 308 " [Data Phase]"); 300 309 break; 301 310 case DEPEVT_STATUS_CONTROL_STATUS: 302 - snprintf(str + ret, size - ret, 311 + scnprintf(str + len, size - len, 303 312 " [Status Phase]"); 304 313 } 305 314 } 306 315 break; 307 316 case DWC3_DEPEVT_RXTXFIFOEVT: 308 - snprintf(str + ret, size - ret, "FIFO"); 317 + scnprintf(str + len, size - len, "FIFO"); 309 318 break; 310 319 case DWC3_DEPEVT_STREAMEVT: 311 320 status = event->status; 312 321 313 322 switch (status) { 314 323 case DEPEVT_STREAMEVT_FOUND: 315 - snprintf(str + ret, size - ret, " Stream %d Found", 324 + scnprintf(str + len, size - len, " Stream %d Found", 316 325 event->parameters); 317 326 break; 318 327 case DEPEVT_STREAMEVT_NOTFOUND: 319 328 default: 320 - snprintf(str + ret, size - ret, " Stream Not Found"); 329 + scnprintf(str + len, size - len, " Stream Not Found"); 321 330 break; 322 331 } 323 332 324 333 break; 325 334 case DWC3_DEPEVT_EPCMDCMPLT: 326 - snprintf(str + ret, size - ret, "Endpoint Command Complete"); 335 + scnprintf(str + len, size - len, "Endpoint Command Complete"); 327 336 break; 328 337 default: 329 - snprintf(str, size, "UNKNOWN"); 338 + scnprintf(str + len, size - len, "UNKNOWN"); 330 339 } 331 340 332 341 return str;
+2 -1
drivers/usb/dwc3/gadget.c
··· 2429 2429 if (event->status & DEPEVT_STATUS_SHORT && !chain) 2430 2430 return 1; 2431 2431 2432 - if (event->status & DEPEVT_STATUS_IOC) 2432 + if ((trb->ctrl & DWC3_TRB_CTRL_IOC) || 2433 + (trb->ctrl & DWC3_TRB_CTRL_LST)) 2433 2434 return 1; 2434 2435 2435 2436 return 0;
+20 -10
drivers/usb/gadget/composite.c
··· 437 437 val = CONFIG_USB_GADGET_VBUS_DRAW; 438 438 if (!val) 439 439 return 0; 440 - switch (speed) { 441 - case USB_SPEED_SUPER: 442 - return DIV_ROUND_UP(val, 8); 443 - default: 444 - return DIV_ROUND_UP(val, 2); 445 - } 440 + if (speed < USB_SPEED_SUPER) 441 + return min(val, 500U) / 2; 442 + else 443 + /* 444 + * USB 3.x supports up to 900mA, but since 900 isn't divisible 445 + * by 8 the integral division will effectively cap to 896mA. 446 + */ 447 + return min(val, 900U) / 8; 446 448 } 447 449 448 450 static int config_buf(struct usb_configuration *config, ··· 856 854 857 855 /* when we return, be sure our power usage is valid */ 858 856 power = c->MaxPower ? c->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW; 857 + if (gadget->speed < USB_SPEED_SUPER) 858 + power = min(power, 500U); 859 + else 860 + power = min(power, 900U); 859 861 done: 860 862 usb_gadget_vbus_draw(gadget, power); 861 863 if (result >= 0 && cdev->delayed_status) ··· 2286 2280 { 2287 2281 struct usb_composite_dev *cdev = get_gadget_data(gadget); 2288 2282 struct usb_function *f; 2289 - u16 maxpower; 2283 + unsigned maxpower; 2290 2284 2291 2285 /* REVISIT: should we have config level 2292 2286 * suspend/resume callbacks? ··· 2300 2294 f->resume(f); 2301 2295 } 2302 2296 2303 - maxpower = cdev->config->MaxPower; 2297 + maxpower = cdev->config->MaxPower ? 2298 + cdev->config->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW; 2299 + if (gadget->speed < USB_SPEED_SUPER) 2300 + maxpower = min(maxpower, 500U); 2301 + else 2302 + maxpower = min(maxpower, 900U); 2304 2303 2305 - usb_gadget_vbus_draw(gadget, maxpower ? 2306 - maxpower : CONFIG_USB_GADGET_VBUS_DRAW); 2304 + usb_gadget_vbus_draw(gadget, maxpower); 2307 2305 } 2308 2306 2309 2307 cdev->suspended = 0;
+3 -2
drivers/usb/gadget/function/f_fs.c
··· 1162 1162 { 1163 1163 struct ffs_io_data *io_data = kiocb->private; 1164 1164 struct ffs_epfile *epfile = kiocb->ki_filp->private_data; 1165 + unsigned long flags; 1165 1166 int value; 1166 1167 1167 1168 ENTER(); 1168 1169 1169 - spin_lock_irq(&epfile->ffs->eps_lock); 1170 + spin_lock_irqsave(&epfile->ffs->eps_lock, flags); 1170 1171 1171 1172 if (likely(io_data && io_data->ep && io_data->req)) 1172 1173 value = usb_ep_dequeue(io_data->ep, io_data->req); 1173 1174 else 1174 1175 value = -EINVAL; 1175 1176 1176 - spin_unlock_irq(&epfile->ffs->eps_lock); 1177 + spin_unlock_irqrestore(&epfile->ffs->eps_lock, flags); 1177 1178 1178 1179 return value; 1179 1180 }
+5 -5
drivers/usb/gadget/function/u_audio.c
··· 361 361 ep = audio_dev->out_ep; 362 362 prm = &uac->c_prm; 363 363 config_ep_by_speed(gadget, &audio_dev->func, ep); 364 - req_len = prm->max_psize; 364 + req_len = ep->maxpacket; 365 365 366 366 prm->ep_enabled = true; 367 367 usb_ep_enable(ep); ··· 379 379 req->context = &prm->ureq[i]; 380 380 req->length = req_len; 381 381 req->complete = u_audio_iso_complete; 382 - req->buf = prm->rbuf + i * prm->max_psize; 382 + req->buf = prm->rbuf + i * ep->maxpacket; 383 383 } 384 384 385 385 if (usb_ep_queue(ep, prm->ureq[i].req, GFP_ATOMIC)) ··· 430 430 uac->p_pktsize = min_t(unsigned int, 431 431 uac->p_framesize * 432 432 (params->p_srate / uac->p_interval), 433 - prm->max_psize); 433 + ep->maxpacket); 434 434 435 - if (uac->p_pktsize < prm->max_psize) 435 + if (uac->p_pktsize < ep->maxpacket) 436 436 uac->p_pktsize_residue = uac->p_framesize * 437 437 (params->p_srate % uac->p_interval); 438 438 else ··· 457 457 req->context = &prm->ureq[i]; 458 458 req->length = req_len; 459 459 req->complete = u_audio_iso_complete; 460 - req->buf = prm->rbuf + i * prm->max_psize; 460 + req->buf = prm->rbuf + i * ep->maxpacket; 461 461 } 462 462 463 463 if (usb_ep_queue(ep, prm->ureq[i].req, GFP_ATOMIC))
+3 -1
drivers/usb/gadget/function/u_serial.c
··· 561 561 port->n_read = 0; 562 562 started = gs_start_rx(port); 563 563 564 - /* unblock any pending writes into our circular buffer */ 565 564 if (started) { 565 + gs_start_tx(port); 566 + /* Unblock any pending writes into our circular buffer, in case 567 + * we didn't in gs_start_tx() */ 566 568 tty_wakeup(port->port.tty); 567 569 } else { 568 570 gs_free_requests(ep, head, &port->read_allocated);
-1
drivers/usb/gadget/udc/udc-xilinx.c
··· 1399 1399 /** 1400 1400 * xudc_stop - stops the device. 1401 1401 * @gadget: pointer to the usb gadget structure 1402 - * @driver: pointer to usb gadget driver structure 1403 1402 * 1404 1403 * Return: zero always 1405 1404 */
+17 -8
drivers/usb/host/xhci-hub.c
··· 55 55 static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf, 56 56 u16 wLength) 57 57 { 58 + struct xhci_port_cap *port_cap = NULL; 58 59 int i, ssa_count; 59 60 u32 temp; 60 61 u16 desc_size, ssp_cap_size, ssa_size = 0; ··· 65 64 ssp_cap_size = sizeof(usb_bos_descriptor) - desc_size; 66 65 67 66 /* does xhci support USB 3.1 Enhanced SuperSpeed */ 68 - if (xhci->usb3_rhub.min_rev >= 0x01) { 67 + for (i = 0; i < xhci->num_port_caps; i++) { 68 + if (xhci->port_caps[i].maj_rev == 0x03 && 69 + xhci->port_caps[i].min_rev >= 0x01) { 70 + usb3_1 = true; 71 + port_cap = &xhci->port_caps[i]; 72 + break; 73 + } 74 + } 75 + 76 + if (usb3_1) { 69 77 /* does xhci provide a PSI table for SSA speed attributes? */ 70 - if (xhci->usb3_rhub.psi_count) { 78 + if (port_cap->psi_count) { 71 79 /* two SSA entries for each unique PSI ID, RX and TX */ 72 - ssa_count = xhci->usb3_rhub.psi_uid_count * 2; 80 + ssa_count = port_cap->psi_uid_count * 2; 73 81 ssa_size = ssa_count * sizeof(u32); 74 82 ssp_cap_size -= 16; /* skip copying the default SSA */ 75 83 } 76 84 desc_size += ssp_cap_size; 77 - usb3_1 = true; 78 85 } 79 86 memcpy(buf, &usb_bos_descriptor, min(desc_size, wLength)); 80 87 ··· 108 99 } 109 100 110 101 /* If PSI table exists, add the custom speed attributes from it */ 111 - if (usb3_1 && xhci->usb3_rhub.psi_count) { 102 + if (usb3_1 && port_cap->psi_count) { 112 103 u32 ssp_cap_base, bm_attrib, psi, psi_mant, psi_exp; 113 104 int offset; 114 105 ··· 120 111 121 112 /* attribute count SSAC bits 4:0 and ID count SSIC bits 8:5 */ 122 113 bm_attrib = (ssa_count - 1) & 0x1f; 123 - bm_attrib |= (xhci->usb3_rhub.psi_uid_count - 1) << 5; 114 + bm_attrib |= (port_cap->psi_uid_count - 1) << 5; 124 115 put_unaligned_le32(bm_attrib, &buf[ssp_cap_base + 4]); 125 116 126 117 if (wLength < desc_size + ssa_size) ··· 133 124 * USB 3.1 requires two SSA entries (RX and TX) for every link 134 125 */ 135 126 offset = desc_size; 136 - for (i = 0; i < xhci->usb3_rhub.psi_count; i++) { 137 - psi = xhci->usb3_rhub.psi[i]; 127 + for (i = 0; i < port_cap->psi_count; i++) { 128 + psi = port_cap->psi[i]; 138 129 psi &= ~USB_SSP_SUBLINK_SPEED_RSVD; 139 130 psi_exp = XHCI_EXT_PORT_PSIE(psi); 140 131 psi_mant = XHCI_EXT_PORT_PSIM(psi);
+46 -25
drivers/usb/host/xhci-mem.c
··· 1475 1475 /* Allow 3 retries for everything but isoc, set CErr = 3 */ 1476 1476 if (!usb_endpoint_xfer_isoc(&ep->desc)) 1477 1477 err_count = 3; 1478 - /* Some devices get this wrong */ 1479 - if (usb_endpoint_xfer_bulk(&ep->desc) && udev->speed == USB_SPEED_HIGH) 1480 - max_packet = 512; 1478 + /* HS bulk max packet should be 512, FS bulk supports 8, 16, 32 or 64 */ 1479 + if (usb_endpoint_xfer_bulk(&ep->desc)) { 1480 + if (udev->speed == USB_SPEED_HIGH) 1481 + max_packet = 512; 1482 + if (udev->speed == USB_SPEED_FULL) { 1483 + max_packet = rounddown_pow_of_two(max_packet); 1484 + max_packet = clamp_val(max_packet, 8, 64); 1485 + } 1486 + } 1481 1487 /* xHCI 1.0 and 1.1 indicates that ctrl ep avg TRB Length should be 8 */ 1482 1488 if (usb_endpoint_xfer_control(&ep->desc) && xhci->hci_version >= 0x100) 1483 1489 avg_trb_len = 8; ··· 1915 1909 xhci->usb3_rhub.num_ports = 0; 1916 1910 xhci->num_active_eps = 0; 1917 1911 kfree(xhci->usb2_rhub.ports); 1918 - kfree(xhci->usb2_rhub.psi); 1919 1912 kfree(xhci->usb3_rhub.ports); 1920 - kfree(xhci->usb3_rhub.psi); 1921 1913 kfree(xhci->hw_ports); 1922 1914 kfree(xhci->rh_bw); 1923 1915 kfree(xhci->ext_caps); 1916 + for (i = 0; i < xhci->num_port_caps; i++) 1917 + kfree(xhci->port_caps[i].psi); 1918 + kfree(xhci->port_caps); 1919 + xhci->num_port_caps = 0; 1924 1920 1925 1921 xhci->usb2_rhub.ports = NULL; 1926 - xhci->usb2_rhub.psi = NULL; 1927 1922 xhci->usb3_rhub.ports = NULL; 1928 - xhci->usb3_rhub.psi = NULL; 1929 1923 xhci->hw_ports = NULL; 1930 1924 xhci->rh_bw = NULL; 1931 1925 xhci->ext_caps = NULL; ··· 2126 2120 u8 major_revision, minor_revision; 2127 2121 struct xhci_hub *rhub; 2128 2122 struct device *dev = xhci_to_hcd(xhci)->self.sysdev; 2123 + struct xhci_port_cap *port_cap; 2129 2124 2130 2125 temp = readl(addr); 2131 2126 major_revision = XHCI_EXT_PORT_MAJOR(temp); ··· 2161 2154 /* WTF? "Valid values are ‘1’ to MaxPorts" */ 2162 2155 return; 2163 2156 2164 - rhub->psi_count = XHCI_EXT_PORT_PSIC(temp); 2165 - if (rhub->psi_count) { 2166 - rhub->psi = kcalloc_node(rhub->psi_count, sizeof(*rhub->psi), 2167 - GFP_KERNEL, dev_to_node(dev)); 2168 - if (!rhub->psi) 2169 - rhub->psi_count = 0; 2157 + port_cap = &xhci->port_caps[xhci->num_port_caps++]; 2158 + if (xhci->num_port_caps > max_caps) 2159 + return; 2170 2160 2171 - rhub->psi_uid_count++; 2172 - for (i = 0; i < rhub->psi_count; i++) { 2173 - rhub->psi[i] = readl(addr + 4 + i); 2161 + port_cap->maj_rev = major_revision; 2162 + port_cap->min_rev = minor_revision; 2163 + port_cap->psi_count = XHCI_EXT_PORT_PSIC(temp); 2164 + 2165 + if (port_cap->psi_count) { 2166 + port_cap->psi = kcalloc_node(port_cap->psi_count, 2167 + sizeof(*port_cap->psi), 2168 + GFP_KERNEL, dev_to_node(dev)); 2169 + if (!port_cap->psi) 2170 + port_cap->psi_count = 0; 2171 + 2172 + port_cap->psi_uid_count++; 2173 + for (i = 0; i < port_cap->psi_count; i++) { 2174 + port_cap->psi[i] = readl(addr + 4 + i); 2174 2175 2175 2176 /* count unique ID values, two consecutive entries can 2176 2177 * have the same ID if link is assymetric 2177 2178 */ 2178 - if (i && (XHCI_EXT_PORT_PSIV(rhub->psi[i]) != 2179 - XHCI_EXT_PORT_PSIV(rhub->psi[i - 1]))) 2180 - rhub->psi_uid_count++; 2179 + if (i && (XHCI_EXT_PORT_PSIV(port_cap->psi[i]) != 2180 + XHCI_EXT_PORT_PSIV(port_cap->psi[i - 1]))) 2181 + port_cap->psi_uid_count++; 2181 2182 2182 2183 xhci_dbg(xhci, "PSIV:%d PSIE:%d PLT:%d PFD:%d LP:%d PSIM:%d\n", 2183 - XHCI_EXT_PORT_PSIV(rhub->psi[i]), 2184 - XHCI_EXT_PORT_PSIE(rhub->psi[i]), 2185 - XHCI_EXT_PORT_PLT(rhub->psi[i]), 2186 - XHCI_EXT_PORT_PFD(rhub->psi[i]), 2187 - XHCI_EXT_PORT_LP(rhub->psi[i]), 2188 - XHCI_EXT_PORT_PSIM(rhub->psi[i])); 2184 + XHCI_EXT_PORT_PSIV(port_cap->psi[i]), 2185 + XHCI_EXT_PORT_PSIE(port_cap->psi[i]), 2186 + XHCI_EXT_PORT_PLT(port_cap->psi[i]), 2187 + XHCI_EXT_PORT_PFD(port_cap->psi[i]), 2188 + XHCI_EXT_PORT_LP(port_cap->psi[i]), 2189 + XHCI_EXT_PORT_PSIM(port_cap->psi[i])); 2189 2190 } 2190 2191 } 2191 2192 /* cache usb2 port capabilities */ ··· 2228 2213 continue; 2229 2214 } 2230 2215 hw_port->rhub = rhub; 2216 + hw_port->port_cap = port_cap; 2231 2217 rhub->num_ports++; 2232 2218 } 2233 2219 /* FIXME: Should we disable ports not in the Extended Capabilities? */ ··· 2317 2301 xhci->ext_caps = kcalloc_node(cap_count, sizeof(*xhci->ext_caps), 2318 2302 flags, dev_to_node(dev)); 2319 2303 if (!xhci->ext_caps) 2304 + return -ENOMEM; 2305 + 2306 + xhci->port_caps = kcalloc_node(cap_count, sizeof(*xhci->port_caps), 2307 + flags, dev_to_node(dev)); 2308 + if (!xhci->port_caps) 2320 2309 return -ENOMEM; 2321 2310 2322 2311 offset = cap_start;
+6 -4
drivers/usb/host/xhci-pci.c
··· 49 49 #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI 0x15ec 50 50 #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI 0x15f0 51 51 #define PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI 0x8a13 52 + #define PCI_DEVICE_ID_INTEL_CML_XHCI 0xa3af 52 53 53 54 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 54 55 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba ··· 188 187 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || 189 188 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || 190 189 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || 191 - pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) { 190 + pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI || 191 + pdev->device == PCI_DEVICE_ID_INTEL_CML_XHCI)) { 192 192 xhci->quirks |= XHCI_PME_STUCK_QUIRK; 193 193 } 194 194 if (pdev->vendor == PCI_VENDOR_ID_INTEL && ··· 304 302 if (!usb_hcd_is_primary_hcd(hcd)) 305 303 return 0; 306 304 305 + if (xhci->quirks & XHCI_PME_STUCK_QUIRK) 306 + xhci_pme_acpi_rtd3_enable(pdev); 307 + 307 308 xhci_dbg(xhci, "Got SBRN %u\n", (unsigned int) xhci->sbrn); 308 309 309 310 /* Find any debug ports */ ··· 363 358 if (!(xhci->quirks & XHCI_BROKEN_STREAMS) && 364 359 HCC_MAX_PSA(xhci->hcc_params) >= 4) 365 360 xhci->shared_hcd->can_do_streams = 1; 366 - 367 - if (xhci->quirks & XHCI_PME_STUCK_QUIRK) 368 - xhci_pme_acpi_rtd3_enable(dev); 369 361 370 362 /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ 371 363 pm_runtime_put_noidle(&dev->dev);
+11 -3
drivers/usb/host/xhci.h
··· 1702 1702 * Intel Lynx Point LP xHCI host. 1703 1703 */ 1704 1704 #define XHCI_MAX_REXIT_TIMEOUT_MS 20 1705 + struct xhci_port_cap { 1706 + u32 *psi; /* array of protocol speed ID entries */ 1707 + u8 psi_count; 1708 + u8 psi_uid_count; 1709 + u8 maj_rev; 1710 + u8 min_rev; 1711 + }; 1705 1712 1706 1713 struct xhci_port { 1707 1714 __le32 __iomem *addr; 1708 1715 int hw_portnum; 1709 1716 int hcd_portnum; 1710 1717 struct xhci_hub *rhub; 1718 + struct xhci_port_cap *port_cap; 1711 1719 }; 1712 1720 1713 1721 struct xhci_hub { ··· 1727 1719 /* supported prococol extended capabiliy values */ 1728 1720 u8 maj_rev; 1729 1721 u8 min_rev; 1730 - u32 *psi; /* array of protocol speed ID entries */ 1731 - u8 psi_count; 1732 - u8 psi_uid_count; 1733 1722 }; 1734 1723 1735 1724 /* There is one xhci_hcd structure per controller */ ··· 1885 1880 /* cached usb2 extened protocol capabilites */ 1886 1881 u32 *ext_caps; 1887 1882 unsigned int num_ext_caps; 1883 + /* cached extended protocol port capabilities */ 1884 + struct xhci_port_cap *port_caps; 1885 + unsigned int num_port_caps; 1888 1886 /* Compliance Mode Recovery Data */ 1889 1887 struct timer_list comp_mode_recovery_timer; 1890 1888 u32 port_status_u0;
+29 -2
drivers/usb/misc/iowarrior.c
··· 33 33 #define USB_DEVICE_ID_CODEMERCS_IOWPV2 0x1512 34 34 /* full speed iowarrior */ 35 35 #define USB_DEVICE_ID_CODEMERCS_IOW56 0x1503 36 + /* fuller speed iowarrior */ 37 + #define USB_DEVICE_ID_CODEMERCS_IOW28 0x1504 38 + #define USB_DEVICE_ID_CODEMERCS_IOW28L 0x1505 39 + #define USB_DEVICE_ID_CODEMERCS_IOW100 0x1506 40 + 41 + /* OEMed devices */ 42 + #define USB_DEVICE_ID_CODEMERCS_IOW24SAG 0x158a 43 + #define USB_DEVICE_ID_CODEMERCS_IOW56AM 0x158b 36 44 37 45 /* Get a minor range for your devices from the usb maintainer */ 38 46 #ifdef CONFIG_USB_DYNAMIC_MINORS ··· 141 133 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV1)}, 142 134 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV2)}, 143 135 {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW56)}, 136 + {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24SAG)}, 137 + {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW56AM)}, 138 + {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW28)}, 139 + {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW28L)}, 140 + {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW100)}, 144 141 {} /* Terminating entry */ 145 142 }; 146 143 MODULE_DEVICE_TABLE(usb, iowarrior_ids); ··· 370 357 } 371 358 switch (dev->product_id) { 372 359 case USB_DEVICE_ID_CODEMERCS_IOW24: 360 + case USB_DEVICE_ID_CODEMERCS_IOW24SAG: 373 361 case USB_DEVICE_ID_CODEMERCS_IOWPV1: 374 362 case USB_DEVICE_ID_CODEMERCS_IOWPV2: 375 363 case USB_DEVICE_ID_CODEMERCS_IOW40: ··· 385 371 goto exit; 386 372 break; 387 373 case USB_DEVICE_ID_CODEMERCS_IOW56: 374 + case USB_DEVICE_ID_CODEMERCS_IOW56AM: 375 + case USB_DEVICE_ID_CODEMERCS_IOW28: 376 + case USB_DEVICE_ID_CODEMERCS_IOW28L: 377 + case USB_DEVICE_ID_CODEMERCS_IOW100: 388 378 /* The IOW56 uses asynchronous IO and more urbs */ 389 379 if (atomic_read(&dev->write_busy) == MAX_WRITES_IN_FLIGHT) { 390 380 /* Wait until we are below the limit for submitted urbs */ ··· 511 493 switch (cmd) { 512 494 case IOW_WRITE: 513 495 if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW24 || 496 + dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW24SAG || 514 497 dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV1 || 515 498 dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV2 || 516 499 dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW40) { ··· 786 767 goto error; 787 768 } 788 769 789 - if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) { 770 + if ((dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) || 771 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56AM) || 772 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28) || 773 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28L) || 774 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW100)) { 790 775 res = usb_find_last_int_out_endpoint(iface_desc, 791 776 &dev->int_out_endpoint); 792 777 if (res) { ··· 803 780 /* we have to check the report_size often, so remember it in the endianness suitable for our machine */ 804 781 dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint); 805 782 if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) && 806 - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56)) 783 + ((dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) || 784 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56AM) || 785 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28) || 786 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28L) || 787 + (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW100))) 807 788 /* IOWarrior56 has wMaxPacketSize different from report size */ 808 789 dev->report_size = 7; 809 790
+8
drivers/usb/phy/phy-tegra-usb.c
··· 969 969 return -ENXIO; 970 970 } 971 971 972 + /* 973 + * Note that UTMI pad registers are shared by all PHYs, therefore 974 + * devm_platform_ioremap_resource() can't be used here. 975 + */ 972 976 tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start, 973 977 resource_size(res)); 974 978 if (!tegra_phy->pad_regs) { ··· 1091 1087 return -ENXIO; 1092 1088 } 1093 1089 1090 + /* 1091 + * Note that PHY and USB controller are using shared registers, 1092 + * therefore devm_platform_ioremap_resource() can't be used here. 1093 + */ 1094 1094 tegra_phy->regs = devm_ioremap(&pdev->dev, res->start, 1095 1095 resource_size(res)); 1096 1096 if (!tegra_phy->regs) {
+10
drivers/usb/serial/ch341.c
··· 205 205 16 * speed - 16 * CH341_CLKRATE / (clk_div * (div + 1))) 206 206 div++; 207 207 208 + /* 209 + * Prefer lower base clock (fact = 0) if even divisor. 210 + * 211 + * Note that this makes the receiver more tolerant to errors. 212 + */ 213 + if (fact == 1 && div % 2 == 0) { 214 + div /= 2; 215 + fact = 0; 216 + } 217 + 208 218 return (0x100 - div) << 8 | fact << 2 | ps; 209 219 } 210 220
+1 -1
drivers/usb/serial/ir-usb.c
··· 448 448 usb_sndbulkpipe(udev, port->bulk_out_endpointAddress), 449 449 transfer_buffer, 1, &actual_length, 5000); 450 450 if (ret || actual_length != 1) { 451 - if (actual_length != 1) 451 + if (!ret) 452 452 ret = -EIO; 453 453 dev_err(&port->dev, "failed to change line speed: %d\n", ret); 454 454 }
+22 -1
drivers/usb/storage/uas.c
··· 45 45 struct scsi_cmnd *cmnd[MAX_CMNDS]; 46 46 spinlock_t lock; 47 47 struct work_struct work; 48 + struct work_struct scan_work; /* for async scanning */ 48 49 }; 49 50 50 51 enum { ··· 113 112 } 114 113 out: 115 114 spin_unlock_irqrestore(&devinfo->lock, flags); 115 + } 116 + 117 + static void uas_scan_work(struct work_struct *work) 118 + { 119 + struct uas_dev_info *devinfo = 120 + container_of(work, struct uas_dev_info, scan_work); 121 + struct Scsi_Host *shost = usb_get_intfdata(devinfo->intf); 122 + 123 + dev_dbg(&devinfo->intf->dev, "starting scan\n"); 124 + scsi_scan_host(shost); 125 + dev_dbg(&devinfo->intf->dev, "scan complete\n"); 116 126 } 117 127 118 128 static void uas_add_work(struct uas_cmd_info *cmdinfo) ··· 994 982 init_usb_anchor(&devinfo->data_urbs); 995 983 spin_lock_init(&devinfo->lock); 996 984 INIT_WORK(&devinfo->work, uas_do_work); 985 + INIT_WORK(&devinfo->scan_work, uas_scan_work); 997 986 998 987 result = uas_configure_endpoints(devinfo); 999 988 if (result) ··· 1011 998 if (result) 1012 999 goto free_streams; 1013 1000 1014 - scsi_scan_host(shost); 1001 + /* Submit the delayed_work for SCSI-device scanning */ 1002 + schedule_work(&devinfo->scan_work); 1003 + 1015 1004 return result; 1016 1005 1017 1006 free_streams: ··· 1180 1165 usb_kill_anchored_urbs(&devinfo->sense_urbs); 1181 1166 usb_kill_anchored_urbs(&devinfo->data_urbs); 1182 1167 uas_zap_pending(devinfo, DID_NO_CONNECT); 1168 + 1169 + /* 1170 + * Prevent SCSI scanning (if it hasn't started yet) 1171 + * or wait for the SCSI-scanning routine to stop. 1172 + */ 1173 + cancel_work_sync(&devinfo->scan_work); 1183 1174 1184 1175 scsi_remove_host(shost); 1185 1176 uas_free_streams(devinfo);
+3
include/linux/usb/quirks.h
··· 69 69 /* Hub needs extra delay after resetting its port. */ 70 70 #define USB_QUIRK_HUB_SLOW_RESET BIT(14) 71 71 72 + /* device has blacklisted endpoints */ 73 + #define USB_QUIRK_ENDPOINT_BLACKLIST BIT(15) 74 + 72 75 #endif /* __LINUX_USB_QUIRKS_H */
+8 -8
include/uapi/linux/usb/charger.h
··· 14 14 * ACA (Accessory Charger Adapters) 15 15 */ 16 16 enum usb_charger_type { 17 - UNKNOWN_TYPE, 18 - SDP_TYPE, 19 - DCP_TYPE, 20 - CDP_TYPE, 21 - ACA_TYPE, 17 + UNKNOWN_TYPE = 0, 18 + SDP_TYPE = 1, 19 + DCP_TYPE = 2, 20 + CDP_TYPE = 3, 21 + ACA_TYPE = 4, 22 22 }; 23 23 24 24 /* USB charger state */ 25 25 enum usb_charger_state { 26 - USB_CHARGER_DEFAULT, 27 - USB_CHARGER_PRESENT, 28 - USB_CHARGER_ABSENT, 26 + USB_CHARGER_DEFAULT = 0, 27 + USB_CHARGER_PRESENT = 1, 28 + USB_CHARGER_ABSENT = 2, 29 29 }; 30 30 31 31 #endif /* _UAPI__LINUX_USB_CHARGER_H */