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

Pull USB driver fixes from Greg KH:
"Here are some small USB driver fixes for some reported issues.
Included in here are:

- typec driver bugfixes

- u_serial gadget driver bugfix for much reported and discussed issue

- dwc2 bugfixes

- midi gadget driver bugfix

- ehci-hcd driver bugfix

- other small bugfixes

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

* tag 'usb-6.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: typec: ucsi: Fix connector status writing past buffer size
usb: typec: ucsi: Fix completion notifications
usb: dwc2: Fix HCD port connection race
usb: dwc2: hcd: Fix GetPortStatus & SetPortFeature
usb: dwc2: Fix HCD resume
usb: gadget: u_serial: Fix the issue that gs_start_io crashed due to accessing null pointer
usb: misc: onboard_usb_dev: skip suspend/resume sequence for USB5744 SMBus support
usb: dwc3: xilinx: make sure pipe clock is deselected in usb2 only mode
usb: core: hcd: only check primary hcd skip_phy_initialization
usb: gadget: midi2: Fix interpretation of is_midi1 bits
usb: dwc3: imx8mp: fix software node kernel dump
usb: typec: anx7411: fix OF node reference leaks in anx7411_typec_switch_probe()
usb: typec: anx7411: fix fwnode_handle reference leak
usb: host: max3421-hcd: Correctly abort a USB request.
dt-bindings: phy: imx8mq-usb: correct reference to usb-switch.yaml
usb: ehci-hcd: fix call balance of clocks handling routines

+116 -72
+2 -5
Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
··· 113 113 maxItems: 1 114 114 115 115 - if: 116 - properties: 117 - compatible: 118 - contains: 119 - enum: 120 - - fsl,imx95-usb-phy 116 + required: 117 + - orientation-switch 121 118 then: 122 119 $ref: /schemas/usb/usb-switch.yaml# 123 120
+7 -1
drivers/usb/core/hcd.c
··· 2794 2794 int retval; 2795 2795 struct usb_device *rhdev; 2796 2796 struct usb_hcd *shared_hcd; 2797 + int skip_phy_initialization; 2797 2798 2798 - if (!hcd->skip_phy_initialization) { 2799 + if (usb_hcd_is_primary_hcd(hcd)) 2800 + skip_phy_initialization = hcd->skip_phy_initialization; 2801 + else 2802 + skip_phy_initialization = hcd->primary_hcd->skip_phy_initialization; 2803 + 2804 + if (!skip_phy_initialization) { 2799 2805 if (usb_hcd_is_primary_hcd(hcd)) { 2800 2806 hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); 2801 2807 if (IS_ERR(hcd->phy_roothub))
+8 -11
drivers/usb/dwc2/hcd.c
··· 3546 3546 port_status |= USB_PORT_STAT_C_OVERCURRENT << 16; 3547 3547 } 3548 3548 3549 - if (!hsotg->flags.b.port_connect_status) { 3549 + if (dwc2_is_device_mode(hsotg)) { 3550 3550 /* 3551 - * The port is disconnected, which means the core is 3552 - * either in device mode or it soon will be. Just 3553 - * return 0's for the remainder of the port status 3551 + * Just return 0's for the remainder of the port status 3554 3552 * since the port register can't be read if the core 3555 3553 * is in device mode. 3556 3554 */ ··· 3618 3620 if (wvalue != USB_PORT_FEAT_TEST && (!windex || windex > 1)) 3619 3621 goto error; 3620 3622 3621 - if (!hsotg->flags.b.port_connect_status) { 3623 + if (dwc2_is_device_mode(hsotg)) { 3622 3624 /* 3623 - * The port is disconnected, which means the core is 3624 - * either in device mode or it soon will be. Just 3625 - * return without doing anything since the port 3626 - * register can't be written if the core is in device 3627 - * mode. 3625 + * Just return 0's for the remainder of the port status 3626 + * since the port register can't be read if the core 3627 + * is in device mode. 3628 3628 */ 3629 3629 break; 3630 3630 } ··· 4345 4349 if (hsotg->bus_suspended) 4346 4350 goto skip_power_saving; 4347 4351 4348 - if (hsotg->flags.b.port_connect_status == 0) 4352 + if (!(dwc2_read_hprt0(hsotg) & HPRT0_CONNSTS)) 4349 4353 goto skip_power_saving; 4350 4354 4351 4355 switch (hsotg->params.power_down) { ··· 4427 4431 * Power Down mode. 4428 4432 */ 4429 4433 if (hprt0 & HPRT0_CONNSTS) { 4434 + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 4430 4435 hsotg->lx_state = DWC2_L0; 4431 4436 goto unlock; 4432 4437 }
+16 -14
drivers/usb/dwc3/dwc3-imx8mp.c
··· 129 129 writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); 130 130 } 131 131 132 + static const struct property_entry dwc3_imx8mp_properties[] = { 133 + PROPERTY_ENTRY_BOOL("xhci-missing-cas-quirk"), 134 + PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk"), 135 + {}, 136 + }; 137 + 138 + static const struct software_node dwc3_imx8mp_swnode = { 139 + .properties = dwc3_imx8mp_properties, 140 + }; 141 + 132 142 static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx) 133 143 { 134 144 struct dwc3_imx8mp *dwc3_imx = _dwc3_imx; ··· 156 146 pm_runtime_get(dwc->dev); 157 147 158 148 return IRQ_HANDLED; 159 - } 160 - 161 - static int dwc3_imx8mp_set_software_node(struct device *dev) 162 - { 163 - struct property_entry props[3] = { 0 }; 164 - int prop_idx = 0; 165 - 166 - props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-missing-cas-quirk"); 167 - props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk"); 168 - 169 - return device_create_managed_software_node(dev, props, NULL); 170 149 } 171 150 172 151 static int dwc3_imx8mp_probe(struct platform_device *pdev) ··· 220 221 if (err < 0) 221 222 goto disable_rpm; 222 223 223 - err = dwc3_imx8mp_set_software_node(dev); 224 + err = device_add_software_node(dev, &dwc3_imx8mp_swnode); 224 225 if (err) { 225 226 err = -ENODEV; 226 - dev_err(dev, "failed to create software node\n"); 227 + dev_err(dev, "failed to add software node\n"); 227 228 goto disable_rpm; 228 229 } 229 230 230 231 err = of_platform_populate(node, NULL, NULL, dev); 231 232 if (err) { 232 233 dev_err(&pdev->dev, "failed to create dwc3 core\n"); 233 - goto disable_rpm; 234 + goto remove_swnode; 234 235 } 235 236 236 237 dwc3_imx->dwc3 = of_find_device_by_node(dwc3_np); ··· 254 255 255 256 depopulate: 256 257 of_platform_depopulate(dev); 258 + remove_swnode: 259 + device_remove_software_node(dev); 257 260 disable_rpm: 258 261 pm_runtime_disable(dev); 259 262 pm_runtime_put_noidle(dev); ··· 269 268 270 269 pm_runtime_get_sync(dev); 271 270 of_platform_depopulate(dev); 271 + device_remove_software_node(dev); 272 272 273 273 pm_runtime_disable(dev); 274 274 pm_runtime_put_noidle(dev);
+4 -1
drivers/usb/dwc3/dwc3-xilinx.c
··· 121 121 * in use but the usb3-phy entry is missing from the device tree. 122 122 * Therefore, skip these operations in this case. 123 123 */ 124 - if (!priv_data->usb3_phy) 124 + if (!priv_data->usb3_phy) { 125 + /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */ 126 + writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); 125 127 goto skip_usb3_phy; 128 + } 126 129 127 130 crst = devm_reset_control_get_exclusive(dev, "usb_crst"); 128 131 if (IS_ERR(crst)) {
+5 -1
drivers/usb/gadget/function/f_midi2.c
··· 1591 1591 fb->info.midi_ci_version = b->midi_ci_version; 1592 1592 fb->info.ui_hint = reverse_dir(b->ui_hint); 1593 1593 fb->info.sysex8_streams = b->sysex8_streams; 1594 - fb->info.flags |= b->is_midi1; 1594 + if (b->is_midi1 < 2) 1595 + fb->info.flags |= b->is_midi1; 1596 + else 1597 + fb->info.flags |= SNDRV_UMP_BLOCK_IS_MIDI1 | 1598 + SNDRV_UMP_BLOCK_IS_LOWSPEED; 1595 1599 strscpy(fb->info.name, ump_fb_name(b), 1596 1600 sizeof(fb->info.name)); 1597 1601 }
+6 -3
drivers/usb/gadget/function/u_serial.c
··· 579 579 * we didn't in gs_start_tx() */ 580 580 tty_wakeup(port->port.tty); 581 581 } else { 582 - gs_free_requests(ep, head, &port->read_allocated); 583 - gs_free_requests(port->port_usb->in, &port->write_pool, 584 - &port->write_allocated); 582 + /* Free reqs only if we are still connected */ 583 + if (port->port_usb) { 584 + gs_free_requests(ep, head, &port->read_allocated); 585 + gs_free_requests(port->port_usb->in, &port->write_pool, 586 + &port->write_allocated); 587 + } 585 588 status = -EIO; 586 589 } 587 590
+7 -2
drivers/usb/host/ehci-sh.c
··· 119 119 if (IS_ERR(priv->iclk)) 120 120 priv->iclk = NULL; 121 121 122 - clk_enable(priv->fclk); 123 - clk_enable(priv->iclk); 122 + ret = clk_enable(priv->fclk); 123 + if (ret) 124 + goto fail_request_resource; 125 + ret = clk_enable(priv->iclk); 126 + if (ret) 127 + goto fail_iclk; 124 128 125 129 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 126 130 if (ret != 0) { ··· 140 136 141 137 fail_add_hcd: 142 138 clk_disable(priv->iclk); 139 + fail_iclk: 143 140 clk_disable(priv->fclk); 144 141 145 142 fail_request_resource:
+11 -5
drivers/usb/host/max3421-hcd.c
··· 779 779 retval = 1; 780 780 dev_dbg(&spi->dev, "%s: URB %p unlinked=%d", 781 781 __func__, urb, urb->unlinked); 782 - usb_hcd_unlink_urb_from_ep(hcd, urb); 783 - spin_unlock_irqrestore(&max3421_hcd->lock, 784 - flags); 785 - usb_hcd_giveback_urb(hcd, urb, 0); 786 - spin_lock_irqsave(&max3421_hcd->lock, flags); 782 + if (urb == max3421_hcd->curr_urb) { 783 + max3421_hcd->urb_done = 1; 784 + max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) | 785 + BIT(MAX3421_HI_RCVDAV_BIT)); 786 + } else { 787 + usb_hcd_unlink_urb_from_ep(hcd, urb); 788 + spin_unlock_irqrestore(&max3421_hcd->lock, 789 + flags); 790 + usb_hcd_giveback_urb(hcd, urb, 0); 791 + spin_lock_irqsave(&max3421_hcd->lock, flags); 792 + } 787 793 } 788 794 } 789 795 }
+3 -1
drivers/usb/misc/onboard_usb_dev.c
··· 407 407 } 408 408 409 409 if (of_device_is_compatible(pdev->dev.of_node, "usb424,2744") || 410 - of_device_is_compatible(pdev->dev.of_node, "usb424,5744")) 410 + of_device_is_compatible(pdev->dev.of_node, "usb424,5744")) { 411 411 err = onboard_dev_5744_i2c_init(client); 412 + onboard_dev->always_powered_in_suspend = true; 413 + } 412 414 413 415 put_device(&client->dev); 414 416 if (err < 0)
+41 -25
drivers/usb/typec/anx7411.c
··· 290 290 struct power_supply *psy; 291 291 struct power_supply_desc psy_desc; 292 292 struct device *dev; 293 + struct fwnode_handle *switch_node; 294 + struct fwnode_handle *mux_node; 293 295 }; 294 296 295 297 static u8 snk_identity[] = { ··· 1023 1021 } 1024 1022 } 1025 1023 1024 + static void anx7411_port_unregister(struct typec_params *typecp) 1025 + { 1026 + fwnode_handle_put(typecp->caps.fwnode); 1027 + anx7411_port_unregister_altmodes(typecp->port_amode); 1028 + if (typecp->port) 1029 + typec_unregister_port(typecp->port); 1030 + if (typecp->role_sw) 1031 + usb_role_switch_put(typecp->role_sw); 1032 + } 1033 + 1026 1034 static int anx7411_usb_mux_set(struct typec_mux_dev *mux, 1027 1035 struct typec_mux_state *state) 1028 1036 { ··· 1101 1089 if (ctx->typec.typec_mux) { 1102 1090 typec_mux_unregister(ctx->typec.typec_mux); 1103 1091 ctx->typec.typec_mux = NULL; 1092 + fwnode_handle_put(ctx->mux_node); 1104 1093 } 1105 1094 } 1106 1095 ··· 1110 1097 if (ctx->typec.typec_switch) { 1111 1098 typec_switch_unregister(ctx->typec.typec_switch); 1112 1099 ctx->typec.typec_switch = NULL; 1100 + fwnode_handle_put(ctx->switch_node); 1113 1101 } 1114 1102 } 1115 1103 ··· 1118 1104 struct device *dev) 1119 1105 { 1120 1106 int ret; 1121 - struct device_node *node; 1122 1107 1123 - node = of_get_child_by_name(dev->of_node, "orientation_switch"); 1124 - if (!node) 1108 + ctx->switch_node = device_get_named_child_node(dev, "orientation_switch"); 1109 + if (!ctx->switch_node) 1125 1110 return 0; 1126 1111 1127 - ret = anx7411_register_switch(ctx, dev, &node->fwnode); 1112 + ret = anx7411_register_switch(ctx, dev, ctx->switch_node); 1128 1113 if (ret) { 1129 1114 dev_err(dev, "failed register switch"); 1115 + fwnode_handle_put(ctx->switch_node); 1130 1116 return ret; 1131 1117 } 1132 1118 1133 - node = of_get_child_by_name(dev->of_node, "mode_switch"); 1134 - if (!node) { 1119 + ctx->mux_node = device_get_named_child_node(dev, "mode_switch"); 1120 + if (!ctx->mux_node) { 1135 1121 dev_err(dev, "no typec mux exist"); 1136 1122 ret = -ENODEV; 1137 1123 goto unregister_switch; 1138 1124 } 1139 1125 1140 - ret = anx7411_register_mux(ctx, dev, &node->fwnode); 1126 + ret = anx7411_register_mux(ctx, dev, ctx->mux_node); 1141 1127 if (ret) { 1142 1128 dev_err(dev, "failed register mode switch"); 1129 + fwnode_handle_put(ctx->mux_node); 1143 1130 ret = -ENODEV; 1144 1131 goto unregister_switch; 1145 1132 } ··· 1169 1154 ret = fwnode_property_read_string(fwnode, "power-role", &buf); 1170 1155 if (ret) { 1171 1156 dev_err(dev, "power-role not found: %d\n", ret); 1172 - return ret; 1157 + goto put_fwnode; 1173 1158 } 1174 1159 1175 1160 ret = typec_find_port_power_role(buf); 1176 1161 if (ret < 0) 1177 - return ret; 1162 + goto put_fwnode; 1178 1163 cap->type = ret; 1179 1164 1180 1165 ret = fwnode_property_read_string(fwnode, "data-role", &buf); 1181 1166 if (ret) { 1182 1167 dev_err(dev, "data-role not found: %d\n", ret); 1183 - return ret; 1168 + goto put_fwnode; 1184 1169 } 1185 1170 1186 1171 ret = typec_find_port_data_role(buf); 1187 1172 if (ret < 0) 1188 - return ret; 1173 + goto put_fwnode; 1189 1174 cap->data = ret; 1190 1175 1191 1176 ret = fwnode_property_read_string(fwnode, "try-power-role", &buf); 1192 1177 if (ret) { 1193 1178 dev_err(dev, "try-power-role not found: %d\n", ret); 1194 - return ret; 1179 + goto put_fwnode; 1195 1180 } 1196 1181 1197 1182 ret = typec_find_power_role(buf); 1198 1183 if (ret < 0) 1199 - return ret; 1184 + goto put_fwnode; 1200 1185 cap->prefer_role = ret; 1201 1186 1202 1187 /* Get source pdos */ ··· 1208 1193 typecp->src_pdo_nr); 1209 1194 if (ret < 0) { 1210 1195 dev_err(dev, "source cap validate failed: %d\n", ret); 1211 - return -EINVAL; 1196 + goto put_fwnode; 1212 1197 } 1213 1198 1214 1199 typecp->caps_flags |= HAS_SOURCE_CAP; ··· 1222 1207 typecp->sink_pdo_nr); 1223 1208 if (ret < 0) { 1224 1209 dev_err(dev, "sink cap validate failed: %d\n", ret); 1225 - return -EINVAL; 1210 + goto put_fwnode; 1226 1211 } 1227 1212 1228 1213 for (i = 0; i < typecp->sink_pdo_nr; i++) { ··· 1266 1251 ret = PTR_ERR(ctx->typec.port); 1267 1252 ctx->typec.port = NULL; 1268 1253 dev_err(dev, "Failed to register type c port %d\n", ret); 1269 - return ret; 1254 + goto put_usb_role_switch; 1270 1255 } 1271 1256 1272 1257 typec_port_register_altmodes(ctx->typec.port, NULL, ctx, 1273 1258 ctx->typec.port_amode, 1274 1259 MAX_ALTMODE); 1275 1260 return 0; 1261 + 1262 + put_usb_role_switch: 1263 + if (ctx->typec.role_sw) 1264 + usb_role_switch_put(ctx->typec.role_sw); 1265 + put_fwnode: 1266 + fwnode_handle_put(fwnode); 1267 + 1268 + return ret; 1276 1269 } 1277 1270 1278 1271 static int anx7411_typec_check_connection(struct anx7411_data *ctx) ··· 1546 1523 destroy_workqueue(plat->workqueue); 1547 1524 1548 1525 free_typec_port: 1549 - typec_unregister_port(plat->typec.port); 1550 - anx7411_port_unregister_altmodes(plat->typec.port_amode); 1526 + anx7411_port_unregister(&plat->typec); 1551 1527 1552 1528 free_typec_switch: 1553 1529 anx7411_unregister_switch(plat); ··· 1570 1548 1571 1549 i2c_unregister_device(plat->spi_client); 1572 1550 1573 - if (plat->typec.role_sw) 1574 - usb_role_switch_put(plat->typec.role_sw); 1575 - 1576 1551 anx7411_unregister_mux(plat); 1577 1552 1578 1553 anx7411_unregister_switch(plat); 1579 1554 1580 - if (plat->typec.port) 1581 - typec_unregister_port(plat->typec.port); 1582 - 1583 - anx7411_port_unregister_altmodes(plat->typec.port_amode); 1555 + anx7411_port_unregister(&plat->typec); 1584 1556 } 1585 1557 1586 1558 static const struct i2c_device_id anx7411_id[] = {
+6 -3
drivers/usb/typec/ucsi/ucsi.c
··· 46 46 ucsi_connector_change(ucsi, UCSI_CCI_CONNECTOR(cci)); 47 47 48 48 if (cci & UCSI_CCI_ACK_COMPLETE && 49 - test_bit(ACK_PENDING, &ucsi->flags)) 49 + test_and_clear_bit(ACK_PENDING, &ucsi->flags)) 50 50 complete(&ucsi->complete); 51 51 52 52 if (cci & UCSI_CCI_COMMAND_COMPLETE && 53 - test_bit(COMMAND_PENDING, &ucsi->flags)) 53 + test_and_clear_bit(COMMAND_PENDING, &ucsi->flags)) 54 54 complete(&ucsi->complete); 55 55 } 56 56 EXPORT_SYMBOL_GPL(ucsi_notify_common); ··· 64 64 set_bit(ACK_PENDING, &ucsi->flags); 65 65 else 66 66 set_bit(COMMAND_PENDING, &ucsi->flags); 67 + 68 + reinit_completion(&ucsi->complete); 67 69 68 70 ret = ucsi->ops->async_control(ucsi, command); 69 71 if (ret) ··· 653 651 static int ucsi_get_connector_status(struct ucsi_connector *con, bool conn_ack) 654 652 { 655 653 u64 command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num); 656 - size_t size = min(UCSI_GET_CONNECTOR_STATUS_SIZE, UCSI_MAX_DATA_LENGTH(con->ucsi)); 654 + size_t size = min(sizeof(con->status), 655 + UCSI_MAX_DATA_LENGTH(con->ucsi)); 657 656 int ret; 658 657 659 658 ret = ucsi_send_command_common(con->ucsi, command, &con->status, size, conn_ack);