dediprog: Implement multi-i/o reads
This implements i/o-mode switches and opcode handling for multi-i/o
reads with protocol versions 2 and 3. The mode switching is done by
a simple command that takes an enum just as our internal `io_mode`
as argument.
The opcode handling differs between protocol versions. For protocol
v2, we keep the current behavior for single-i/o operations and only
set the matching opcode. Tests with an SF600Plus-G2 have shown that
the programmer automatically chooses the address length and number
of dummy cycles. It is unknown, however, if it chooses these para-
meters based on the opcode or the configured i/o mode. For dual-out
reads, it seems to choose the wrong number of dummy cycles. Hence,
we mask the respective support bit for the v2 case.
For protocol v3, a new `read mode' was discovered in traces of the
Dediprog Windows application. It allows to explicitly specify the
opcode, the address length, and the number of dummy cycles. We call
this READ_MODE_CONFIGURABLE. As this is the only way to make use of
the additional command bytes of the v3 protocol, we can assume that
this mode always works with v3.
For partial reads, i.e. not multiples of 512B blocks, that have to
go through dediprog_spi_send_command(), we temporarily disable the
chosen `.spi_fast_read` function. This is necessary, because multi-
io is not supported on this path.
We enable dual i/o by default for protocol v3 devices. This should
work out of the box with many compatible flash chips. The command-
line logic is a little convoluted this way, but can be refactored
once protocol v2 devices are tested.
Change-Id: Ib07b1b61eccc19c7ead9f64c980b37feabfa70a8
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/114
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashprog.8.tmpl b/flashprog.8.tmpl
index 70e21af..c8f35d7 100644
--- a/flashprog.8.tmpl
+++ b/flashprog.8.tmpl
@@ -323,7 +323,7 @@
.sp
.BR "* buspirate_spi" " (for SPI flash ROMs attached to a Bus Pirate)"
.sp
-.BR "* dediprog" " (for SPI flash ROMs attached to a Dediprog SF100)"
+.BR "* dediprog" " (for SPI flash ROMs attached to a Dediprog SF100/SF200/SF600/SF700)"
.sp
.BR "* rayer_spi" " (for SPI flash ROMs attached to a parallel port by one of various cable types)"
.sp
@@ -1105,6 +1105,16 @@
can be
.BR 1 " or " 2
to select target chip 1 or 2 respectively. The default is target chip 1.
+.sp
+Dediprog SF600 and SF700 programmer models support dual and quad i/o.
+The default is dual i/o on newer models with protocol v3 and single i/o
+otherwise. The mode can be set with the
+.B iomode
+parameter. Valid values are
+.BR single ", " dual ", or " quad .
+For instance, to enable quad i/o
+.sp
+.B " flashprog \-p dediprog:iomode=quad"
.SS
.BR "rayer_spi " programmer
.IP