From: Peter Chen <peter.chen@nxp.com>
To: Felipe Balbi <balbi@kernel.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
"pawell@cadence.com" <pawell@cadence.com>,
"rogerq@ti.com" <rogerq@ti.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
Jun Li <jun.li@nxp.com>
Subject: Re: [PATCH 6/8] usb: cdns3: gadget: need to handle sg case for WA2 case
Date: Tue, 8 Sep 2020 09:07:01 +0000 [thread overview]
Message-ID: <20200908090633.GA18578@b29397-desktop> (raw)
In-Reply-To: <877dt4n5lo.fsf@kernel.org>
On 20-09-08 09:29:55, Felipe Balbi wrote:
>
> Hi,
>
> Peter Chen <peter.chen@nxp.com> writes:
> > Add sg support for WA2 case.
>
> what's WA2? Care to spell it out?
It is the workaround 2, there is a description for it at the beginning
of this file. If you search the file, you may find there are some
functions has "wa2" prefix. I will improve the commit log for it.
>
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> > drivers/usb/cdns3/gadget.c | 44 +++++++++++++++++++++++++++-----------
> > 1 file changed, 31 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> > index 6cb44c354f40..1fd36bc5c6db 100644
> > --- a/drivers/usb/cdns3/gadget.c
> > +++ b/drivers/usb/cdns3/gadget.c
> > @@ -462,6 +462,36 @@ static int cdns3_start_all_request(struct cdns3_device *priv_dev,
> > (reg) |= EP_STS_EN_DESCMISEN; \
> > } } while (0)
> >
> > +static void __cdns3_descmiss_copy_data(struct usb_request *request,
> > + struct usb_request *descmiss_req)
> > +{
> > + int length = request->actual + descmiss_req->actual;
> > + struct scatterlist *s = request->sg;
> > +
> > + if (!s) {
> > + if (length <= request->length) {
> > + memcpy(&((u8 *)request->buf)[request->actual],
>
> memcpy(request->buf + request->actual, ... ?
>
> > + descmiss_req->buf,
> > + descmiss_req->actual);
> > + request->actual = length;
> > + } else {
> > + /* It should never occures */
> ^^^^^^^
> occur
Will fix.
>
> ps: famous last words :-)
>
> > + request->status = -ENOMEM;
>
> this is not documented as a valid status for usb request
> completion. Who's treating this -ENOMEM case? Which gadgets have you
> tested with this change?
>
I just add sg use case for this WA2, do not touch the current design.
The legacy chip has issue that it gets OUT data at FIFO and send
ACK to host even the endpoints are not enabled, it assumes the length
of this data is not longer than the data length the gadget request
later. We use acm + ncm to reproduce it, the pre-load data at FIFO is
several bytes, no more than 1024 bytes.
I have not found the valid status described at gadget.h, it only
describes the usage for "-ESHUTDOWN".
--
Thanks,
Peter Chen
next prev parent reply other threads:[~2020-09-08 9:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 8:44 [PATCH 0/8] usb: cdns3: improve the sg use case Peter Chen
2020-09-01 8:44 ` [PATCH 1/8] usb: cdns3: gadget: using correct sg operations Peter Chen
2020-09-08 6:19 ` Felipe Balbi
2020-09-08 7:11 ` Peter Chen
2020-09-01 8:44 ` [PATCH 2/8] usb: cdns3: gadget: improve the dump TRB operation at cdns3_ep_run_transfer Peter Chen
2020-09-08 6:19 ` Felipe Balbi
2020-09-08 7:11 ` Peter Chen
2020-09-01 8:44 ` [PATCH 3/8] usb: cdns3: gadget: calculate TDL correctly Peter Chen
2020-09-08 6:21 ` Felipe Balbi
2020-09-08 7:15 ` Peter Chen
2020-09-01 8:44 ` [PATCH 4/8] usb: cdns3: gadget: add CHAIN and ISP bit for sg list use case Peter Chen
2020-09-08 6:22 ` Felipe Balbi
2020-09-08 7:21 ` Peter Chen
2020-09-08 7:43 ` Felipe Balbi
2020-09-01 8:44 ` [PATCH 5/8] usb: cdns3: gadget: handle sg list use case at completion correctly Peter Chen
2020-09-08 6:25 ` Felipe Balbi
2020-09-08 8:34 ` Peter Chen
2020-09-10 8:37 ` Peter Chen
2020-09-01 8:44 ` [PATCH 6/8] usb: cdns3: gadget: need to handle sg case for WA2 case Peter Chen
2020-09-08 6:29 ` Felipe Balbi
2020-09-08 9:07 ` Peter Chen [this message]
2020-09-01 8:44 ` [PATCH 7/8] usb: cdns3: gadget: sg_support is only for DEV_VER_V2 or above Peter Chen
2020-09-08 6:30 ` Felipe Balbi
2020-09-08 9:08 ` Peter Chen
2020-09-01 8:44 ` [PATCH 8/8] usb: cdns3: gadget: enlarge the TRB ring length Peter Chen
2020-09-08 6:32 ` Felipe Balbi
2020-09-08 9:18 ` Peter Chen
2020-09-08 9:30 ` 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=20200908090633.GA18578@b29397-desktop \
--to=peter.chen@nxp.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.com \
--cc=rogerq@ti.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 NNTP newsgroup(s).