From: Prashanth K <quic_prashk@quicinc.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Wesley Cheng <quic_wcheng@quicinc.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [RFC PATCH] usb: dwc3: Poll CMDACT after issuing EndXfer command
Date: Thu, 25 Apr 2024 09:25:42 +0530 [thread overview]
Message-ID: <f90ddc4e-f3da-3dbf-6414-7852698b6bb3@quicinc.com> (raw)
In-Reply-To: <20240424223618.utauunrz7nud5wfi@synopsys.com>
On 25-04-24 04:06 am, Thinh Nguyen wrote:
>
> Thanks for the data.
>
> Ok, I remember now why we did what we did. I just notice the Fixes
> commit you tag: b353eb6dc285 ("usb: dwc3: gadget: Skip waiting for
> CMDACT cleared during endxfer")
>
> I forgot that at one point we skip CMDACT for End Transfer command.
> Let's not poll for CMDACT for End Transfer command and unconditionally
> wait 1ms. Otherwise we may run into the issue being stuck with CMDACT
> again while SETUP packet is not DMA out again. 1ms should be plenty of
> time for the End Transfer command to complete.
>
> It should look like this:
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f94f68f1e7d2..dad30c6ab19d 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1724,8 +1724,7 @@ static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool int
> dep->resource_index = 0;
>
> if (!interrupt) {
> - if (!DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC3, 310A))
> - mdelay(1);
> + mdelay(1);
> dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
> } else if (!ret) {
> dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
>
> Thanks,
> Thinh
>
> Ps. also please Cc stable.
Thanks for the suggestion, I had tried 1ms initially when encountering
the issue and it was helping. Then I thought that CMDACT polling was
better approach. But anyways I echo you, having common solution for all
controller revisions is the cleaner way. I'll send V2 with mdelay(1).
Thanks again,
Prashanth K
prev parent reply other threads:[~2024-04-25 3:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 9:05 [RFC PATCH] usb: dwc3: Poll CMDACT after issuing EndXfer command Prashanth K
2024-04-24 1:33 ` Thinh Nguyen
2024-04-24 8:44 ` Prashanth K
2024-04-24 22:36 ` Thinh Nguyen
2024-04-25 3:55 ` Prashanth K [this message]
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=f90ddc4e-f3da-3dbf-6414-7852698b6bb3@quicinc.com \
--to=quic_prashk@quicinc.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_wcheng@quicinc.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).