Hi, On Thu, Sep 29, 2011 at 12:39:40PM +0300, Felipe Balbi wrote: > On Tue, Sep 27, 2011 at 10:52:39PM -0700, Paul Zimmerman wrote: > > This makes DWC3_EP_WEDGE do the right thing (I think) > > > > Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx> > > applied, thanks. Changed commit log a bit. commit 7579ed539e474d8a8922bc8428973f82a5e1c5f0 Author: Paul Zimmerman <Paul.Zimmerman@xxxxxxxxxxxx> Date: Tue Sep 27 22:52:39 2011 -0700 usb: dwc3: gadget: make DWC3_EP_WEDGE do the right thing This makes DWC3_EP_WEDGE do the right thing, which is prevent DWC3_EP_WEDGE from ever being cleared by a ClearFeature(HALT) command. [ balbi@xxxxxx : allowed set_wedge to send SetHalt command to controller ] Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx> Signed-off-by: Felipe Balbi <balbi@xxxxxx> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index fd5d2bd..484359a 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -894,6 +894,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) else dep->flags |= DWC3_EP_STALL; } else { + if (dep->flags & DWC3_EP_WEDGE) + return 0; + ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, DWC3_DEPCMD_CLEARSTALL, ¶ms); if (ret) @@ -903,6 +906,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) else dep->flags &= ~DWC3_EP_STALL; } + return ret; } @@ -936,7 +940,7 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) dep->flags |= DWC3_EP_WEDGE; - return usb_ep_set_halt(ep); + return dwc3_gadget_ep_set_halt(ep); } /* -------------------------------------------------------------------------- */ this is because the was it was before, when gadget called set_wedge() we wouold set WEDGE flag, call usb_ep_set_halt() and simply return. Now we allow the DWC3_DEPCMD_SETSTALL command to go through, but prevent CLEARSTALL command. -- balbi
Attachment:
signature.asc
Description: Digital signature