[PATCH] usb: dwc3: meson-g12a: disable the OTG ID interrupt at unbind
Arina Kharlamova via B4 Relay
devnull+arina.kharlamova.mbzuai.ac.ae at kernel.org
Sat Nov 28 23:30:44 PST 2026
From: Arina Kharlamova <arina.kharlamova at 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 at 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 at mbzuai.ac.ae>
More information about the linux-arm-kernel
mailing list