linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Tejas Joglekar <tejas.joglekar@synopsys.com>, linux-usb@vger.kernel.org
Cc: John Youn <john.youn@synopsys.com>, thinh.nguyen@synopsys.com
Subject: usb: dwc3: gadget: Disable CSP for stream OUT ep
Date: Mon, 10 Dec 2018 10:34:04 +0200	[thread overview]
Message-ID: <87k1kh232b.fsf@linux.intel.com> (raw)

Tejas Joglekar <tejas.joglekar@synopsys.com> writes:

> In stream mode, when fast-forwarding TRBs, the stream number
> is not cleared causing the new stream to not get assigned. So
> we don't want controller to carry on transfers when short packet
> is received. So disable the CSP for stream capable endpoint.
>
> This is based on the 3.30a Programming guide, where table 3-1
> device descriptor structure field definitions says for CSP bit
> If this bit is 0, the controller generates an XferComplete event
> and remove the stream. So if we keep CSP as 1 then switching between
> streams would not happen as in stream mode, when fast-forwarding
> TRBs, the stream number is not cleared causing the new stream to not get
> assigned.
>
> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
> ---
>  drivers/usb/dwc3/gadget.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f1089ec..0d2afc1 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -986,9 +986,15 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb,
>  				usb_endpoint_type(dep->endpoint.desc));
>  	}
>  
> -	/* always enable Continue on Short Packet */
> +	/*
> +	 * Enable Continue on Short Packet
> +	 * when endpoint is not a stream capable
> +	 */
>  	if (usb_endpoint_dir_out(dep->endpoint.desc)) {
> -		trb->ctrl |= DWC3_TRB_CTRL_CSP;
> +		if (dep->stream_capable)
> +			trb->ctrl &= ~DWC3_TRB_CTRL_CSP;

Is this necessary? Or would it be enough to have this as:

		if (!dep->stream_capable)
			trb->ctrl |= DWC3_TRB_CTRL_CSP;

             reply	other threads:[~2018-12-10  8:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10  8:34 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-12-10 10:25 usb: dwc3: gadget: Disable CSP for stream OUT ep Tejas Joglekar
2018-12-10  7:21 Tejas Joglekar

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=87k1kh232b.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=john.youn@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=tejas.joglekar@synopsys.com \
    --cc=thinh.nguyen@synopsys.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).