diff mbox

[U-Boot,06/11] usb: dwc3: add a workaround for too small OUT requests

Message ID 1424700152-8554-7-git-send-email-l.majewski@samsung.com
State Awaiting Upstream
Delegated to: Łukasz Majewski
Headers show

Commit Message

Łukasz Majewski Feb. 23, 2015, 2:02 p.m. UTC
From: Marek Szyprowski <m.szyprowski@samsung.com>

DWC3 hangs on OUT requests smaller than maxpacket size,
so HACK the request length to be at least equal to maxpacket size.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/usb/dwc3/gadget.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kishon Vijay Abraham I Feb. 23, 2015, 2:24 p.m. UTC | #1
Hi,

On Monday 23 February 2015 07:32 PM, Lukasz Majewski wrote:
> From: Marek Szyprowski <m.szyprowski@samsung.com>
>
> DWC3 hangs on OUT requests smaller than maxpacket size,
> so HACK the request length to be at least equal to maxpacket size.

Curious to know using which gadget this issue was seen.

Thanks
Kishon

>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>   drivers/usb/dwc3/gadget.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 01bc83b..f8a75d3 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -974,6 +974,12 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
>   	req->direction		= dep->direction;
>   	req->epnum		= dep->number;
>
> +	/* DWC3 hangs on OUT requests smaller than maxpacket size,
> +	   so HACK the request length */
> +	if (dep->direction == 0 &&
> +	    req->request.length < dep->endpoint.maxpacket)
> +		req->request.length = dep->endpoint.maxpacket;
> +
>   	/*
>   	 * We only add to our list of requests now and
>   	 * start consuming the list once we get XferNotReady
>
Łukasz Majewski Feb. 23, 2015, 2:44 p.m. UTC | #2
Hi Kishon,

> Hi,
> 
> On Monday 23 February 2015 07:32 PM, Lukasz Majewski wrote:
> > From: Marek Szyprowski <m.szyprowski@samsung.com>
> >
> > DWC3 hangs on OUT requests smaller than maxpacket size,
> > so HACK the request length to be at least equal to maxpacket size.
> 
> Curious to know using which gadget this issue was seen.

We have been testing this code with USB Mass Storage, Thor and DFU
gadgets.

In the v2 commit letter you have stated that this code was tested with
DFU MMC:

>> Testing:
>> *) tested DFU RAM and DFU MMC in dra7xx and am43xx

Have you tried to run test at ./test/dfu directory?

> 
> Thanks
> Kishon
> 
> >
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > ---
> >   drivers/usb/dwc3/gadget.c | 6 ++++++
> >   1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index 01bc83b..f8a75d3 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -974,6 +974,12 @@ static int __dwc3_gadget_ep_queue(struct
> > dwc3_ep *dep, struct dwc3_request *req)
> > req->direction		= dep->direction;
> > req->epnum		= dep->number;
> >
> > +	/* DWC3 hangs on OUT requests smaller than maxpacket size,
> > +	   so HACK the request length */
> > +	if (dep->direction == 0 &&
> > +	    req->request.length < dep->endpoint.maxpacket)
> > +		req->request.length = dep->endpoint.maxpacket;
> > +
> >   	/*
> >   	 * We only add to our list of requests now and
> >   	 * start consuming the list once we get XferNotReady
> >
Kishon Vijay Abraham I Feb. 24, 2015, 1:23 p.m. UTC | #3
Hi,

On Monday 23 February 2015 08:14 PM, Lukasz Majewski wrote:
> Hi Kishon,
>
>> Hi,
>>
>> On Monday 23 February 2015 07:32 PM, Lukasz Majewski wrote:
>>> From: Marek Szyprowski <m.szyprowski@samsung.com>
>>>
>>> DWC3 hangs on OUT requests smaller than maxpacket size,
>>> so HACK the request length to be at least equal to maxpacket size.
>>
>> Curious to know using which gadget this issue was seen.
>
> We have been testing this code with USB Mass Storage, Thor and DFU
> gadgets.

nice!
>
> In the v2 commit letter you have stated that this code was tested with
> DFU MMC:
>
>>> Testing:
>>> *) tested DFU RAM and DFU MMC in dra7xx and am43xx
>
> Have you tried to run test at ./test/dfu directory?

Haven't seen that before. I download images MLO, u-boot.img, uImage, fdt etc 
using dfu and do a boot test using the downloaded images.

Will try using the ./test/dfu directory.

Thanks
Kishon
diff mbox

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 01bc83b..f8a75d3 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -974,6 +974,12 @@  static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
 	req->direction		= dep->direction;
 	req->epnum		= dep->number;
 
+	/* DWC3 hangs on OUT requests smaller than maxpacket size,
+	   so HACK the request length */
+	if (dep->direction == 0 &&
+	    req->request.length < dep->endpoint.maxpacket)
+		req->request.length = dep->endpoint.maxpacket;
+
 	/*
 	 * We only add to our list of requests now and
 	 * start consuming the list once we get XferNotReady