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.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB/PHY fixes from Greg KH:
"Here are a number of USB and PHY driver fixes for 5.5-rc6

Nothing all that unusual, just the a bunch of small fixes for a lot of
different reported issues. The PHY driver fixes are in here as they
interacted with the usb drivers.

Full details of the patches are in the shortlog, and all of these have
been in linux-next with no reported issues"

* tag 'usb-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (24 commits)
usb: missing parentheses in USE_NEW_SCHEME
usb: ohci-da8xx: ensure error return on variable error is set
usb: musb: Disable pullup at init
usb: musb: fix idling for suspend after disconnect interrupt
usb: typec: ucsi: Fix the notification bit offsets
USB: Fix: Don't skip endpoint descriptors with maxpacket=0
USB-PD tcpm: bad warning+size, PPS adapters
phy/rockchip: inno-hdmi: round clock rate down to closest 1000 Hz
usb: chipidea: host: Disable port power only if previously enabled
usb: cdns3: should not use the same dev_id for shared interrupt handler
usb: dwc3: gadget: Fix request complete check
usb: musb: dma: Correct parameter passed to IRQ handler
usb: musb: jz4740: Silence error if code is -EPROBE_DEFER
usb: udc: tegra: select USB_ROLE_SWITCH
USB: core: fix check for duplicate endpoints
phy: cpcap-usb: Drop extra write to usb2 register
phy: cpcap-usb: Improve host vs docked mode detection
phy: cpcap-usb: Prevent USB line glitches from waking up modem
phy: mapphone-mdm6600: Fix uninitialized status value regression
phy: cpcap-usb: Fix flakey host idling and enumerating of devices
...

+243 -93
+90 -38
drivers/phy/motorola/phy-cpcap-usb.c
··· 115 115 enum cpcap_gpio_mode { 116 116 CPCAP_DM_DP, 117 117 CPCAP_MDM_RX_TX, 118 - CPCAP_UNKNOWN, 118 + CPCAP_UNKNOWN_DISABLED, /* Seems to disable USB lines */ 119 119 CPCAP_OTG_DM_DP, 120 120 }; 121 121 ··· 134 134 struct iio_channel *id; 135 135 struct regulator *vusb; 136 136 atomic_t active; 137 + unsigned int vbus_provider:1; 138 + unsigned int docked:1; 137 139 }; 138 140 139 141 static bool cpcap_usb_vbus_valid(struct cpcap_phy_ddata *ddata) ··· 209 207 static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata); 210 208 static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata); 211 209 210 + static void cpcap_usb_try_musb_mailbox(struct cpcap_phy_ddata *ddata, 211 + enum musb_vbus_id_status status) 212 + { 213 + int error; 214 + 215 + error = musb_mailbox(status); 216 + if (!error) 217 + return; 218 + 219 + dev_dbg(ddata->dev, "%s: musb_mailbox failed: %i\n", 220 + __func__, error); 221 + } 222 + 212 223 static void cpcap_usb_detect(struct work_struct *work) 213 224 { 214 225 struct cpcap_phy_ddata *ddata; ··· 235 220 if (error) 236 221 return; 237 222 238 - if (s.id_ground) { 239 - dev_dbg(ddata->dev, "id ground, USB host mode\n"); 223 + vbus = cpcap_usb_vbus_valid(ddata); 224 + 225 + /* We need to kick the VBUS as USB A-host */ 226 + if (s.id_ground && ddata->vbus_provider) { 227 + dev_dbg(ddata->dev, "still in USB A-host mode, kicking VBUS\n"); 228 + 229 + cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); 230 + 231 + error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3, 232 + CPCAP_BIT_VBUSSTBY_EN | 233 + CPCAP_BIT_VBUSEN_SPI, 234 + CPCAP_BIT_VBUSEN_SPI); 235 + if (error) 236 + goto out_err; 237 + 238 + return; 239 + } 240 + 241 + if (vbus && s.id_ground && ddata->docked) { 242 + dev_dbg(ddata->dev, "still docked as A-host, signal ID down\n"); 243 + 244 + cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); 245 + 246 + return; 247 + } 248 + 249 + /* No VBUS needed with docks */ 250 + if (vbus && s.id_ground && !ddata->vbus_provider) { 251 + dev_dbg(ddata->dev, "connected to a dock\n"); 252 + 253 + ddata->docked = true; 254 + 240 255 error = cpcap_usb_set_usb_mode(ddata); 241 256 if (error) 242 257 goto out_err; 243 258 244 - error = musb_mailbox(MUSB_ID_GROUND); 259 + cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); 260 + 261 + /* 262 + * Force check state again after musb has reoriented, 263 + * otherwise devices won't enumerate after loading PHY 264 + * driver. 265 + */ 266 + schedule_delayed_work(&ddata->detect_work, 267 + msecs_to_jiffies(1000)); 268 + 269 + return; 270 + } 271 + 272 + if (s.id_ground && !ddata->docked) { 273 + dev_dbg(ddata->dev, "id ground, USB host mode\n"); 274 + 275 + ddata->vbus_provider = true; 276 + 277 + error = cpcap_usb_set_usb_mode(ddata); 245 278 if (error) 246 279 goto out_err; 280 + 281 + cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); 247 282 248 283 error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3, 249 284 CPCAP_BIT_VBUSSTBY_EN | ··· 313 248 314 249 vbus = cpcap_usb_vbus_valid(ddata); 315 250 251 + /* Otherwise assume we're connected to a USB host */ 316 252 if (vbus) { 317 - /* Are we connected to a docking station with vbus? */ 318 - if (s.id_ground) { 319 - dev_dbg(ddata->dev, "connected to a dock\n"); 320 - 321 - /* No VBUS needed with docks */ 322 - error = cpcap_usb_set_usb_mode(ddata); 323 - if (error) 324 - goto out_err; 325 - error = musb_mailbox(MUSB_ID_GROUND); 326 - if (error) 327 - goto out_err; 328 - 329 - return; 330 - } 331 - 332 - /* Otherwise assume we're connected to a USB host */ 333 253 dev_dbg(ddata->dev, "connected to USB host\n"); 334 254 error = cpcap_usb_set_usb_mode(ddata); 335 255 if (error) 336 256 goto out_err; 337 - error = musb_mailbox(MUSB_VBUS_VALID); 338 - if (error) 339 - goto out_err; 257 + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_VALID); 340 258 341 259 return; 342 260 } 343 261 262 + ddata->vbus_provider = false; 263 + ddata->docked = false; 264 + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); 265 + 344 266 /* Default to debug UART mode */ 345 267 error = cpcap_usb_set_uart_mode(ddata); 346 - if (error) 347 - goto out_err; 348 - 349 - error = musb_mailbox(MUSB_VBUS_OFF); 350 268 if (error) 351 269 goto out_err; 352 270 ··· 424 376 { 425 377 int error; 426 378 427 - error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); 379 + /* Disable lines to prevent glitches from waking up mdm6600 */ 380 + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); 428 381 if (error) 429 382 goto out_err; 430 383 ··· 452 403 if (error) 453 404 goto out_err; 454 405 406 + /* Enable UART mode */ 407 + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); 408 + if (error) 409 + goto out_err; 410 + 455 411 return 0; 456 412 457 413 out_err: ··· 469 415 { 470 416 int error; 471 417 472 - error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); 418 + /* Disable lines to prevent glitches from waking up mdm6600 */ 419 + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); 473 420 if (error) 474 421 return error; 475 422 ··· 489 434 if (error) 490 435 goto out_err; 491 436 492 - error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC2, 493 - CPCAP_BIT_USBXCVREN, 494 - CPCAP_BIT_USBXCVREN); 495 - if (error) 496 - goto out_err; 497 - 498 437 error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3, 499 438 CPCAP_BIT_PU_SPI | 500 439 CPCAP_BIT_DMPD_SPI | ··· 501 452 error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC2, 502 453 CPCAP_BIT_USBXCVREN, 503 454 CPCAP_BIT_USBXCVREN); 455 + if (error) 456 + goto out_err; 457 + 458 + /* Enable USB mode */ 459 + error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); 504 460 if (error) 505 461 goto out_err; 506 462 ··· 703 649 if (error) 704 650 dev_err(ddata->dev, "could not set UART mode\n"); 705 651 706 - error = musb_mailbox(MUSB_VBUS_OFF); 707 - if (error) 708 - dev_err(ddata->dev, "could not set mailbox\n"); 652 + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); 709 653 710 654 usb_remove_phy(&ddata->phy); 711 655 cancel_delayed_work_sync(&ddata->detect_work);
+3 -8
drivers/phy/motorola/phy-mapphone-mdm6600.c
··· 200 200 struct phy_mdm6600 *ddata; 201 201 struct device *dev; 202 202 DECLARE_BITMAP(values, PHY_MDM6600_NR_STATUS_LINES); 203 - int error, i, val = 0; 203 + int error; 204 204 205 205 ddata = container_of(work, struct phy_mdm6600, status_work.work); 206 206 dev = ddata->dev; ··· 212 212 if (error) 213 213 return; 214 214 215 - for (i = 0; i < PHY_MDM6600_NR_STATUS_LINES; i++) { 216 - val |= test_bit(i, values) << i; 217 - dev_dbg(ddata->dev, "XXX %s: i: %i values[i]: %i val: %i\n", 218 - __func__, i, test_bit(i, values), val); 219 - } 220 - ddata->status = values[0]; 215 + ddata->status = values[0] & ((1 << PHY_MDM6600_NR_STATUS_LINES) - 1); 221 216 222 217 dev_info(dev, "modem status: %i %s\n", 223 218 ddata->status, 224 - phy_mdm6600_status_name[ddata->status & 7]); 219 + phy_mdm6600_status_name[ddata->status]); 225 220 complete(&ddata->ack); 226 221 } 227 222
+1 -1
drivers/phy/qualcomm/phy-qcom-qmp.c
··· 66 66 /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ 67 67 #define CLAMP_EN BIT(0) /* enables i/o clamp_n */ 68 68 69 - #define PHY_INIT_COMPLETE_TIMEOUT 1000 69 + #define PHY_INIT_COMPLETE_TIMEOUT 10000 70 70 #define POWER_DOWN_DELAY_US_MIN 10 71 71 #define POWER_DOWN_DELAY_US_MAX 11 72 72
+4
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
··· 603 603 { 604 604 const struct pre_pll_config *cfg = pre_pll_cfg_table; 605 605 606 + rate = (rate / 1000) * 1000; 607 + 606 608 for (; cfg->pixclock != 0; cfg++) 607 609 if (cfg->pixclock == rate && !cfg->fracdiv) 608 610 break; ··· 756 754 unsigned long *parent_rate) 757 755 { 758 756 const struct pre_pll_config *cfg = pre_pll_cfg_table; 757 + 758 + rate = (rate / 1000) * 1000; 759 759 760 760 for (; cfg->pixclock != 0; cfg++) 761 761 if (cfg->pixclock == rate)
+5 -9
drivers/usb/cdns3/gadget.c
··· 1375 1375 */ 1376 1376 static irqreturn_t cdns3_device_irq_handler(int irq, void *data) 1377 1377 { 1378 - struct cdns3_device *priv_dev; 1379 - struct cdns3 *cdns = data; 1378 + struct cdns3_device *priv_dev = data; 1380 1379 irqreturn_t ret = IRQ_NONE; 1381 1380 u32 reg; 1382 - 1383 - priv_dev = cdns->gadget_dev; 1384 1381 1385 1382 /* check USB device interrupt */ 1386 1383 reg = readl(&priv_dev->regs->usb_ists); ··· 1416 1419 */ 1417 1420 static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data) 1418 1421 { 1419 - struct cdns3_device *priv_dev; 1420 - struct cdns3 *cdns = data; 1422 + struct cdns3_device *priv_dev = data; 1421 1423 irqreturn_t ret = IRQ_NONE; 1422 1424 unsigned long flags; 1423 1425 int bit; 1424 1426 u32 reg; 1425 1427 1426 - priv_dev = cdns->gadget_dev; 1427 1428 spin_lock_irqsave(&priv_dev->lock, flags); 1428 1429 1429 1430 reg = readl(&priv_dev->regs->usb_ists); ··· 2534 2539 2535 2540 priv_dev = cdns->gadget_dev; 2536 2541 2537 - devm_free_irq(cdns->dev, cdns->dev_irq, cdns); 2542 + devm_free_irq(cdns->dev, cdns->dev_irq, priv_dev); 2538 2543 2539 2544 pm_runtime_mark_last_busy(cdns->dev); 2540 2545 pm_runtime_put_autosuspend(cdns->dev); ··· 2705 2710 ret = devm_request_threaded_irq(cdns->dev, cdns->dev_irq, 2706 2711 cdns3_device_irq_handler, 2707 2712 cdns3_device_thread_irq_handler, 2708 - IRQF_SHARED, dev_name(cdns->dev), cdns); 2713 + IRQF_SHARED, dev_name(cdns->dev), 2714 + cdns->gadget_dev); 2709 2715 2710 2716 if (ret) 2711 2717 goto err0;
+3 -1
drivers/usb/chipidea/host.c
··· 26 26 27 27 struct ehci_ci_priv { 28 28 struct regulator *reg_vbus; 29 + bool enabled; 29 30 }; 30 31 31 32 static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) ··· 38 37 int ret = 0; 39 38 int port = HCS_N_PORTS(ehci->hcs_params); 40 39 41 - if (priv->reg_vbus) { 40 + if (priv->reg_vbus && enable != priv->enabled) { 42 41 if (port > 1) { 43 42 dev_warn(dev, 44 43 "Not support multi-port regulator control\n"); ··· 54 53 enable ? "enable" : "disable", ret); 55 54 return ret; 56 55 } 56 + priv->enabled = enable; 57 57 } 58 58 59 59 if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
+66 -16
drivers/usb/core/config.c
··· 203 203 [USB_ENDPOINT_XFER_INT] = 1024, 204 204 }; 205 205 206 - static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, 207 - int asnum, struct usb_host_interface *ifp, int num_ep, 208 - unsigned char *buffer, int size) 206 + static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1, 207 + struct usb_endpoint_descriptor *e2) 208 + { 209 + if (e1->bEndpointAddress == e2->bEndpointAddress) 210 + return true; 211 + 212 + if (usb_endpoint_xfer_control(e1) || usb_endpoint_xfer_control(e2)) { 213 + if (usb_endpoint_num(e1) == usb_endpoint_num(e2)) 214 + return true; 215 + } 216 + 217 + return false; 218 + } 219 + 220 + /* 221 + * Check for duplicate endpoint addresses in other interfaces and in the 222 + * altsetting currently being parsed. 223 + */ 224 + static bool config_endpoint_is_duplicate(struct usb_host_config *config, 225 + int inum, int asnum, struct usb_endpoint_descriptor *d) 226 + { 227 + struct usb_endpoint_descriptor *epd; 228 + struct usb_interface_cache *intfc; 229 + struct usb_host_interface *alt; 230 + int i, j, k; 231 + 232 + for (i = 0; i < config->desc.bNumInterfaces; ++i) { 233 + intfc = config->intf_cache[i]; 234 + 235 + for (j = 0; j < intfc->num_altsetting; ++j) { 236 + alt = &intfc->altsetting[j]; 237 + 238 + if (alt->desc.bInterfaceNumber == inum && 239 + alt->desc.bAlternateSetting != asnum) 240 + continue; 241 + 242 + for (k = 0; k < alt->desc.bNumEndpoints; ++k) { 243 + epd = &alt->endpoint[k].desc; 244 + 245 + if (endpoint_is_duplicate(epd, d)) 246 + return true; 247 + } 248 + } 249 + } 250 + 251 + return false; 252 + } 253 + 254 + static int usb_parse_endpoint(struct device *ddev, int cfgno, 255 + struct usb_host_config *config, int inum, int asnum, 256 + struct usb_host_interface *ifp, int num_ep, 257 + unsigned char *buffer, int size) 209 258 { 210 259 unsigned char *buffer0 = buffer; 211 260 struct usb_endpoint_descriptor *d; ··· 291 242 goto skip_to_next_endpoint_or_interface_descriptor; 292 243 293 244 /* Check for duplicate endpoint addresses */ 294 - for (i = 0; i < ifp->desc.bNumEndpoints; ++i) { 295 - if (ifp->endpoint[i].desc.bEndpointAddress == 296 - d->bEndpointAddress) { 297 - dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", 298 - cfgno, inum, asnum, d->bEndpointAddress); 299 - goto skip_to_next_endpoint_or_interface_descriptor; 300 - } 245 + if (config_endpoint_is_duplicate(config, inum, asnum, d)) { 246 + dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", 247 + cfgno, inum, asnum, d->bEndpointAddress); 248 + goto skip_to_next_endpoint_or_interface_descriptor; 301 249 } 302 250 303 251 endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; ··· 392 346 endpoint->desc.wMaxPacketSize = cpu_to_le16(8); 393 347 } 394 348 395 - /* Validate the wMaxPacketSize field */ 349 + /* 350 + * Validate the wMaxPacketSize field. 351 + * Some devices have isochronous endpoints in altsetting 0; 352 + * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 353 + * (see the end of section 5.6.3), so don't warn about them. 354 + */ 396 355 maxp = usb_endpoint_maxp(&endpoint->desc); 397 - if (maxp == 0) { 398 - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n", 356 + if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { 357 + dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", 399 358 cfgno, inum, asnum, d->bEndpointAddress); 400 - goto skip_to_next_endpoint_or_interface_descriptor; 401 359 } 402 360 403 361 /* Find the highest legal maxpacket size for this endpoint */ ··· 572 522 if (((struct usb_descriptor_header *) buffer)->bDescriptorType 573 523 == USB_DT_INTERFACE) 574 524 break; 575 - retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt, 576 - num_ep, buffer, size); 525 + retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum, 526 + alt, num_ep, buffer, size); 577 527 if (retval < 0) 578 528 return retval; 579 529 ++n;
+1 -1
drivers/usb/core/hub.c
··· 2692 2692 #define SET_ADDRESS_TRIES 2 2693 2693 #define GET_DESCRIPTOR_TRIES 2 2694 2694 #define SET_CONFIG_TRIES (2 * (use_both_schemes + 1)) 2695 - #define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)scheme) 2695 + #define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)(scheme)) 2696 2696 2697 2697 #define HUB_ROOT_RESET_TIME 60 /* times are in msec */ 2698 2698 #define HUB_SHORT_RESET_TIME 10
+7
drivers/usb/dwc3/gadget.c
··· 2467 2467 2468 2468 static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) 2469 2469 { 2470 + /* 2471 + * For OUT direction, host may send less than the setup 2472 + * length. Return true for all OUT requests. 2473 + */ 2474 + if (!req->direction) 2475 + return true; 2476 + 2470 2477 return req->request.actual == req->request.length; 2471 2478 } 2472 2479
+1
drivers/usb/gadget/udc/Kconfig
··· 445 445 tristate "NVIDIA Tegra Superspeed USB 3.0 Device Controller" 446 446 depends on ARCH_TEGRA || COMPILE_TEST 447 447 depends on PHY_TEGRA_XUSB 448 + select USB_ROLE_SWITCH 448 449 help 449 450 Enables NVIDIA Tegra USB 3.0 device mode controller driver. 450 451
+6 -2
drivers/usb/host/ohci-da8xx.c
··· 415 415 } 416 416 417 417 da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN); 418 - if (IS_ERR(da8xx_ohci->oc_gpio)) 418 + if (IS_ERR(da8xx_ohci->oc_gpio)) { 419 + error = PTR_ERR(da8xx_ohci->oc_gpio); 419 420 goto err; 421 + } 420 422 421 423 if (da8xx_ohci->oc_gpio) { 422 424 oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio); 423 - if (oc_irq < 0) 425 + if (oc_irq < 0) { 426 + error = oc_irq; 424 427 goto err; 428 + } 425 429 426 430 error = devm_request_threaded_irq(dev, oc_irq, NULL, 427 431 ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING |
+5 -2
drivers/usb/musb/jz4740.c
··· 75 75 static int jz4740_musb_init(struct musb *musb) 76 76 { 77 77 struct device *dev = musb->controller->parent; 78 + int err; 78 79 79 80 if (dev->of_node) 80 81 musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0); 81 82 else 82 83 musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); 83 84 if (IS_ERR(musb->xceiv)) { 84 - dev_err(dev, "No transceiver configured\n"); 85 - return PTR_ERR(musb->xceiv); 85 + err = PTR_ERR(musb->xceiv); 86 + if (err != -EPROBE_DEFER) 87 + dev_err(dev, "No transceiver configured: %d", err); 88 + return err; 86 89 } 87 90 88 91 /* Silicon does not implement ConfigData register.
+11
drivers/usb/musb/musb_core.c
··· 1840 1840 #define MUSB_QUIRK_B_INVALID_VBUS_91 (MUSB_DEVCTL_BDEVICE | \ 1841 1841 (2 << MUSB_DEVCTL_VBUS_SHIFT) | \ 1842 1842 MUSB_DEVCTL_SESSION) 1843 + #define MUSB_QUIRK_B_DISCONNECT_99 (MUSB_DEVCTL_BDEVICE | \ 1844 + (3 << MUSB_DEVCTL_VBUS_SHIFT) | \ 1845 + MUSB_DEVCTL_SESSION) 1843 1846 #define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \ 1844 1847 MUSB_DEVCTL_SESSION) 1845 1848 ··· 1865 1862 s = MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV | 1866 1863 MUSB_DEVCTL_HR; 1867 1864 switch (devctl & ~s) { 1865 + case MUSB_QUIRK_B_DISCONNECT_99: 1866 + musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n"); 1867 + schedule_delayed_work(&musb->irq_work, 1868 + msecs_to_jiffies(1000)); 1869 + break; 1868 1870 case MUSB_QUIRK_B_INVALID_VBUS_91: 1869 1871 if (musb->quirk_retries && !musb->flush_irq_work) { 1870 1872 musb_dbg(musb, ··· 2317 2309 musb_platform_disable(musb); 2318 2310 musb_disable_interrupts(musb); 2319 2311 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); 2312 + 2313 + /* MUSB_POWER_SOFTCONN might be already set, JZ4740 does this. */ 2314 + musb_writeb(musb->mregs, MUSB_POWER, 0); 2320 2315 2321 2316 /* Init IRQ workqueue before request_irq */ 2322 2317 INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work);
+1 -1
drivers/usb/musb/musbhsdma.c
··· 425 425 controller->controller.channel_abort = dma_channel_abort; 426 426 427 427 if (request_irq(irq, dma_controller_irq, 0, 428 - dev_name(musb->controller), &controller->controller)) { 428 + dev_name(musb->controller), controller)) { 429 429 dev_err(dev, "request_irq %d failed!\n", irq); 430 430 musb_dma_controller_destroy(&controller->controller); 431 431
+10
drivers/usb/serial/option.c
··· 567 567 /* Interface must have two endpoints */ 568 568 #define NUMEP2 BIT(16) 569 569 570 + /* Device needs ZLP */ 571 + #define ZLP BIT(17) 572 + 570 573 571 574 static const struct usb_device_id option_ids[] = { 572 575 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, ··· 1175 1172 .driver_info = NCTRL(0) | RSVD(3) }, 1176 1173 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */ 1177 1174 .driver_info = NCTRL(0) }, 1175 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */ 1176 + .driver_info = NCTRL(0) | RSVD(3) }, 1178 1177 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), 1179 1178 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, 1180 1179 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), ··· 1201 1196 .driver_info = NCTRL(0) | RSVD(1) }, 1202 1197 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ 1203 1198 .driver_info = NCTRL(0) }, 1199 + { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ 1200 + .driver_info = NCTRL(0) | ZLP }, 1204 1201 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ 1205 1202 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), 1206 1203 .driver_info = RSVD(1) }, ··· 2103 2096 2104 2097 if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber))) 2105 2098 data->use_send_setup = 1; 2099 + 2100 + if (device_flags & ZLP) 2101 + data->use_zlp = 1; 2106 2102 2107 2103 spin_lock_init(&data->susp_lock); 2108 2104
+1
drivers/usb/serial/usb-wwan.h
··· 38 38 spinlock_t susp_lock; 39 39 unsigned int suspended:1; 40 40 unsigned int use_send_setup:1; 41 + unsigned int use_zlp:1; 41 42 int in_flight; 42 43 unsigned int open_ports; 43 44 void *private;
+4
drivers/usb/serial/usb_wwan.c
··· 461 461 void (*callback) (struct urb *)) 462 462 { 463 463 struct usb_serial *serial = port->serial; 464 + struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); 464 465 struct urb *urb; 465 466 466 467 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ ··· 471 470 usb_fill_bulk_urb(urb, serial->dev, 472 471 usb_sndbulkpipe(serial->dev, endpoint) | dir, 473 472 buf, len, callback, ctx); 473 + 474 + if (intfdata->use_zlp && dir == USB_DIR_OUT) 475 + urb->transfer_flags |= URB_ZERO_PACKET; 474 476 475 477 return urb; 476 478 }
+15 -5
drivers/usb/typec/tcpm/tcpci.c
··· 432 432 433 433 if (status & TCPC_ALERT_RX_STATUS) { 434 434 struct pd_message msg; 435 - unsigned int cnt; 435 + unsigned int cnt, payload_cnt; 436 436 u16 header; 437 437 438 438 regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); 439 + /* 440 + * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14 441 + * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is 442 + * defined in table 4-36 as one greater than the number of 443 + * bytes received. And that number includes the header. So: 444 + */ 445 + if (cnt > 3) 446 + payload_cnt = cnt - (1 + sizeof(msg.header)); 447 + else 448 + payload_cnt = 0; 439 449 440 450 tcpci_read16(tcpci, TCPC_RX_HDR, &header); 441 451 msg.header = cpu_to_le16(header); 442 452 443 - if (WARN_ON(cnt > sizeof(msg.payload))) 444 - cnt = sizeof(msg.payload); 453 + if (WARN_ON(payload_cnt > sizeof(msg.payload))) 454 + payload_cnt = sizeof(msg.payload); 445 455 446 - if (cnt > 0) 456 + if (payload_cnt > 0) 447 457 regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, 448 - &msg.payload, cnt); 458 + &msg.payload, payload_cnt); 449 459 450 460 /* Read complete, clear RX status alert bit */ 451 461 tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS);
+9 -9
drivers/usb/typec/ucsi/ucsi.h
··· 94 94 #define UCSI_ENABLE_NTFY_CMD_COMPLETE BIT(16) 95 95 #define UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE BIT(17) 96 96 #define UCSI_ENABLE_NTFY_PWR_OPMODE_CHANGE BIT(18) 97 - #define UCSI_ENABLE_NTFY_CAP_CHANGE BIT(19) 98 - #define UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE BIT(20) 99 - #define UCSI_ENABLE_NTFY_PD_RESET_COMPLETE BIT(21) 100 - #define UCSI_ENABLE_NTFY_CAM_CHANGE BIT(22) 101 - #define UCSI_ENABLE_NTFY_BAT_STATUS_CHANGE BIT(23) 102 - #define UCSI_ENABLE_NTFY_PARTNER_CHANGE BIT(24) 103 - #define UCSI_ENABLE_NTFY_PWR_DIR_CHANGE BIT(25) 104 - #define UCSI_ENABLE_NTFY_CONNECTOR_CHANGE BIT(26) 105 - #define UCSI_ENABLE_NTFY_ERROR BIT(27) 97 + #define UCSI_ENABLE_NTFY_CAP_CHANGE BIT(21) 98 + #define UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE BIT(22) 99 + #define UCSI_ENABLE_NTFY_PD_RESET_COMPLETE BIT(23) 100 + #define UCSI_ENABLE_NTFY_CAM_CHANGE BIT(24) 101 + #define UCSI_ENABLE_NTFY_BAT_STATUS_CHANGE BIT(25) 102 + #define UCSI_ENABLE_NTFY_PARTNER_CHANGE BIT(27) 103 + #define UCSI_ENABLE_NTFY_PWR_DIR_CHANGE BIT(28) 104 + #define UCSI_ENABLE_NTFY_CONNECTOR_CHANGE BIT(30) 105 + #define UCSI_ENABLE_NTFY_ERROR BIT(31) 106 106 #define UCSI_ENABLE_NTFY_ALL 0xdbe70000 107 107 108 108 /* SET_UOR command bits */