[flashrom] [PATCH/FULL/SVN] Support for 4-bytes addressing SPI flash chips 32MB+ (256Mb+)
dev at borisbaykov.com
Thu Jan 15 21:49:06 CET 2015
> Flashrom is slow because read and erase operations are written very slow
> now. They could be easily changed to become faster in times or in 10s of
> times. Probably I'll do this later. This should be another patch.
I'll try to describe where these issues are...
The read issue is in spi_read_chunked. There is a loop that reads data by
pages (normally by 256 bytes). So, to read 32 MB flash we'll send 131k
read commands with 3-7 ms wait for each. This is really painfully slow.
However we don't have to read by 256 byte chunks. We are able to read by
larger pieces or even by one 32 MB piece. From the datasheet for FT2232H
we know that it supports USB 2.0 and has maximum transfer rate around 40
Mb/s, it's enough. Then it's easy to patch spi_read_chunked to read by
larger pieces than 256 B or all at one go. To do than we might need to
decrease SPI freq to 15 or 7.5 MHz but it's not so critical for time
comparing to 256 byte chunks.
The erase issue is near walk_eraseregions. To make it faster an algorithm
to choose proper eraser should be added. Now first eraser is mostly used.
The first is usually 4k eraser. To erase a flash chip it's better to use
64k eraser or full chip erase. Now 4k eraser only is used for all flash
memory of a chip. This is very slow and can be changed too.
I hope it will help,
More information about the flashrom