diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index bb73aba174639..9bc15d1c09904 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -791,6 +791,7 @@ struct dwc3 { u32 u1u2; u32 maximum_speed; u32 revision; + u32 iddig; #define DWC3_REVISION_173A 0x5533173a #define DWC3_REVISION_175A 0x5533175a diff --git a/drivers/usb/dwc3/otg.c b/drivers/usb/dwc3/otg.c index 542f7ff0c07b7..9434562da78ab 100644 --- a/drivers/usb/dwc3/otg.c +++ b/drivers/usb/dwc3/otg.c @@ -53,7 +53,14 @@ static irqreturn_t dwc3_otg_thread_interrupt(int irq, void *_dwc) struct dwc3 *dwc = _dwc; u32 reg = dwc3_readl(dwc->regs, DWC3_OSTS); - dev_vdbg(dwc->dev, "OTG thread interrupt\n"); + dev_vdbg(dwc->dev, "OTG thread interrupt, OSTS 0x04%x, prev iddig %d\n", + reg, dwc->iddig); + + if ((reg & DWC3_OSTS_CONIDSTS) == dwc->iddig) + goto out; + else + dwc->iddig = reg & DWC3_OSTS_CONIDSTS; + if ((reg & DWC3_OSTS_CONIDSTS)) { usb_drd_stop_hcd(dwc->dev); dwc3_writel(dwc->regs, DWC3_OCFG, DWC3_OCFG_SFTRSTMASK); @@ -81,6 +88,7 @@ static irqreturn_t dwc3_otg_thread_interrupt(int irq, void *_dwc) DWC3_OEVTEN_CONIDSTSCHNGEN); } +out: return IRQ_HANDLED; } @@ -150,6 +158,8 @@ int dwc3_otg_init(struct dwc3 *dwc) DWC3_OEVTEN_CONIDSTSCHNGEN); } + dwc->iddig = reg & DWC3_OSTS_CONIDSTS; + return 0; }