[PATCH] usb: ehci: Fix "EHCI timed out on TD - token=XXXX" error on ehci-hcd

Tom Rini trini at konsulko.com
Wed Feb 26 17:05:31 CET 2020


On Wed, Feb 26, 2020 at 12:29:55PM +0100, Lukasz Majewski wrote:

> This patch aims to improve robustness of 'usb' command operation on the
> ehci-hcd IP block as it ports to contemporary U-Boot the patch described
> and provided in [1] (originally applicable to U-Boot 2016.05).
> 
> According to the fix author - "rayvt" (from [1]):
> 
> TD stands for "Queue Element Transfer Descriptor (qTD)", which is a micro-code
> instruction for the EHCI USB chip.
> The "token" field is detailed information, control, and status of the TD's data
> transfer. In particular, the rightmost byte is the status field. 0x80 bit means
> the TD is active and the data transfer has not yet completed. 0x08 bit means
> there was some sort of data transfer error (XactErr).
> 
> If the drive gets a transfer error, it refuses to do any other I/O transfer
> until the error is properly cleared and reset. U-boot did not do this, so every
> subsequent disk read would get a timeout error because the drive would not send
> any data. The fix is to properly clear and reset the USB disk when it gets a
> transfer error.
> 
> Every read operation starts at the maximum block size. When the USB pendrive is
> not able to correctly serve this data read request, the dynamic reduction of IO
> size is performed. Up to six tries (with smaller IO block each time) are
> attempted.
> 
> A related problem is that some drives are slow to come up. Linux handles this by
> issuing a spinup command and allowing more time for the drive to respond. The
> same idea is applied in this fix.
> 
> On TPC70 (i.MX6Q) once per ~10 times (without this patch):
> 
> Bus usb at 2184200: USB EHCI 1.00
> scanning bus usb at 2184200 for devices... 2 USB Device(s) found
>        scanning usb for storage devices... 1 Storage Device(s) found
> EHCI timed out on TD - token=0x1f8c80
> 
> Performance impact:
> 
> With U-Boot -master in mainline:
> 16869440 bytes read in 979 ms (16.4 MiB/s)
> 
> With this patch:
> 16869440 bytes read in 1219 ms (13.2 MiB/s)
> 
> Links:
> [1] - https://forum.doozan.com/read.php?3,35295,35295#msg-35295
> [2] - https://www.dropbox.com/s/nrkrd1no63viuu8/uboot-bodhi-2016.05-timeoutTD.patch?dl=0
> 
> Signed-off-by: Lukasz Majewski <lukma at denx.de>
> [Unfortunately, the original patch [2] did not contain S-o-B from the original
> author - "rayvt"]

This problem was seen in Beagleboard xM as well and reported by
Guillaume back in January, so:
Reported-by: Guillaume Gardet <Guillaume.Gardet at arm.com>

And on board, I can confirm the problem also goes away now so:

Tested-by: Tom Rini <trini at konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200226/c3915680/attachment.sig>


More information about the U-Boot mailing list