diff mbox

[U-Boot] usb: fix usb_stor_read/write on DM

Message ID 1499952931-19122-1-git-send-email-yamada.masahiro@socionext.com
State Changes Requested
Delegated to: Marek Vasut
Headers show

Commit Message

Masahiro Yamada July 13, 2017, 1:35 p.m. UTC
Prior to DM, we could not enable different types of USB controllers
at the same time.  DM was supposed to loosen the limitation.  We can
compile drivers, but not working.

For example, if EHCI is enabled, xHCI fails as follows:

  => usb read 82000000 0 2000

  USB read: device 0 block # 0, count 8192 ... WARN halted endpoint, queueing URB anyway.
  Unexpected XHCI event TRB, skipping... (3fb54010 00000001 13000000 01008401)
  BUG: failure at drivers/usb/host/xhci-ring.c:489/abort_td()!
  BUG!
  ### ERROR ### Please RESET the board ###

The cause of the error seems #ifdef CONFIG_USB_EHCI_HCD in
common/usb_storage.c

To fix the problem, align USB_MAX_XFER_BLK to the lowest common
denominator if CONFIG_DM is defined.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut July 13, 2017, 1:38 p.m. UTC | #1
On 07/13/2017 03:35 PM, Masahiro Yamada wrote:
> Prior to DM, we could not enable different types of USB controllers
> at the same time.  DM was supposed to loosen the limitation.  We can
> compile drivers, but not working.
> 
> For example, if EHCI is enabled, xHCI fails as follows:
> 
>   => usb read 82000000 0 2000
> 
>   USB read: device 0 block # 0, count 8192 ... WARN halted endpoint, queueing URB anyway.
>   Unexpected XHCI event TRB, skipping... (3fb54010 00000001 13000000 01008401)
>   BUG: failure at drivers/usb/host/xhci-ring.c:489/abort_td()!
>   BUG!
>   ### ERROR ### Please RESET the board ###
> 
> The cause of the error seems #ifdef CONFIG_USB_EHCI_HCD in
> common/usb_storage.c
> 
> To fix the problem, align USB_MAX_XFER_BLK to the lowest common
> denominator if CONFIG_DM is defined.

Meh, this is a workaround and a pretty bad one. This should be a
per-controller or even per-storage-device(?) knob. Opinions ?

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  common/usb_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index df0b05730879..fa0cf68c3353 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -100,7 +100,7 @@ struct us_data {
>  	trans_cmnd	transport;		/* transport routine */
>  };
>  
> -#ifdef CONFIG_USB_EHCI_HCD
> +#if !defined(CONFIG_DM_USB) && defined(CONFIG_USB_EHCI_HCD)
>  /*
>   * The U-Boot EHCI driver can handle any transfer length as long as there is
>   * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands are
>
diff mbox

Patch

diff --git a/common/usb_storage.c b/common/usb_storage.c
index df0b05730879..fa0cf68c3353 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -100,7 +100,7 @@  struct us_data {
 	trans_cmnd	transport;		/* transport routine */
 };
 
-#ifdef CONFIG_USB_EHCI_HCD
+#if !defined(CONFIG_DM_USB) && defined(CONFIG_USB_EHCI_HCD)
 /*
  * The U-Boot EHCI driver can handle any transfer length as long as there is
  * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands are