When there is 0 bytes to read, BusPirate doesn't send any confirmation (and application needs to guess how long it needs to sleep to use SPI again without interfering).
Flashrom uses write-then-read without read to send commands (e.g. erase, program page). It waits for confirmation byte, which never arrives, so flashrom hangs.
This patch fixes the problem. I tested that the confirmation byte is sent and that flashrom no longer hangs.
In binary SPI mode, the write-then-read command is supposed to send a confirmation byte (
0x01
) when the operation is complete. This happens inspi_read_to_uart
, which is called only whenread > 0
.When there is 0 bytes to read, BusPirate doesn't send any confirmation (and application needs to guess how long it needs to sleep to use SPI again without interfering).
Flashrom uses write-then-read without read to send commands (e.g. erase, program page). It waits for confirmation byte, which never arrives, so flashrom hangs.
This patch fixes the problem. I tested that the confirmation byte is sent and that flashrom no longer hangs.