* [PATCH] usb: dwc3: meson-g12a: disable the OTG ID interrupt at unbind
@ 2026-11-29 7:30 Arina Kharlamova via B4 Relay
2026-11-29 7:38 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-11-29 7:30 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Felipe Balbi
Cc: linux-usb, linux-arm-kernel, linux-amlogic, Arina Kharlamova
From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
The OTG ID interrupt is requested with devm and is only freed after
dwc3_meson_g12a_remove() returns, but remove() already powers off and
exits the PHYs and disables the glue clocks. An ID pin change in that
window runs dwc3_meson_g12a_irq_thread(), which switches the PHY mode
on PHYs that were exited and writes the glue registers with the clocks
off.
Keep the interrupt number and disable the interrupt at the start of
remove().
Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
Found by checks derived from the spec2patch kernel API specifications,
with the help of an AI coding assistant (Claude); I reviewed the
analysis and the fix.
---
drivers/usb/dwc3/dwc3-meson-g12a.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index ca07e813fd64..e05923cb94d9 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -255,6 +255,7 @@ struct dwc3_meson_g12a {
struct phy *phys[PHY_COUNT];
enum usb_dr_mode otg_mode;
enum phy_mode otg_phy_mode;
+ int otg_irq;
unsigned int usb2_ports;
unsigned int usb3_ports;
struct regulator *vbus;
@@ -596,6 +597,7 @@ static int dwc3_meson_g12a_otg_init(struct platform_device *pdev,
IRQF_ONESHOT, pdev->name, priv);
if (ret)
return ret;
+ priv->otg_irq = irq;
}
/* Setup OTG mode corresponding to the ID pin */
@@ -835,6 +837,9 @@ static void dwc3_meson_g12a_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
int i;
+ if (priv->otg_irq)
+ disable_irq(priv->otg_irq);
+
usb_role_switch_unregister(priv->role_switch);
put_device(priv->switch_desc.udc);
---
base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
change-id: 20261129-s2p-d88-a1367f300e08
Best regards,
--
Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: dwc3: meson-g12a: disable the OTG ID interrupt at unbind
2026-11-29 7:30 [PATCH] usb: dwc3: meson-g12a: disable the OTG ID interrupt at unbind Arina Kharlamova via B4 Relay
@ 2026-11-29 7:38 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-29 7:38 UTC (permalink / raw)
To: Arina Kharlamova; +Cc: linux-usb
> From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
>
> The OTG ID interrupt is requested with devm and is only freed after
> dwc3_meson_g12a_remove() returns, but remove() already powers off and
> exits the PHYs and disables the glue clocks. An ID pin change in that
> window runs dwc3_meson_g12a_irq_thread(), which switches the PHY mode
> on PHYs that were exited and writes the glue registers with the clocks
> off.
>
> Keep the interrupt number and disable the interrupt at the start of
> remove().
>
> Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
> Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261129-s2p-d88-v1-1-8cdfa0ca7bf8@mbzuai.ac.ae?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-29 7:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 7:30 [PATCH] usb: dwc3: meson-g12a: disable the OTG ID interrupt at unbind Arina Kharlamova via B4 Relay
2026-11-29 7:38 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox