summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-07-10 17:12:35 +0700
committerGitHub <[email protected]>2025-07-10 17:12:35 +0700
commit546e8413b5ed05a8c35b8dbe7792516a3cd631fa (patch)
treefc1fba105c432af0b222bacbda2067a59394339c /src
parentf918c4a978cc154a0f20c787d68e799382951ddf (diff)
parent1d2735fb54b4ef9a154e10500e7d70e989f3bcc3 (diff)
Merge pull request #2873 from HiFiPhile/susp_isr
DWC2: fix recurrent suspend ISR without Vbus connected
Diffstat (limited to 'src')
-rw-r--r--src/portable/synopsys/dwc2/dcd_dwc2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c
index 5f86d6b76..f10f0bdc3 100644
--- a/src/portable/synopsys/dwc2/dcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/dcd_dwc2.c
@@ -431,7 +431,7 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
#endif
// Enable required interrupts
- dwc2->gintmsk |= GINTMSK_OTGINT | GINTMSK_USBSUSPM | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM;
+ dwc2->gintmsk |= GINTMSK_OTGINT | GINTMSK_USBRST | GINTMSK_ENUMDNEM | GINTMSK_WUIM;
// TX FIFO empty level for interrupt is complete empty
uint32_t gahbcfg = dwc2->gahbcfg;
@@ -1032,16 +1032,19 @@ void dcd_int_handler(uint8_t rhport) {
if (gintsts & GINTSTS_ENUMDNE) {
// ENUMDNE is the end of reset where speed of the link is detected
dwc2->gintsts = GINTSTS_ENUMDNE;
+ dwc2->gintmsk |= GINTMSK_USBSUSPM;
handle_enum_done(rhport);
}
if (gintsts & GINTSTS_USBSUSP) {
dwc2->gintsts = GINTSTS_USBSUSP;
+ dwc2->gintmsk &= ~GINTMSK_USBSUSPM;
dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true);
}
if (gintsts & GINTSTS_WKUINT) {
dwc2->gintsts = GINTSTS_WKUINT;
+ dwc2->gintmsk |= GINTMSK_USBSUSPM;
dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true);
}
@@ -1061,6 +1064,7 @@ void dcd_int_handler(uint8_t rhport) {
if(gintsts & GINTSTS_SOF) {
dwc2->gintsts = GINTSTS_SOF;
+ dwc2->gintmsk |= GINTMSK_USBSUSPM;
const uint32_t frame = (dwc2->dsts & DSTS_FNSOF) >> DSTS_FNSOF_Pos;
// Disable SOF interrupt if SOF was not explicitly enabled since SOF was used for remote wakeup detection