On Wed, 14 Jan 2015 16:23:32 +0300 "Amelkin, Aleksandr" Aleksandr.Amelkin@t-platforms.ru wrote:
I noticed that it takes painfully long for flashrom to even simply read a 16MB flash chip using FT2232H (Olimex ARM-USB-TINY-H) programmer.
The time it takes would be appropriate for kHz-range SPI clocks, not for 30MHz SPI clock that FT2232H provides.
I checked with an oscilloscope and found out that there are long multi-millisecond delays between short (~150us) SPI clock bursts during simple chip read operation ('-r' or 'reading old flash chip contents'). The delays are 2ms for native Windows 7 64-bit on an Intel Core-i7 2600 @ 3.4GHz, or as long as 7ms for a Ubuntu Linux running in a virtual box on the same Windows machine.
I didn't look any deeper though.
Has anyone done any profiling or have any ideas as to what may be causing this behavior?
I suspect the main part of this is the latency of the (FTDI) USB protocol. Maybe the performance of the flashrom driver can be improved with bigger buffers/bursts of reads but I am not aware of any obvious bottlenecks.