On Mon, Apr 25, 2011 at 5:53 PM, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> wrote:
Hi,

Am 26.04.2011 00:43 schrieb David Hendricks:

I'm using Flashrom with an FTDI FT4232H to read a 1MB SPI ROM (w25q80), but
am encountering difficulties. I believe we may be missing some steps in
ft2232_spi_init(), however I don't have much experience with libftdi or usb
debugging so I hope someone on the list does :-)

When the programmer is plugged into a "full-speed" USB port slow, things
seem to work well. However, when plugged into a "high-speed" port, bytes
simply disappear. There does not seem to be a pattern with regard to where
the problems start. Sometimes it will fail very early and Flashrom will not
be able to detect the chip. Sometimes we'll get lucky and we can read the
full chip. It can fail anywhere in between.

The only pattern I've seen is that usb bulk reads return less than the
requested number of bytes before it fails entirely. For example, if we
request 256 bytes, then it might return 256-N data bytes. libftdi will
request the remaining bytes, and libusb will provide the remaining N data
bytes. On the next 256-byte request, libusb will not return any data bytes
(only the 2-byte USB header).
 

This is a known problem which may happen with older (>6 months) libftdi and/or older kernels (>6 months) and/or older libusb. The libftdi mailing list probably has more information. If you can reproduce the issue with a recent kernel (2.6.36 or newer) and recent libusb and libftdi from git, please tell the libftdi mailing list.
IIRC some flashrom patch (sent in the last 6 months or so) tried to make sure that such issues are worked around in flashrom by requiring recent libftdi and by setting a parameter which reduces the likelihood of that event. Sorry, I don't have more details handy right now.

Quick follow up -- I got a chance to try flashrom out with the FT4232H out on machine with a 2.6.38 kernel and it worked great, EHCI high speed and all :-)

Thanks for the pointer!

--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.