Skip to content

Commit

Permalink
usb: dwc3: gadget: Use SET_EP_PRIME for NoStream
Browse files Browse the repository at this point in the history
DWC_usb32 v1.00a and later can use SET_EP_PRIME command to reinitiate a
stream. Use the command to handle NoStream rejection instead of ending
and restarting the endpoint.

Signed-off-by: Thinh Nguyen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
Thinh Nguyen authored and felipebalbi committed May 25, 2020
1 parent 140ca4c commit b10e1c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/dwc3/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,9 @@ struct dwc3 {
#define DWC31_REVISION_180A 0x3138302a
#define DWC31_REVISION_190A 0x3139302a

#define DWC32_REVISION_ANY 0x0
#define DWC32_REVISION_100A 0x3130302a

u32 version_type;

#define DWC31_VERSIONTYPE_ANY 0x0
Expand Down
13 changes: 10 additions & 3 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -2844,9 +2844,16 @@ static void dwc3_gadget_endpoint_stream_event(struct dwc3_ep *dep,
* hosts, force to reinitate the stream until the host is ready
* instead of waiting for the host to prime the endpoint.
*/
dep->flags |= DWC3_EP_DELAY_START;
dwc3_stop_active_transfer(dep, true, true);
return;
if (DWC3_VER_IS_WITHIN(DWC32, 100A, ANY)) {
unsigned int cmd = DWC3_DGCMD_SET_ENDPOINT_PRIME;

dwc3_send_gadget_generic_command(dwc, cmd, dep->number);
} else {
dep->flags |= DWC3_EP_DELAY_START;
dwc3_stop_active_transfer(dep, true, true);
return;
}
break;
}

out:
Expand Down

0 comments on commit b10e1c2

Please sign in to comment.