diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index ede30f97a8ee..a759aea03ff1 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2165,6 +2165,12 @@ done: /* phy sync delay as per data book */ msleep(50); + /* + * Soft reset clears the block on the doorbell, + * set it back to prevent unwanted writes to the doorbell. + */ + dwc3_notify_event(dwc, DWC3_CONTROLLER_NOTIFY_CLEAR_DB, 0); + return 0; } @@ -2330,6 +2336,9 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) /* prevent pending bh to run later */ flush_work(&dwc->bh_work); + if (is_on) + dwc3_device_core_soft_reset(dwc); + spin_lock_irqsave(&dwc->lock, flags); if (dwc->ep0state != EP0_SETUP_PHASE) dbg_event(0xFF, "EP0 is not in SETUP phase\n", 0);