summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot-mainline/files/0003-usb-limit-USB_MAX_XFER_BLK-to-256.patch
blob: 58526af067537d4c7943b4c0c7f05949d2346f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 70e00d1f20c331a1da991abc7b36f0f6a20751dc Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Mon, 6 Jun 2016 13:53:43 +0800
Subject: [PATCH 03/19] usb: limit USB_MAX_XFER_BLK to 256

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 <peng.fan@nxp.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
(cherry picked from commit df0052575b2bc9d66ae73584768e1a457ed5d914)

Series-to: u-boot@lists.denx.de

Series-prefix: RFC

Series-version: 3

Series-changes: 2
- Fixed spelling in comment as suggested by Igor.

Series-changes: 3
- Drop the reference to the NXP internal MLK-xxx tracking number as
  suggested by Peng.

Commit-notes:
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.
END
---
 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.14.5