[flashrom] [PATCH] FT2232 error checking

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Fri Nov 20 03:09:42 CET 2009


Hi Paul, hi Richard,

I remember that one of you mentioned occassional verify failures with
flashrom and the FT2232 code.
The good news is that we recently got a report from another user (Jeremy
Buseman) with whom we could track down some of the issues to timing and
to deficiencies in the software/hardware stack. Running flashrom in
non-verbose mode and with a limit of 36 bytes per SPI command (1 opcode,
3 address, 32 data) gave him 100% reliable results.
I also have a patch pending which allows a specialized test pattern to
be burned, and the results were surprising: Sometimes, the last two
bytes of a 64-byte block are simply missing, then the next 64-byte block
is moved two bytes in the direction of lower addresses, and so on. For
page (256 byte) reads, this could result in up to 8 bytes at the end
being undefined because some or all 64-byte subpages had been trimmed.
Besides that, verbose mode seems to have thrown off the timing enough to
cause read/write errors as well. In theory, that should not happen (and
libftdi/libusb should ensure consistent behaviour), but reality seems a
bit disillusioning.

If you could review the patch below which adds some error checking to
give at least some indications on where the problems may lie, I'd
appreciate it. It is entirely possible that you won't get additional
warnings from the patch, but I'd like to run it past you because you
seem to be responsible for the largest FT2232 flashrom deployment. If
you think the patch is OK, please respond with
> Acked-by: Your Name <your at email>

On 10.11.2009 04:07, Carl-Daniel Hailfinger wrote:
> Pretty much everybody who used the FT2232 SPI driver in flashrom had
> problems with incorrect reads from time to time.
> One reason was that the hardware is pretty timing sensitive even for reads.
>
> The other reason was that the code silently ignored errors. This patch
> doesn't add any error recovery, but it will emit error messages if
> FT2232 communication goes wrong. That allows us to track down errors
> without investing hours in driver debugging.
>
> Jeremy, I'd be very interested in the results of an unmodified flashrom
> with only this patch applied (read is sufficient). In theory, you should
> either get a working read or loads of error messages about
> send_buf/read_buf. If you get no error messages and the image read is
> still wrong, libftdi doesn't tell us about the problem. Oh, and please
> try in verbose and normal mode. Maybe there's a difference.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>   

In case you're not subscribed to the flashrom mailing list, you can
download the patch here:
http://patchwork.coreboot.org/patch/549/raw/

Regards,
Carl-Daniel

-- 
Developer quote of the month: 
"We are juggling too many chainsaws and flaming arrows and tigers."





More information about the flashrom mailing list