mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
usb: dwc3: Fix incorrect ep0 state on reset
According to the databook ep0 should be in setup phase during reset. If host issues reset between control transfers, ep0 will be in an invalid state. Fix this my issuing stall and restart on ep0 if it is not in setup phase. CRs-Fixed: 2136658 Change-Id: I6dc20c2735a6ce772533ccb5b63ba5d1b01f89d7 Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
ec2321135d
commit
f7a9e06d4f
3 changed files with 12 additions and 1 deletions
|
|
@ -218,7 +218,7 @@ out:
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -3137,6 +3137,16 @@ 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)
|
||||
dwc3_ep0_stall_and_restart(dwc);
|
||||
|
||||
dwc3_stop_active_transfers(dwc);
|
||||
dwc3_clear_stall_all_ep(dwc);
|
||||
|
||||
/* Reset device address to zero */
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ 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_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…
Reference in a new issue