Thinh Nguyen wrote: > Mayank Rana wrote: >> @@ -3766,6 +3768,27 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) >> } >> >> dwc3_reset_gadget(dwc); >> + >> + /* >> + * From SNPS databook section 8.1.2, the EP0 should be in setup >> + * phase. So ensure that EP0 is in setup phase by issuing a stall >> + * and restart if EP0 is not in setup phase. >> + */ > > We should not issue End Transfer to control endpoint unless it's error > case such as invalid direction. The databook also specify under section > USB reset initialization to not send End Transfer to control endpoint. > >> + if (dwc->ep0state != EP0_SETUP_PHASE) { >> + unsigned int dir; >> + >> + dir = !!dwc->ep0_expect_in; >> + if (dwc->ep0state == EP0_DATA_PHASE) >> + dwc3_ep0_end_control_data(dwc, dwc->eps[dir]); >> + else >> + dwc3_ep0_end_control_data(dwc, dwc->eps[!dir]); On second thought, it seems cleaner to do this though the behavior is undefined. Do you have the driver tracepoint log capture of this scenario? It'd be great if I can also review it. Thanks! Thinh