From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
linux-usb@vger.kernel.org
Cc: John Youn <John.Youn@synopsys.com>
Subject: [PATCH v2 11/11] usb: dwc3: gadget: Use SET_EP_PRIME for NoStream
Date: Tue, 05 May 2020 19:47:15 -0700 [thread overview]
Message-ID: <efa446e32df7021aef8bb7f4435b4995193d29ac.1588732815.git.thinhn@synopsys.com> (raw)
In-Reply-To: <cover.1588732815.git.thinhn@synopsys.com>
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 <thinhn@synopsys.com>
---
drivers/usb/dwc3/core.h | 3 +++
drivers/usb/dwc3/gadget.c | 13 ++++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 4def088329c7..013f42a2b5dc 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -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
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0380f76151a1..fea4fde1b5e3 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -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:
--
2.11.0
next prev parent reply other threads:[~2020-05-06 2:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-06 2:46 [PATCH v2 00/11] usb: dwc3: gadget: Handle streams Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 01/11] usb: gadget: Introduce usb_request->is_last Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 02/11] usb: gadget: f_tcm: Inform last stream request Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 03/11] usb: dwc3: gadget: Continue to process pending requests Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 04/11] usb: dwc3: gadget: Check for in-progress END_TRANSFER Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 05/11] usb: dwc3: gadget: Refactor TRB completion handler Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 06/11] usb: dwc3: gadget: Enable XferComplete event Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 07/11] usb: dwc3: gadget: Handle XferComplete for streams Thinh Nguyen
2020-05-06 2:46 ` [PATCH v2 08/11] usb: dwc3: gadget: Wait for transfer completion Thinh Nguyen
2020-05-06 2:47 ` [PATCH v2 09/11] usb: dwc3: gadget: Don't prepare beyond a transfer Thinh Nguyen
2020-05-06 2:47 ` [PATCH v2 10/11] usb: dwc3: gadget: Handle stream transfers Thinh Nguyen
2020-05-06 2:47 ` Thinh Nguyen [this message]
2020-05-14 10:43 ` [PATCH v2 00/11] usb: dwc3: gadget: Handle streams Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=efa446e32df7021aef8bb7f4435b4995193d29ac.1588732815.git.thinhn@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=John.Youn@synopsys.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.