dirtyjtag_spi: Add DJTAG2 support

The new DJTAG2 protocol supports special command modifiers to speed
things up:

* NO_READ allows a write without returning the sampled MISO data.
* EXTEND_LENGTH allows to send 32B extra per transfer.

As SPI flash commands are basically half-duplex, we utilize NO_READ
to send all the write data in a first loop and then receive data in
a second loop. Only flash writes can benefit from this and due to
their programming delay the difference is marginal ~2%.

Long reads, OTOH, benefit from the increased transfer size and we
are about 45% faster.

Tested with DJTAG2 on a Blue Pill (STM32F103).

Change-Id: Ie38b309f5865c7704c6b2a85e7437fe2621623d3
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73265
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jean THOMAS <virgule@jeanthomas.me>
1 file changed