Skip to contentSkip to conversation

MLK-12883 usb: limit USB_MAX_XFER_BLK to 256

RFC PATCH New Marcel Ziswiler 2 participants 2 messages Feb 1, 2019 – Apr 10, 2019

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 MLK-12883 usb: limit USB_MAX_XFER_BLK to 256

From: Peng Fan <[email protected]>

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).

(cherry picked from commit df0052575b2bc9d66ae73584768e1a457ed5d914)

---
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.

 common/usb_storage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
common/usb_storage.c +5 -1
index 8c889bb1a6..7420438363 100644
@@ -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 Massstorage devices have issues, limiting this to 256
+	 * fixes this.
+	 */
+	blk = 256;
 #else
 	blk = 20;
 #endif
Signature · 1 line
2.20.1
#1 lore raw

RFC PATCH 1/1 MLK-12883 usb: limit USB_MAX_XFER_BLK to 256

Hi Marcel,

Quoted 9 lines

-----Original Message-----
From: Marcel Ziswiler [mailto:marcel at ziswiler.com]
Sent: 2019年2月2日 0:43
To: u-boot at lists.denx.de
Cc: Peng Fan <[email protected]>; Marcel Ziswiler <[email protected]>; Masahiro Yamada <[email protected]>; Bin Meng <[email protected]>; Sven Schwermer <[email protected]>
Subject: [RFC PATCH v1] MLK-12883 usb: limit USB_MAX_XFER_BLK to 256

Thanks for upstreaming this. The MLK-xxx could be dropped, it is NXP internal tracking number.

Regards,
Peng.

Quoted 50 lines

From: Peng Fan <[email protected]>

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).

from commit df0052575b2bc9d66ae73584768e1a457ed5d914)

---
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.

 common/usb_storage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
common/usb_storage.c index renamed from common/usb_storage.c +0 -0

8c889bb1a6..7420438363 100644

common/usb_storage.c +5 -1
@@ -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 Massstorage devices have issues, limiting this to 256
+	 * fixes this.
+	 */
+	blk = 256;
 #else
 	blk = 20;

#endif
--
2.20.1