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

Pull USB / Thunderbolt fixes from Greg KH:
"Here are some USB and Thunderbolt driver fixes for 6.6-rc6 to resolve
a number of small reported issues. Included in here are:

- thunderbolt driver fixes

- xhci driver fixes

- cdns3 driver fixes

- musb driver fixes

- a number of typec driver fixes

- a few other small driver fixes

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

* tag 'usb-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits)
usb: typec: ucsi: Use GET_CAPABILITY attributes data to set power supply scope
usb: typec: ucsi: Fix missing link removal
usb: typec: altmodes/displayport: Signal hpd low when exiting mode
xhci: Preserve RsvdP bits in ERSTBA register correctly
xhci: Clear EHB bit only at end of interrupt handler
xhci: track port suspend state correctly in unsuccessful resume cases
usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
usb: typec: ucsi: Clear EVENT_PENDING bit if ucsi_send_command fails
usb: misc: onboard_hub: add support for Microchip USB2412 USB 2.0 hub
usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
usb: cdns3: Modify the return value of cdns_set_active () to void when CONFIG_PM_SLEEP is disabled
usb: dwc3: Soft reset phy on probe for host
usb: hub: Guard against accesses to uninitialized BOS descriptors
usb: typec: qcom: Update the logic of regulator enable and disable
usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call
usb: musb: Get the musb_qh poniter after musb_giveback
usb: musb: Modify the "HWVers" register address
usb: cdnsp: Fixes issue with dequeuing not queued requests
thunderbolt: Restart XDomain discovery handshake after failure
thunderbolt: Correct TMU mode initialization from hardware
...

+220 -87
+20 -20
drivers/thunderbolt/icm.c
··· 41 41 #define PHY_PORT_CS1_LINK_STATE_SHIFT 26 42 42 43 43 #define ICM_TIMEOUT 5000 /* ms */ 44 + #define ICM_RETRIES 3 44 45 #define ICM_APPROVE_TIMEOUT 10000 /* ms */ 45 46 #define ICM_MAX_LINK 4 46 47 ··· 297 296 298 297 static int icm_request(struct tb *tb, const void *request, size_t request_size, 299 298 void *response, size_t response_size, size_t npackets, 300 - unsigned int timeout_msec) 299 + int retries, unsigned int timeout_msec) 301 300 { 302 301 struct icm *icm = tb_priv(tb); 303 - int retries = 3; 304 302 305 303 do { 306 304 struct tb_cfg_request *req; ··· 410 410 return -ENOMEM; 411 411 412 412 ret = icm_request(tb, &request, sizeof(request), switches, 413 - sizeof(*switches), npackets, ICM_TIMEOUT); 413 + sizeof(*switches), npackets, ICM_RETRIES, ICM_TIMEOUT); 414 414 if (ret) 415 415 goto err_free; 416 416 ··· 463 463 464 464 memset(&reply, 0, sizeof(reply)); 465 465 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 466 - 1, ICM_TIMEOUT); 466 + 1, ICM_RETRIES, ICM_TIMEOUT); 467 467 if (ret) 468 468 return ret; 469 469 ··· 488 488 memset(&reply, 0, sizeof(reply)); 489 489 /* Use larger timeout as establishing tunnels can take some time */ 490 490 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 491 - 1, ICM_APPROVE_TIMEOUT); 491 + 1, ICM_RETRIES, ICM_APPROVE_TIMEOUT); 492 492 if (ret) 493 493 return ret; 494 494 ··· 515 515 516 516 memset(&reply, 0, sizeof(reply)); 517 517 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 518 - 1, ICM_TIMEOUT); 518 + 1, ICM_RETRIES, ICM_TIMEOUT); 519 519 if (ret) 520 520 return ret; 521 521 ··· 543 543 544 544 memset(&reply, 0, sizeof(reply)); 545 545 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 546 - 1, ICM_TIMEOUT); 546 + 1, ICM_RETRIES, ICM_TIMEOUT); 547 547 if (ret) 548 548 return ret; 549 549 ··· 577 577 578 578 memset(&reply, 0, sizeof(reply)); 579 579 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 580 - 1, ICM_TIMEOUT); 580 + 1, ICM_RETRIES, ICM_TIMEOUT); 581 581 if (ret) 582 582 return ret; 583 583 ··· 1020 1020 1021 1021 memset(&reply, 0, sizeof(reply)); 1022 1022 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1023 - 1, 20000); 1023 + 1, 10, 2000); 1024 1024 if (ret) 1025 1025 return ret; 1026 1026 ··· 1053 1053 1054 1054 memset(&reply, 0, sizeof(reply)); 1055 1055 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1056 - 1, ICM_APPROVE_TIMEOUT); 1056 + 1, ICM_RETRIES, ICM_APPROVE_TIMEOUT); 1057 1057 if (ret) 1058 1058 return ret; 1059 1059 ··· 1081 1081 1082 1082 memset(&reply, 0, sizeof(reply)); 1083 1083 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1084 - 1, ICM_TIMEOUT); 1084 + 1, ICM_RETRIES, ICM_TIMEOUT); 1085 1085 if (ret) 1086 1086 return ret; 1087 1087 ··· 1110 1110 1111 1111 memset(&reply, 0, sizeof(reply)); 1112 1112 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1113 - 1, ICM_TIMEOUT); 1113 + 1, ICM_RETRIES, ICM_TIMEOUT); 1114 1114 if (ret) 1115 1115 return ret; 1116 1116 ··· 1144 1144 1145 1145 memset(&reply, 0, sizeof(reply)); 1146 1146 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1147 - 1, ICM_TIMEOUT); 1147 + 1, ICM_RETRIES, ICM_TIMEOUT); 1148 1148 if (ret) 1149 1149 return ret; 1150 1150 ··· 1170 1170 1171 1171 memset(&reply, 0, sizeof(reply)); 1172 1172 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1173 - 1, ICM_TIMEOUT); 1173 + 1, ICM_RETRIES, ICM_TIMEOUT); 1174 1174 if (ret) 1175 1175 return ret; 1176 1176 ··· 1496 1496 1497 1497 memset(&reply, 0, sizeof(reply)); 1498 1498 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1499 - 1, ICM_TIMEOUT); 1499 + 1, ICM_RETRIES, ICM_TIMEOUT); 1500 1500 if (ret) 1501 1501 return ret; 1502 1502 ··· 1522 1522 1523 1523 memset(&reply, 0, sizeof(reply)); 1524 1524 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1525 - 1, ICM_TIMEOUT); 1525 + 1, ICM_RETRIES, ICM_TIMEOUT); 1526 1526 if (ret) 1527 1527 return ret; 1528 1528 ··· 1543 1543 1544 1544 memset(&reply, 0, sizeof(reply)); 1545 1545 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1546 - 1, ICM_TIMEOUT); 1546 + 1, ICM_RETRIES, ICM_TIMEOUT); 1547 1547 if (ret) 1548 1548 return ret; 1549 1549 ··· 1604 1604 1605 1605 memset(&reply, 0, sizeof(reply)); 1606 1606 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1607 - 1, ICM_TIMEOUT); 1607 + 1, ICM_RETRIES, ICM_TIMEOUT); 1608 1608 if (ret) 1609 1609 return ret; 1610 1610 ··· 1626 1626 1627 1627 memset(&reply, 0, sizeof(reply)); 1628 1628 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 1629 - 1, 20000); 1629 + 1, ICM_RETRIES, 20000); 1630 1630 if (ret) 1631 1631 return ret; 1632 1632 ··· 2298 2298 2299 2299 memset(&reply, 0, sizeof(reply)); 2300 2300 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply), 2301 - 1, ICM_TIMEOUT); 2301 + 1, ICM_RETRIES, ICM_TIMEOUT); 2302 2302 if (ret) 2303 2303 return ret; 2304 2304
+7
drivers/thunderbolt/switch.c
··· 2725 2725 !tb_port_is_width_supported(down, TB_LINK_WIDTH_DUAL)) 2726 2726 return 0; 2727 2727 2728 + /* 2729 + * Both lanes need to be in CL0. Here we assume lane 0 already be in 2730 + * CL0 and check just for lane 1. 2731 + */ 2732 + if (tb_wait_for_port(down->dual_link_port, false) <= 0) 2733 + return -ENOTCONN; 2734 + 2728 2735 ret = tb_port_lane_bonding_enable(up); 2729 2736 if (ret) { 2730 2737 tb_port_warn(up, "failed to enable lane bonding\n");
+1 -1
drivers/thunderbolt/tmu.c
··· 382 382 } else if (ucap && tb_port_tmu_is_unidirectional(up)) { 383 383 if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate) 384 384 sw->tmu.mode = TB_SWITCH_TMU_MODE_LOWRES; 385 - else if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate) 385 + else if (tmu_rates[TB_SWITCH_TMU_MODE_HIFI_UNI] == rate) 386 386 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI; 387 387 } else if (rate) { 388 388 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_BI;
+41 -17
drivers/thunderbolt/xdomain.c
··· 703 703 mutex_unlock(&xdomain_lock); 704 704 } 705 705 706 + static void start_handshake(struct tb_xdomain *xd) 707 + { 708 + xd->state = XDOMAIN_STATE_INIT; 709 + queue_delayed_work(xd->tb->wq, &xd->state_work, 710 + msecs_to_jiffies(XDOMAIN_SHORT_TIMEOUT)); 711 + } 712 + 713 + /* Can be called from state_work */ 714 + static void __stop_handshake(struct tb_xdomain *xd) 715 + { 716 + cancel_delayed_work_sync(&xd->properties_changed_work); 717 + xd->properties_changed_retries = 0; 718 + xd->state_retries = 0; 719 + } 720 + 721 + static void stop_handshake(struct tb_xdomain *xd) 722 + { 723 + cancel_delayed_work_sync(&xd->state_work); 724 + __stop_handshake(xd); 725 + } 726 + 706 727 static void tb_xdp_handle_request(struct work_struct *work) 707 728 { 708 729 struct xdomain_request_work *xw = container_of(work, typeof(*xw), work); ··· 786 765 case UUID_REQUEST: 787 766 tb_dbg(tb, "%llx: received XDomain UUID request\n", route); 788 767 ret = tb_xdp_uuid_response(ctl, route, sequence, uuid); 768 + /* 769 + * If we've stopped the discovery with an error such as 770 + * timing out, we will restart the handshake now that we 771 + * received UUID request from the remote host. 772 + */ 773 + if (!ret && xd && xd->state == XDOMAIN_STATE_ERROR) { 774 + dev_dbg(&xd->dev, "restarting handshake\n"); 775 + start_handshake(xd); 776 + } 789 777 break; 790 778 791 779 case LINK_STATE_STATUS_REQUEST: ··· 1551 1521 msecs_to_jiffies(XDOMAIN_SHORT_TIMEOUT)); 1552 1522 } 1553 1523 1524 + static void tb_xdomain_failed(struct tb_xdomain *xd) 1525 + { 1526 + xd->state = XDOMAIN_STATE_ERROR; 1527 + queue_delayed_work(xd->tb->wq, &xd->state_work, 1528 + msecs_to_jiffies(XDOMAIN_DEFAULT_TIMEOUT)); 1529 + } 1530 + 1554 1531 static void tb_xdomain_state_work(struct work_struct *work) 1555 1532 { 1556 1533 struct tb_xdomain *xd = container_of(work, typeof(*xd), state_work.work); ··· 1584 1547 if (ret) { 1585 1548 if (ret == -EAGAIN) 1586 1549 goto retry_state; 1587 - xd->state = XDOMAIN_STATE_ERROR; 1550 + tb_xdomain_failed(xd); 1588 1551 } else { 1589 1552 tb_xdomain_queue_properties_changed(xd); 1590 1553 if (xd->bonding_possible) ··· 1649 1612 if (ret) { 1650 1613 if (ret == -EAGAIN) 1651 1614 goto retry_state; 1652 - xd->state = XDOMAIN_STATE_ERROR; 1615 + tb_xdomain_failed(xd); 1653 1616 } else { 1654 1617 xd->state = XDOMAIN_STATE_ENUMERATED; 1655 1618 } ··· 1660 1623 break; 1661 1624 1662 1625 case XDOMAIN_STATE_ERROR: 1626 + dev_dbg(&xd->dev, "discovery failed, stopping handshake\n"); 1627 + __stop_handshake(xd); 1663 1628 break; 1664 1629 1665 1630 default: ··· 1870 1831 kfree(xd->device_name); 1871 1832 kfree(xd->vendor_name); 1872 1833 kfree(xd); 1873 - } 1874 - 1875 - static void start_handshake(struct tb_xdomain *xd) 1876 - { 1877 - xd->state = XDOMAIN_STATE_INIT; 1878 - queue_delayed_work(xd->tb->wq, &xd->state_work, 1879 - msecs_to_jiffies(XDOMAIN_SHORT_TIMEOUT)); 1880 - } 1881 - 1882 - static void stop_handshake(struct tb_xdomain *xd) 1883 - { 1884 - cancel_delayed_work_sync(&xd->properties_changed_work); 1885 - cancel_delayed_work_sync(&xd->state_work); 1886 - xd->properties_changed_retries = 0; 1887 - xd->state_retries = 0; 1888 1834 } 1889 1835 1890 1836 static int __maybe_unused tb_xdomain_suspend(struct device *dev)
+3
drivers/usb/cdns3/cdnsp-gadget.c
··· 1125 1125 unsigned long flags; 1126 1126 int ret; 1127 1127 1128 + if (request->status != -EINPROGRESS) 1129 + return 0; 1130 + 1128 1131 if (!pep->endpoint.desc) { 1129 1132 dev_err(pdev->dev, 1130 1133 "%s: can't dequeue to disabled endpoint\n",
+1 -2
drivers/usb/cdns3/core.h
··· 131 131 #else /* CONFIG_PM_SLEEP */ 132 132 static inline int cdns_resume(struct cdns *cdns) 133 133 { return 0; } 134 - static inline int cdns_set_active(struct cdns *cdns, u8 set_active) 135 - { return 0; } 134 + static inline void cdns_set_active(struct cdns *cdns, u8 set_active) { } 136 135 static inline int cdns_suspend(struct cdns *cdns) 137 136 { return 0; } 138 137 #endif /* CONFIG_PM_SLEEP */
+22 -3
drivers/usb/core/hub.c
··· 151 151 if (udev->quirks & USB_QUIRK_NO_LPM) 152 152 return 0; 153 153 154 + /* Skip if the device BOS descriptor couldn't be read */ 155 + if (!udev->bos) 156 + return 0; 157 + 154 158 /* USB 2.1 (and greater) devices indicate LPM support through 155 159 * their USB 2.0 Extended Capabilities BOS descriptor. 156 160 */ ··· 329 325 unsigned int hub_u2_del; 330 326 331 327 if (!udev->lpm_capable || udev->speed < USB_SPEED_SUPER) 328 + return; 329 + 330 + /* Skip if the device BOS descriptor couldn't be read */ 331 + if (!udev->bos) 332 332 return; 333 333 334 334 hub = usb_hub_to_struct_hub(udev->parent); ··· 2712 2704 static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev, 2713 2705 u32 ext_portstatus) 2714 2706 { 2715 - struct usb_ssp_cap_descriptor *ssp_cap = hdev->bos->ssp_cap; 2707 + struct usb_ssp_cap_descriptor *ssp_cap; 2716 2708 u32 attr; 2717 2709 u8 speed_id; 2718 2710 u8 ssac; 2719 2711 u8 lanes; 2720 2712 int i; 2721 2713 2714 + if (!hdev->bos) 2715 + goto out; 2716 + 2717 + ssp_cap = hdev->bos->ssp_cap; 2722 2718 if (!ssp_cap) 2723 2719 goto out; 2724 2720 ··· 4227 4215 enum usb3_link_state state) 4228 4216 { 4229 4217 int timeout; 4230 - __u8 u1_mel = udev->bos->ss_cap->bU1devExitLat; 4231 - __le16 u2_mel = udev->bos->ss_cap->bU2DevExitLat; 4218 + __u8 u1_mel; 4219 + __le16 u2_mel; 4220 + 4221 + /* Skip if the device BOS descriptor couldn't be read */ 4222 + if (!udev->bos) 4223 + return; 4224 + 4225 + u1_mel = udev->bos->ss_cap->bU1devExitLat; 4226 + u2_mel = udev->bos->ss_cap->bU2DevExitLat; 4232 4227 4233 4228 /* If the device says it doesn't have *any* exit latency to come out of 4234 4229 * U1 or U2, it's probably lying. Assume it doesn't implement that link
+1 -1
drivers/usb/core/hub.h
··· 153 153 { 154 154 return (hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS && 155 155 le16_to_cpu(hdev->descriptor.bcdUSB) >= 0x0310 && 156 - hdev->bos->ssp_cap); 156 + hdev->bos && hdev->bos->ssp_cap); 157 157 } 158 158 159 159 static inline unsigned hub_power_on_good_delay(struct usb_hub *hub)
+38 -1
drivers/usb/dwc3/core.c
··· 279 279 * XHCI driver will reset the host block. If dwc3 was configured for 280 280 * host-only mode or current role is host, then we can return early. 281 281 */ 282 - if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST) 282 + if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST) 283 283 return 0; 284 + 285 + /* 286 + * If the dr_mode is host and the dwc->current_dr_role is not the 287 + * corresponding DWC3_GCTL_PRTCAP_HOST, then the dwc3_core_init_mode 288 + * isn't executed yet. Ensure the phy is ready before the controller 289 + * updates the GCTL.PRTCAPDIR or other settings by soft-resetting 290 + * the phy. 291 + * 292 + * Note: GUSB3PIPECTL[n] and GUSB2PHYCFG[n] are port settings where n 293 + * is port index. If this is a multiport host, then we need to reset 294 + * all active ports. 295 + */ 296 + if (dwc->dr_mode == USB_DR_MODE_HOST) { 297 + u32 usb3_port; 298 + u32 usb2_port; 299 + 300 + usb3_port = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); 301 + usb3_port |= DWC3_GUSB3PIPECTL_PHYSOFTRST; 302 + dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port); 303 + 304 + usb2_port = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 305 + usb2_port |= DWC3_GUSB2PHYCFG_PHYSOFTRST; 306 + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port); 307 + 308 + /* Small delay for phy reset assertion */ 309 + usleep_range(1000, 2000); 310 + 311 + usb3_port &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST; 312 + dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port); 313 + 314 + usb2_port &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST; 315 + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port); 316 + 317 + /* Wait for clock synchronization */ 318 + msleep(50); 319 + return 0; 320 + } 284 321 285 322 reg = dwc3_readl(dwc->regs, DWC3_DCTL); 286 323 reg |= DWC3_DCTL_CSFTRST;
+19 -7
drivers/usb/gadget/function/f_ncm.c
··· 1156 1156 struct sk_buff_head *list) 1157 1157 { 1158 1158 struct f_ncm *ncm = func_to_ncm(&port->func); 1159 - __le16 *tmp = (void *) skb->data; 1159 + unsigned char *ntb_ptr = skb->data; 1160 + __le16 *tmp; 1160 1161 unsigned index, index2; 1161 1162 int ndp_index; 1162 1163 unsigned dg_len, dg_len2; ··· 1170 1169 const struct ndp_parser_opts *opts = ncm->parser_opts; 1171 1170 unsigned crc_len = ncm->is_crc ? sizeof(uint32_t) : 0; 1172 1171 int dgram_counter; 1172 + int to_process = skb->len; 1173 + 1174 + parse_ntb: 1175 + tmp = (__le16 *)ntb_ptr; 1173 1176 1174 1177 /* dwSignature */ 1175 1178 if (get_unaligned_le32(tmp) != opts->nth_sign) { ··· 1220 1215 * walk through NDP 1221 1216 * dwSignature 1222 1217 */ 1223 - tmp = (void *)(skb->data + ndp_index); 1218 + tmp = (__le16 *)(ntb_ptr + ndp_index); 1224 1219 if (get_unaligned_le32(tmp) != ncm->ndp_sign) { 1225 1220 INFO(port->func.config->cdev, "Wrong NDP SIGN\n"); 1226 1221 goto err; ··· 1277 1272 if (ncm->is_crc) { 1278 1273 uint32_t crc, crc2; 1279 1274 1280 - crc = get_unaligned_le32(skb->data + 1275 + crc = get_unaligned_le32(ntb_ptr + 1281 1276 index + dg_len - 1282 1277 crc_len); 1283 1278 crc2 = ~crc32_le(~0, 1284 - skb->data + index, 1279 + ntb_ptr + index, 1285 1280 dg_len - crc_len); 1286 1281 if (crc != crc2) { 1287 1282 INFO(port->func.config->cdev, ··· 1308 1303 dg_len - crc_len); 1309 1304 if (skb2 == NULL) 1310 1305 goto err; 1311 - skb_put_data(skb2, skb->data + index, 1306 + skb_put_data(skb2, ntb_ptr + index, 1312 1307 dg_len - crc_len); 1313 1308 1314 1309 skb_queue_tail(list, skb2); ··· 1321 1316 } while (ndp_len > 2 * (opts->dgram_item_len * 2)); 1322 1317 } while (ndp_index); 1323 1318 1324 - dev_consume_skb_any(skb); 1325 - 1326 1319 VDBG(port->func.config->cdev, 1327 1320 "Parsed NTB with %d frames\n", dgram_counter); 1321 + 1322 + to_process -= block_len; 1323 + if (to_process != 0) { 1324 + ntb_ptr = (unsigned char *)(ntb_ptr + block_len); 1325 + goto parse_ntb; 1326 + } 1327 + 1328 + dev_consume_skb_any(skb); 1329 + 1328 1330 return 0; 1329 1331 err: 1330 1332 skb_queue_purge(list);
+12 -8
drivers/usb/gadget/udc/udc-xilinx.c
··· 497 497 /* Get the Buffer address and copy the transmit data.*/ 498 498 eprambase = (u32 __force *)(udc->addr + ep->rambase); 499 499 if (ep->is_in) { 500 - memcpy(eprambase, bufferptr, bytestosend); 500 + memcpy_toio((void __iomem *)eprambase, bufferptr, 501 + bytestosend); 501 502 udc->write_fn(udc->addr, ep->offset + 502 503 XUSB_EP_BUF0COUNT_OFFSET, bufferlen); 503 504 } else { 504 - memcpy(bufferptr, eprambase, bytestosend); 505 + memcpy_toio((void __iomem *)bufferptr, eprambase, 506 + bytestosend); 505 507 } 506 508 /* 507 509 * Enable the buffer for transmission. ··· 517 515 eprambase = (u32 __force *)(udc->addr + ep->rambase + 518 516 ep->ep_usb.maxpacket); 519 517 if (ep->is_in) { 520 - memcpy(eprambase, bufferptr, bytestosend); 518 + memcpy_toio((void __iomem *)eprambase, bufferptr, 519 + bytestosend); 521 520 udc->write_fn(udc->addr, ep->offset + 522 521 XUSB_EP_BUF1COUNT_OFFSET, bufferlen); 523 522 } else { 524 - memcpy(bufferptr, eprambase, bytestosend); 523 + memcpy_toio((void __iomem *)bufferptr, eprambase, 524 + bytestosend); 525 525 } 526 526 /* 527 527 * Enable the buffer for transmission. ··· 1025 1021 udc->addr); 1026 1022 length = req->usb_req.actual = min_t(u32, length, 1027 1023 EP0_MAX_PACKET); 1028 - memcpy(corebuf, req->usb_req.buf, length); 1024 + memcpy_toio((void __iomem *)corebuf, req->usb_req.buf, length); 1029 1025 udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length); 1030 1026 udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1); 1031 1027 } else { ··· 1756 1752 1757 1753 /* Load up the chapter 9 command buffer.*/ 1758 1754 ep0rambase = (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET); 1759 - memcpy(&setup, ep0rambase, 8); 1755 + memcpy_toio((void __iomem *)&setup, ep0rambase, 8); 1760 1756 1761 1757 udc->setup = setup; 1762 1758 udc->setup.wValue = cpu_to_le16((u16 __force)setup.wValue); ··· 1843 1839 (ep0->rambase << 2)); 1844 1840 buffer = req->usb_req.buf + req->usb_req.actual; 1845 1841 req->usb_req.actual = req->usb_req.actual + bytes_to_rx; 1846 - memcpy(buffer, ep0rambase, bytes_to_rx); 1842 + memcpy_toio((void __iomem *)buffer, ep0rambase, bytes_to_rx); 1847 1843 1848 1844 if (req->usb_req.length == req->usb_req.actual) { 1849 1845 /* Data transfer completed get ready for Status stage */ ··· 1919 1915 (ep0->rambase << 2)); 1920 1916 buffer = req->usb_req.buf + req->usb_req.actual; 1921 1917 req->usb_req.actual = req->usb_req.actual + length; 1922 - memcpy(ep0rambase, buffer, length); 1918 + memcpy_toio((void __iomem *)ep0rambase, buffer, length); 1923 1919 } 1924 1920 udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count); 1925 1921 udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1);
+10 -9
drivers/usb/host/xhci-hub.c
··· 1062 1062 *status |= USB_PORT_STAT_C_CONFIG_ERROR << 16; 1063 1063 1064 1064 /* USB3 specific wPortStatus bits */ 1065 - if (portsc & PORT_POWER) { 1065 + if (portsc & PORT_POWER) 1066 1066 *status |= USB_SS_PORT_STAT_POWER; 1067 - /* link state handling */ 1068 - if (link_state == XDEV_U0) 1069 - bus_state->suspended_ports &= ~(1 << portnum); 1070 - } 1071 1067 1072 - /* remote wake resume signaling complete */ 1073 - if (bus_state->port_remote_wakeup & (1 << portnum) && 1068 + /* no longer suspended or resuming */ 1069 + if (link_state != XDEV_U3 && 1074 1070 link_state != XDEV_RESUME && 1075 1071 link_state != XDEV_RECOVERY) { 1076 - bus_state->port_remote_wakeup &= ~(1 << portnum); 1077 - usb_hcd_end_port_resume(&hcd->self, portnum); 1072 + /* remote wake resume signaling complete */ 1073 + if (bus_state->port_remote_wakeup & (1 << portnum)) { 1074 + bus_state->port_remote_wakeup &= ~(1 << portnum); 1075 + usb_hcd_end_port_resume(&hcd->self, portnum); 1076 + } 1077 + bus_state->suspended_ports &= ~(1 << portnum); 1078 1078 } 1079 1079 1080 1080 xhci_hub_report_usb3_link_state(xhci, status, portsc); ··· 1131 1131 usb_hcd_end_port_resume(&port->rhub->hcd->self, portnum); 1132 1132 } 1133 1133 port->rexit_active = 0; 1134 + bus_state->suspended_ports &= ~(1 << portnum); 1134 1135 } 1135 1136 } 1136 1137
+2 -2
drivers/usb/host/xhci-mem.c
··· 2285 2285 writel(erst_size, &ir->ir_set->erst_size); 2286 2286 2287 2287 erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); 2288 - erst_base &= ERST_PTR_MASK; 2289 - erst_base |= (ir->erst.erst_dma_addr & (u64) ~ERST_PTR_MASK); 2288 + erst_base &= ERST_BASE_RSVDP; 2289 + erst_base |= ir->erst.erst_dma_addr & ~ERST_BASE_RSVDP; 2290 2290 xhci_write_64(xhci, erst_base, &ir->ir_set->erst_base); 2291 2291 2292 2292 /* Set the event ring dequeue address of this interrupter */
+9 -7
drivers/usb/host/xhci-ring.c
··· 798 798 static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci, 799 799 struct xhci_ring *ring, struct xhci_td *td) 800 800 { 801 - struct device *dev = xhci_to_hcd(xhci)->self.controller; 801 + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; 802 802 struct xhci_segment *seg = td->bounce_seg; 803 803 struct urb *urb = td->urb; 804 804 size_t len; ··· 2996 2996 */ 2997 2997 static void xhci_update_erst_dequeue(struct xhci_hcd *xhci, 2998 2998 struct xhci_interrupter *ir, 2999 - union xhci_trb *event_ring_deq) 2999 + union xhci_trb *event_ring_deq, 3000 + bool clear_ehb) 3000 3001 { 3001 3002 u64 temp_64; 3002 3003 dma_addr_t deq; ··· 3018 3017 return; 3019 3018 3020 3019 /* Update HC event ring dequeue pointer */ 3021 - temp_64 &= ERST_PTR_MASK; 3020 + temp_64 &= ERST_DESI_MASK; 3022 3021 temp_64 |= ((u64) deq & (u64) ~ERST_PTR_MASK); 3023 3022 } 3024 3023 3025 3024 /* Clear the event handler busy flag (RW1C) */ 3026 - temp_64 |= ERST_EHB; 3025 + if (clear_ehb) 3026 + temp_64 |= ERST_EHB; 3027 3027 xhci_write_64(xhci, temp_64, &ir->ir_set->erst_dequeue); 3028 3028 } 3029 3029 ··· 3105 3103 while (xhci_handle_event(xhci, ir) > 0) { 3106 3104 if (event_loop++ < TRBS_PER_SEGMENT / 2) 3107 3105 continue; 3108 - xhci_update_erst_dequeue(xhci, ir, event_ring_deq); 3106 + xhci_update_erst_dequeue(xhci, ir, event_ring_deq, false); 3109 3107 event_ring_deq = ir->event_ring->dequeue; 3110 3108 3111 3109 /* ring is half-full, force isoc trbs to interrupt more often */ ··· 3115 3113 event_loop = 0; 3116 3114 } 3117 3115 3118 - xhci_update_erst_dequeue(xhci, ir, event_ring_deq); 3116 + xhci_update_erst_dequeue(xhci, ir, event_ring_deq, true); 3119 3117 ret = IRQ_HANDLED; 3120 3118 3121 3119 out: ··· 3471 3469 static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len, 3472 3470 u32 *trb_buff_len, struct xhci_segment *seg) 3473 3471 { 3474 - struct device *dev = xhci_to_hcd(xhci)->self.controller; 3472 + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; 3475 3473 unsigned int unalign; 3476 3474 unsigned int max_pkt; 3477 3475 u32 new_buff_len;
+1 -1
drivers/usb/host/xhci.h
··· 514 514 #define ERST_SIZE_MASK (0xffff << 16) 515 515 516 516 /* erst_base bitmasks */ 517 - #define ERST_BASE_RSVDP (0x3f) 517 + #define ERST_BASE_RSVDP (GENMASK_ULL(5, 0)) 518 518 519 519 /* erst_dequeue bitmasks */ 520 520 /* Dequeue ERST Segment Index (DESI) - Segment number (or alias)
+1
drivers/usb/misc/onboard_usb_hub.c
··· 434 434 { USB_DEVICE(VENDOR_ID_GENESYS, 0x0608) }, /* Genesys Logic GL850G USB 2.0 */ 435 435 { USB_DEVICE(VENDOR_ID_GENESYS, 0x0610) }, /* Genesys Logic GL852G USB 2.0 */ 436 436 { USB_DEVICE(VENDOR_ID_GENESYS, 0x0620) }, /* Genesys Logic GL3523 USB 3.1 */ 437 + { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2412) }, /* USB2412 USB 2.0 */ 437 438 { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2514) }, /* USB2514B USB 2.0 */ 438 439 { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2517) }, /* USB2517 USB 2.0 */ 439 440 { USB_DEVICE(VENDOR_ID_REALTEK, 0x0411) }, /* RTS5411 USB 3.1 */
+1
drivers/usb/misc/onboard_usb_hub.h
··· 47 47 }; 48 48 49 49 static const struct of_device_id onboard_hub_match[] = { 50 + { .compatible = "usb424,2412", .data = &microchip_usb424_data, }, 50 51 { .compatible = "usb424,2514", .data = &microchip_usb424_data, }, 51 52 { .compatible = "usb424,2517", .data = &microchip_usb424_data, }, 52 53 { .compatible = "usb451,8140", .data = &ti_tusb8041_data, },
+1 -1
drivers/usb/musb/musb_debugfs.c
··· 39 39 { "IntrUsbE", MUSB_INTRUSBE, 8 }, 40 40 { "DevCtl", MUSB_DEVCTL, 8 }, 41 41 { "VControl", 0x68, 32 }, 42 - { "HWVers", 0x69, 16 }, 42 + { "HWVers", MUSB_HWVERS, 16 }, 43 43 { "LinkInfo", MUSB_LINKINFO, 8 }, 44 44 { "VPLen", MUSB_VPLEN, 8 }, 45 45 { "HS_EOF1", MUSB_HS_EOF1, 8 },
+8 -1
drivers/usb/musb/musb_host.c
··· 321 321 musb_giveback(musb, urb, status); 322 322 qh->is_ready = ready; 323 323 324 + /* 325 + * musb->lock had been unlocked in musb_giveback, so qh may 326 + * be freed, need to get it again 327 + */ 328 + qh = musb_ep_get_qh(hw_ep, is_in); 329 + 324 330 /* reclaim resources (and bandwidth) ASAP; deschedule it, and 325 331 * invalidate qh as soon as list_empty(&hep->urb_list) 326 332 */ 327 - if (list_empty(&qh->hep->urb_list)) { 333 + if (qh && list_empty(&qh->hep->urb_list)) { 328 334 struct list_head *head; 329 335 struct dma_controller *dma = musb->dma_controller; 330 336 ··· 2404 2398 * and its URB list has emptied, recycle this qh. 2405 2399 */ 2406 2400 if (ready && list_empty(&qh->hep->urb_list)) { 2401 + musb_ep_set_qh(qh->hw_ep, is_in, NULL); 2407 2402 qh->hep->hcpriv = NULL; 2408 2403 list_del(&qh->ring); 2409 2404 kfree(qh);
+5
drivers/usb/typec/altmodes/displayport.c
··· 304 304 typec_altmode_update_active(alt, false); 305 305 dp->data.status = 0; 306 306 dp->data.conf = 0; 307 + if (dp->hpd) { 308 + drm_connector_oob_hotplug_event(dp->connector_fwnode); 309 + dp->hpd = false; 310 + sysfs_notify(&dp->alt->dev.kobj, "displayport", "hpd"); 311 + } 307 312 break; 308 313 case DP_CMD_STATUS_UPDATE: 309 314 dp->data.status = *vdo;
+6 -6
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
··· 381 381 struct device *dev = pmic_typec_pdphy->dev; 382 382 int ret; 383 383 384 - ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy); 385 - if (ret) 386 - return ret; 387 - 388 384 /* PD 2.0, DR=TYPEC_DEVICE, PR=TYPEC_SINK */ 389 385 ret = regmap_update_bits(pmic_typec_pdphy->regmap, 390 386 pmic_typec_pdphy->base + USB_PDPHY_MSG_CONFIG_REG, ··· 418 422 ret = regmap_write(pmic_typec_pdphy->regmap, 419 423 pmic_typec_pdphy->base + USB_PDPHY_EN_CONTROL_REG, 0); 420 424 421 - regulator_disable(pmic_typec_pdphy->vdd_pdphy); 422 - 423 425 return ret; 424 426 } 425 427 ··· 441 447 int i; 442 448 int ret; 443 449 450 + ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy); 451 + if (ret) 452 + return ret; 453 + 444 454 pmic_typec_pdphy->tcpm_port = tcpm_port; 445 455 446 456 ret = pmic_typec_pdphy_reset(pmic_typec_pdphy); ··· 465 467 disable_irq(pmic_typec_pdphy->irq_data[i].irq); 466 468 467 469 qcom_pmic_typec_pdphy_reset_on(pmic_typec_pdphy); 470 + 471 + regulator_disable(pmic_typec_pdphy->vdd_pdphy); 468 472 } 469 473 470 474 struct pmic_typec_pdphy *qcom_pmic_typec_pdphy_alloc(struct device *dev)
+9
drivers/usb/typec/ucsi/psy.c
··· 37 37 struct device *dev = con->ucsi->dev; 38 38 39 39 device_property_read_u8(dev, "scope", &scope); 40 + if (scope == POWER_SUPPLY_SCOPE_UNKNOWN) { 41 + u32 mask = UCSI_CAP_ATTR_POWER_AC_SUPPLY | 42 + UCSI_CAP_ATTR_BATTERY_CHARGING; 43 + 44 + if (con->ucsi->cap.attributes & mask) 45 + scope = POWER_SUPPLY_SCOPE_SYSTEM; 46 + else 47 + scope = POWER_SUPPLY_SCOPE_DEVICE; 48 + } 40 49 val->intval = scope; 41 50 return 0; 42 51 }
+2
drivers/usb/typec/ucsi/ucsi.c
··· 787 787 788 788 typec_set_mode(con->port, TYPEC_STATE_SAFE); 789 789 790 + typec_partner_set_usb_power_delivery(con->partner, NULL); 790 791 ucsi_unregister_partner_pdos(con); 791 792 ucsi_unregister_altmodes(con, UCSI_RECIPIENT_SOP); 792 793 typec_unregister_partner(con->partner); ··· 885 884 if (ret < 0) { 886 885 dev_err(ucsi->dev, "%s: GET_CONNECTOR_STATUS failed (%d)\n", 887 886 __func__, ret); 887 + clear_bit(EVENT_PENDING, &con->ucsi->flags); 888 888 goto out_unlock; 889 889 } 890 890