Skip to content

Commit a0e3919

Browse files
committed
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
2 parents 636110b + 33ead7e commit a0e3919

File tree

12 files changed

+116
-72
lines changed

12 files changed

+116
-72
lines changed

Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,8 @@ allOf:
113113
maxItems: 1
114114

115115
- if:
116-
properties:
117-
compatible:
118-
contains:
119-
enum:
120-
- fsl,imx95-usb-phy
116+
required:
117+
- orientation-switch
121118
then:
122119
$ref: /schemas/usb/usb-switch.yaml#
123120

drivers/usb/core/hcd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2794,8 +2794,14 @@ int usb_add_hcd(struct usb_hcd *hcd,
27942794
int retval;
27952795
struct usb_device *rhdev;
27962796
struct usb_hcd *shared_hcd;
2797+
int skip_phy_initialization;
27972798

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) {
27992805
if (usb_hcd_is_primary_hcd(hcd)) {
28002806
hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
28012807
if (IS_ERR(hcd->phy_roothub))

drivers/usb/dwc2/hcd.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,11 +3546,9 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
35463546
port_status |= USB_PORT_STAT_C_OVERCURRENT << 16;
35473547
}
35483548

3549-
if (!hsotg->flags.b.port_connect_status) {
3549+
if (dwc2_is_device_mode(hsotg)) {
35503550
/*
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
35543552
* since the port register can't be read if the core
35553553
* is in device mode.
35563554
*/
@@ -3620,13 +3618,11 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
36203618
if (wvalue != USB_PORT_FEAT_TEST && (!windex || windex > 1))
36213619
goto error;
36223620

3623-
if (!hsotg->flags.b.port_connect_status) {
3621+
if (dwc2_is_device_mode(hsotg)) {
36243622
/*
3625-
* The port is disconnected, which means the core is
3626-
* either in device mode or it soon will be. Just
3627-
* return without doing anything since the port
3628-
* register can't be written if the core is in device
3629-
* mode.
3623+
* Just return 0's for the remainder of the port status
3624+
* since the port register can't be read if the core
3625+
* is in device mode.
36303626
*/
36313627
break;
36323628
}
@@ -4349,7 +4345,7 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
43494345
if (hsotg->bus_suspended)
43504346
goto skip_power_saving;
43514347

4352-
if (hsotg->flags.b.port_connect_status == 0)
4348+
if (!(dwc2_read_hprt0(hsotg) & HPRT0_CONNSTS))
43534349
goto skip_power_saving;
43544350

43554351
switch (hsotg->params.power_down) {
@@ -4431,6 +4427,7 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
44314427
* Power Down mode.
44324428
*/
44334429
if (hprt0 & HPRT0_CONNSTS) {
4430+
set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
44344431
hsotg->lx_state = DWC2_L0;
44354432
goto unlock;
44364433
}

drivers/usb/dwc3/dwc3-imx8mp.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ static void dwc3_imx8mp_wakeup_disable(struct dwc3_imx8mp *dwc3_imx)
129129
writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
130130
}
131131

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+
132142
static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
133143
{
134144
struct dwc3_imx8mp *dwc3_imx = _dwc3_imx;
@@ -148,17 +158,6 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
148158
return IRQ_HANDLED;
149159
}
150160

151-
static int dwc3_imx8mp_set_software_node(struct device *dev)
152-
{
153-
struct property_entry props[3] = { 0 };
154-
int prop_idx = 0;
155-
156-
props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-missing-cas-quirk");
157-
props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk");
158-
159-
return device_create_managed_software_node(dev, props, NULL);
160-
}
161-
162161
static int dwc3_imx8mp_probe(struct platform_device *pdev)
163162
{
164163
struct device *dev = &pdev->dev;
@@ -221,17 +220,17 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
221220
if (err < 0)
222221
goto disable_rpm;
223222

224-
err = dwc3_imx8mp_set_software_node(dev);
223+
err = device_add_software_node(dev, &dwc3_imx8mp_swnode);
225224
if (err) {
226225
err = -ENODEV;
227-
dev_err(dev, "failed to create software node\n");
226+
dev_err(dev, "failed to add software node\n");
228227
goto disable_rpm;
229228
}
230229

231230
err = of_platform_populate(node, NULL, NULL, dev);
232231
if (err) {
233232
dev_err(&pdev->dev, "failed to create dwc3 core\n");
234-
goto disable_rpm;
233+
goto remove_swnode;
235234
}
236235

237236
dwc3_imx->dwc3 = of_find_device_by_node(dwc3_np);
@@ -255,6 +254,8 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
255254

256255
depopulate:
257256
of_platform_depopulate(dev);
257+
remove_swnode:
258+
device_remove_software_node(dev);
258259
disable_rpm:
259260
pm_runtime_disable(dev);
260261
pm_runtime_put_noidle(dev);
@@ -268,6 +269,7 @@ static void dwc3_imx8mp_remove(struct platform_device *pdev)
268269

269270
pm_runtime_get_sync(dev);
270271
of_platform_depopulate(dev);
272+
device_remove_software_node(dev);
271273

272274
pm_runtime_disable(dev);
273275
pm_runtime_put_noidle(dev);

drivers/usb/dwc3/dwc3-xilinx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
121121
* in use but the usb3-phy entry is missing from the device tree.
122122
* Therefore, skip these operations in this case.
123123
*/
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);
125127
goto skip_usb3_phy;
128+
}
126129

127130
crst = devm_reset_control_get_exclusive(dev, "usb_crst");
128131
if (IS_ERR(crst)) {

drivers/usb/gadget/function/f_midi2.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,11 @@ static int f_midi2_create_card(struct f_midi2 *midi2)
15911591
fb->info.midi_ci_version = b->midi_ci_version;
15921592
fb->info.ui_hint = reverse_dir(b->ui_hint);
15931593
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;
15951599
strscpy(fb->info.name, ump_fb_name(b),
15961600
sizeof(fb->info.name));
15971601
}

drivers/usb/gadget/function/u_serial.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,12 @@ static int gs_start_io(struct gs_port *port)
579579
* we didn't in gs_start_tx() */
580580
tty_wakeup(port->port.tty);
581581
} 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+
}
585588
status = -EIO;
586589
}
587590

drivers/usb/host/ehci-sh.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
119119
if (IS_ERR(priv->iclk))
120120
priv->iclk = NULL;
121121

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;
124128

125129
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
126130
if (ret != 0) {
@@ -136,6 +140,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
136140

137141
fail_add_hcd:
138142
clk_disable(priv->iclk);
143+
fail_iclk:
139144
clk_disable(priv->fclk);
140145

141146
fail_request_resource:

drivers/usb/host/max3421-hcd.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,17 @@ max3421_check_unlink(struct usb_hcd *hcd)
779779
retval = 1;
780780
dev_dbg(&spi->dev, "%s: URB %p unlinked=%d",
781781
__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+
}
787793
}
788794
}
789795
}

drivers/usb/misc/onboard_usb_dev.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,10 @@ static int onboard_dev_probe(struct platform_device *pdev)
407407
}
408408

409409
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")) {
411411
err = onboard_dev_5744_i2c_init(client);
412+
onboard_dev->always_powered_in_suspend = true;
413+
}
412414

413415
put_device(&client->dev);
414416
if (err < 0)

0 commit comments

Comments
 (0)