From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sven Schwermer Date: Wed, 24 Apr 2019 09:32:55 +0200 Subject: [U-Boot] [RFC PATCH v3] usb: limit USB_MAX_XFER_BLK to 256 In-Reply-To: <20190417234558.11856-1-marcel@ziswiler.com> References: <20190417234558.11856-1-marcel@ziswiler.com> Message-ID: <860883F6-2E9C-40D0-929E-FD7BB1B74441@svenschwermer.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Hi, I am using an iMX7 with a DataTraveler 3.0 and I’m seeing the same timeout error. However, I have CONFIG_DM_USB=y configured so your patch doesn’t fix my issue. The USB class queries the EHCI driver for its maximum transfer size which is SIZE_MAX. I believe a solution that works with DM is necessary. => usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 300mA) Kingston DataTraveler 3.0 50E54942694AE23017A55884 => usb storage Device 0: Vendor: Kingston Rev: PMAP Prod: DataTraveler 3.0 Type: Removable Hard Disk Capacity: 59184.0 MB = 57.7 GB (121208832 x 512) Best regards, Sven > On 18 Apr 2019, at 01:45, Marcel Ziswiler wrote: > > From: Peng Fan > > For Some USB mass storage devices, such as: > " > - Kingston DataTraveler 2.0 001D7D06CF09B04199C7B3EA > - Class: (from Interface) Mass Storage > - PacketSize: 64 Configurations: 1 > - Vendor: 0x0930 Product 0x6545 Version 1.16 > " > When `usb read 0x80000000 0 0x2000`, we met > "EHCI timed out on TD - token=0x80008d80". > > The devices does not support scsi VPD page, we are not able > to get the maximum transfer length for READ(10)/WRITE(10). > > So we limit this to 256 blocks as READ(6). > > Signed-off-by: Peng Fan > Acked-by: Marcel Ziswiler > (cherry picked from commit df0052575b2bc9d66ae73584768e1a457ed5d914) > > Signed-off-by: Marcel Ziswiler > > --- > This comes from NXP's downstream and has proven to tremendously improve > the situation with those odd USB mass storage aka memory sticks. This is > why I post it here asking whether or not this may be something > benefiting more people. Any feedback and suggestions are welcome. > > Changes in v3: > - Drop the reference to the NXP internal MLK-xxx tracking number as > suggested by Peng. > > Changes in v2: > - Fixed spelling in comment as suggested by Igor. > > common/usb_storage.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/common/usb_storage.c b/common/usb_storage.c > index 8c889bb1a6..4e284645f5 100644 > --- a/common/usb_storage.c > +++ b/common/usb_storage.c > @@ -949,7 +949,11 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev, > * there is enough free heap space left, but the SCSI READ(10) and > * WRITE(10) commands are limited to 65535 blocks. > */ > - blk = USHRT_MAX; > + /* > + * Some USB mass storage devices have issues, limiting this to 256 > + * fixes this. > + */ > + blk = 256; > #else > blk = 20; > #endif > -- > 2.20.1 >