* usb: dwc3: gadget: Disable CSP for stream OUT ep
@ 2018-12-10 7:21 Tejas Joglekar
0 siblings, 0 replies; 3+ messages in thread
From: Tejas Joglekar @ 2018-12-10 7:21 UTC (permalink / raw)
To: Felipe Balbi, linux-usb; +Cc: John Youn, Tejas Joglekar, thinh.nguyen
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;
+ else
+ trb->ctrl |= DWC3_TRB_CTRL_CSP;
if (short_not_ok)
trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* usb: dwc3: gadget: Disable CSP for stream OUT ep
@ 2018-12-10 8:34 Felipe Balbi
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2018-12-10 8:34 UTC (permalink / raw)
To: Tejas Joglekar, linux-usb; +Cc: John Youn, thinh.nguyen
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* usb: dwc3: gadget: Disable CSP for stream OUT ep
@ 2018-12-10 10:25 Tejas Joglekar
0 siblings, 0 replies; 3+ messages in thread
From: Tejas Joglekar @ 2018-12-10 10:25 UTC (permalink / raw)
To: Felipe Balbi, Tejas Joglekar, linux-usb@vger.kernel.org
Cc: John Youn, thinh.nguyen@synopsys.com
Hi,
On 12/10/2018 2:04 PM, Felipe Balbi wrote:
> 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:
Yeah this is enough... I will send the v2
>
> if (!dep->stream_capable)
> trb->ctrl |= DWC3_TRB_CTRL_CSP;
>
Regards,
Tejas Joglekar
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-10 10:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-10 8:34 usb: dwc3: gadget: Disable CSP for stream OUT ep Felipe Balbi
-- strict thread matches above, loose matches on Subject: below --
2018-12-10 10:25 Tejas Joglekar
2018-12-10 7:21 Tejas Joglekar
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).