Add a dummy SPI controller driver, similar to the dummy LPC/FWH/Parallel flasher driver
Does not support reading or writing the fake chip yet.
flashrom --programmer dummy
also enables the dummy SPI controller driver.
Testing the dummy SPI driver revealed a RDID debug printing bug in the
SPI core. Fix that as well.
Corresponding to flashrom svn r507.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/dummyflasher.c b/dummyflasher.c
index ba54206..7e671b8 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -31,6 +31,7 @@
int dummy_init(void)
{
printf_debug("%s\n", __func__);
+ flashbus = BUS_TYPE_DUMMY_SPI;
return 0;
}
@@ -86,3 +87,23 @@
return 0xffffffff;
}
+int dummy_spi_command(unsigned int writecnt, unsigned int readcnt,
+ const unsigned char *writearr, unsigned char *readarr)
+{
+ int i;
+
+ printf_debug("%s:", __func__);
+
+ printf_debug(" writing %u bytes:", writecnt);
+ for (i = 0; i < writecnt; i++)
+ printf_debug(" 0x%02x", writearr[i]);
+
+ printf_debug(" reading %u bytes:", readcnt);
+ for (i = 0; i < readcnt; i++) {
+ printf_debug(" 0xff");
+ readarr[i] = 0xff;
+ }
+
+ printf_debug("\n");
+ return 0;
+}