Skip to contentSkip to conversation

Lower USB_MAX_XFER_BLK to 32767 by default for trimslice

PATCH New Nicolas Chauvet 2 participants 4 messages May 26, 2016 – May 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Lower USB_MAX_XFER_BLK to 32767 by default for trimslice

I'm experiencing an issue when loading a generic distro initramfs on trimslice-pro (with ssd using ehci) with the default value of 65535 for USB_MAX_XFER_BLK
EHCI timed out on TD - token=0x80008d80

As adviced by Marek on IRC, using a lower value for USB_MAX_XFER_BLK allows to load the file

Tested values on tegra20-trimslice:
4095 ok
32767 ok
32768 timeout
36864 timeout
40960 timeout
49150 timeout

Tested on current u-boot master

---
 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/usb_storage.c +1 -1
index 7e6e52d..c69a7f7 100644
@@ -106,7 +106,7 @@ struct us_data {
  * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands are
  * limited to 65535 blocks.
  */
-#define USB_MAX_XFER_BLK	65535
+#define USB_MAX_XFER_BLK	32767
 #else
 #define USB_MAX_XFER_BLK	20
 #endif
Signature · 1 line
2.4.11
#1 lore raw

PATCH 1/1 Lower USB_MAX_XFER_BLK to 32767 by default for trimslice

Quoted 16 lines · Nicolas Chauvet

I'm experiencing an issue when loading a generic distro initramfs on trimslice-pro (with ssd using ehci) with the default value of 65535 for USB_MAX_XFER_BLK
EHCI timed out on TD - token=0x80008d80

As adviced by Marek on IRC, using a lower value for USB_MAX_XFER_BLK allows to load the file

Tested values on tegra20-trimslice:
4095 ok
32767 ok
32768 timeout
36864 timeout
40960 timeout
49150 timeout

Quoted 1 line

Tested on current u-boot master

I don't really like adding such patch which affects many devices just to fix one particular device which is crappy. If you could add some quirk table into u-boot instead and lower this number only for those buggy devices, that'd be much better.

Quoted 19 lines
---
 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/usb_storage.c +1 -1
index 7e6e52d..c69a7f7 100644
@@ -106,7 +106,7 @@ struct us_data {
  * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands are
  * limited to 65535 blocks.
  */
-#define USB_MAX_XFER_BLK	65535
+#define USB_MAX_XFER_BLK	32767
 #else
 #define USB_MAX_XFER_BLK	20
 #endif
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/1 Lower USB_MAX_XFER_BLK to 32767 for trimslice

In reply to Nicolas Chauvet

I'm experiencing an issue when loading a generic distro initramfs on trimslice-pro (with ssd using usb-ehci) with the default value of 65535 for USB_MAX_XFER_BLK
EHCI timed out on TD - token=0x80008d80

As adviced by Marek on IRC, using a lower value for USB_MAX_XFER_BLK allows to load the file

Tested values on tegra20-trimslice:
4095 ok
32767 ok
32768 timeout
36864 timeout
40960 timeout
49150 timeout

v2:
- Allow to override if undefined when using CONFIG_USB_EHCI
- Only change the value for trimslice
- Update description

---
 common/usb_storage.c        | 2 ++
 include/configs/trimslice.h | 2 ++
 2 files changed, 4 insertions(+)
common/usb_storage.c +2 -0
index 7e6e52d..aea0477 100644
@@ -106,7 +106,9 @@ struct us_data {
  * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands are
  * limited to 65535 blocks.
  */
+#ifndef USB_MAX_XFER_BLK	 /* Allows a quirk for broken devices */
 #define USB_MAX_XFER_BLK	65535
+#endif
 #else
 #define USB_MAX_XFER_BLK	20
 #endif
include/configs/trimslice.h +2 -0
index b761640..3a2fe87 100644
@@ -43,6 +43,8 @@
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_TEGRA
 #define CONFIG_USB_STORAGE
+/* Quirk for broken usb-ehci on trimslice */
+#define USB_MAX_XFER_BLK 32767
 
 /* USB networking support */
 #define CONFIG_USB_HOST_ETHER
Signature · 1 line
2.4.11
#3 lore raw

PATCH 1/1 Lower USB_MAX_XFER_BLK to 32767 for trimslice

Quoted 16 lines · Nicolas Chauvet

I'm experiencing an issue when loading a generic distro initramfs on trimslice-pro (with ssd using usb-ehci) with the default value of 65535 for USB_MAX_XFER_BLK
EHCI timed out on TD - token=0x80008d80

As adviced by Marek on IRC, using a lower value for USB_MAX_XFER_BLK allows to load the file

Tested values on tegra20-trimslice:
4095 ok
32767 ok
32768 timeout
36864 timeout
40960 timeout
49150 timeout

Quoted 1 line

v2:

This should go below diffstat, so it's not part of the commit message

Quoted 2 lines

- Allow to override if undefined when using CONFIG_USB_EHCI
- Only change the value for trimslice

This will annoy trimslice users then ;-)

Quoted 1 line

- Update description

Going back to my comment about V1:

If you could add some quirk table into u-boot instead and lower this number only for those buggy devices, that'd be much better.

Quoted 11 lines
---
 common/usb_storage.c        | 2 ++
 include/configs/trimslice.h | 2 ++
 2 files changed, 4 insertions(+)
common/usb_storage.c +0 -0
index 7e6e52d..aea0477 100644

common/usb_storage.c struct us_data { · line 111

Quoted 6 lines
common/usb_storage.c +2 -0
@@ -106,7 +106,9 @@ struct us_data {
  * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands are
  * limited to 65535 blocks.
  */
+#ifndef USB_MAX_XFER_BLK	 /* Allows a quirk for broken devices */
 #define USB_MAX_XFER_BLK	65535
+#endif

This has multiple problems:
a) This override is added only for EHCI while it is generic and would work for all USB revisions
b) Any such override should be added to Kconfig instead
c) Tweaking this value will negatively impact multiple devices only to fix problems on a small amount of crappy devices (see above)

Quoted 17 lines
common/usb_storage.c +0 -0
 #else
 #define USB_MAX_XFER_BLK	20
 #endif
include/configs/trimslice.h +2 -0
index b761640..3a2fe87 100644
@@ -43,6 +43,8 @@
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_TEGRA
 #define CONFIG_USB_STORAGE
+/* Quirk for broken usb-ehci on trimslice */
+#define USB_MAX_XFER_BLK 32767
 
 /* USB networking support */
 #define CONFIG_USB_HOST_ETHER
Signature · 2 lines
Best regards,
Marek Vasut