Loading drivers/usb/dwc3/ep0.c +8 −3 Original line number Diff line number Diff line Loading @@ -247,7 +247,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, return ret; } static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) { struct dwc3_ep *dep; Loading Loading @@ -1163,13 +1163,18 @@ static void dwc3_ep0_do_control_status(struct dwc3 *dwc, __dwc3_ep0_do_control_status(dwc, dep); } static void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) { struct dwc3_gadget_ep_cmd_params params; u32 cmd; int ret; if (!dep->resource_index) /* * For status/DATA OUT stage, TRB will be queued on ep0 out * endpoint for which resource index is zero. Hence allow * queuing ENDXFER command for ep0 out endpoint. */ if (!dep->resource_index && dep->number) return; cmd = DWC3_DEPCMD_ENDTRANSFER; Loading drivers/usb/dwc3/gadget.c +19 −0 Original line number Diff line number Diff line Loading @@ -3187,6 +3187,25 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) reg &= ~DWC3_DCTL_TSTCTRL_MASK; dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc->test_mode = false; /* * 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. */ if (dwc->ep0state != EP0_SETUP_PHASE) { unsigned int dir; dbg_event(0xFF, "CONTRPEND", dwc->ep0state); 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]); dwc3_ep0_stall_and_restart(dwc); } dwc3_stop_active_transfers(dwc); dwc3_clear_stall_all_ep(dwc); /* Reset device address to zero */ Loading drivers/usb/dwc3/gadget.h +2 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, void dwc3_ep0_interrupt(struct dwc3 *dwc, const struct dwc3_event_depevt *event); void dwc3_ep0_out_start(struct dwc3 *dwc); void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep); void dwc3_ep0_stall_and_restart(struct dwc3 *dwc); int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, Loading Loading
drivers/usb/dwc3/ep0.c +8 −3 Original line number Diff line number Diff line Loading @@ -247,7 +247,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, return ret; } static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) { struct dwc3_ep *dep; Loading Loading @@ -1163,13 +1163,18 @@ static void dwc3_ep0_do_control_status(struct dwc3 *dwc, __dwc3_ep0_do_control_status(dwc, dep); } static void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) { struct dwc3_gadget_ep_cmd_params params; u32 cmd; int ret; if (!dep->resource_index) /* * For status/DATA OUT stage, TRB will be queued on ep0 out * endpoint for which resource index is zero. Hence allow * queuing ENDXFER command for ep0 out endpoint. */ if (!dep->resource_index && dep->number) return; cmd = DWC3_DEPCMD_ENDTRANSFER; Loading
drivers/usb/dwc3/gadget.c +19 −0 Original line number Diff line number Diff line Loading @@ -3187,6 +3187,25 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) reg &= ~DWC3_DCTL_TSTCTRL_MASK; dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc->test_mode = false; /* * 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. */ if (dwc->ep0state != EP0_SETUP_PHASE) { unsigned int dir; dbg_event(0xFF, "CONTRPEND", dwc->ep0state); 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]); dwc3_ep0_stall_and_restart(dwc); } dwc3_stop_active_transfers(dwc); dwc3_clear_stall_all_ep(dwc); /* Reset device address to zero */ Loading
drivers/usb/dwc3/gadget.h +2 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, void dwc3_ep0_interrupt(struct dwc3 *dwc, const struct dwc3_event_depevt *event); void dwc3_ep0_out_start(struct dwc3 *dwc); void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep); void dwc3_ep0_stall_and_restart(struct dwc3 *dwc); int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, Loading