Patchwork [U-Boot] problem with USB storage STALL status

login
register
mail settings
Submitter Anton Vasilyev
Date March 4, 2013, 8:42 a.m.
Message ID <CALy29_0wpHEbVH3orjg-RWN41eKXDarRgY+Az0kucyG87i3kKg@mail.gmail.com>
Download mbox | patch
Permalink /patch/224649/
State Not Applicable
Delegated to: Marek Vasut
Headers show

Comments

Anton Vasilyev - March 4, 2013, 8:42 a.m.
Hello,

Separating DATA phase and STATUS phase by mdelay(1) helps me solve current
problem.

  &actlen, USB_CNTL_TIMEOUT*5);




I din't find any explanation for this delay in USB specification, but at
Linux Kernel I found similar separation (drivers/usb/storage.c):

/* Some USB-IDE converter chips need a 100us delay between the
 * command phase and the data phase.  Some devices need a little
 * more than that, probably because of clock rate inaccuracies. */
Wolfgang Denk - March 4, 2013, 11:12 a.m.
Dear Anton Vasilyev,

In message <CALy29_0wpHEbVH3orjg-RWN41eKXDarRgY+Az0kucyG87i3kKg@mail.gmail.com> you wrote:
>
> Separating DATA phase and STATUS phase by mdelay(1) helps me solve current
> problem.
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index fb322b4..ea88536 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -740,6 +740,7 @@ static int usb_stor_BBB_transport(ccb *srb, struct
> us_data *us)
>  st:
>   retry = 0;
>  again:
> + mdelay(1);
>   USB_STOR_PRINTF("STATUS phase\n");
>   result = usb_bulk_msg(us->pusb_dev, pipein, csw, UMASS_BBB_CSW_SIZE,
>   &actlen, USB_CNTL_TIMEOUT*5);

Indentation is all wrong, and there is no SoB line.

> I din't find any explanation for this delay in USB specification, but at
> Linux Kernel I found similar separation (drivers/usb/storage.c):
> 
> /* Some USB-IDE converter chips need a 100us delay between the
>  * command phase and the data phase.  Some devices need a little
>  * more than that, probably because of clock rate inaccuracies. */

Are you sure that you really need 1000 us, instead of the 100 us given
here?  On which exact device does this happen?  Do other devices work
with shorter delays?

Best regards,

Wolfgang Denk

Patch

diff --git a/common/usb_storage.c b/common/usb_storage.c
index fb322b4..ea88536 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -740,6 +740,7 @@  static int usb_stor_BBB_transport(ccb *srb, struct
us_data *us)
 st:
  retry = 0;
 again:
+ mdelay(1);
  USB_STOR_PRINTF("STATUS phase\n");
  result = usb_bulk_msg(us->pusb_dev, pipein, csw, UMASS_BBB_CSW_SIZE,