summaryrefslogtreecommitdiff
path: root/dummyflasher.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-05-14 12:59:36 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-05-14 12:59:36 +0000
commit32d196ef66ff3e120d2db6342eef48d664033e2c (patch)
tree6bd9710ba48b8b27fd99469669e6cc8925ab7043 /dummyflasher.c
parentcf7730874c8c5bcbe7abbc9bcd460766ff5b438a (diff)
downloadflashrom-32d196ef66ff3e120d2db6342eef48d664033e2c.tar.gz
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. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'dummyflasher.c')
-rw-r--r--dummyflasher.c21
1 files changed, 21 insertions, 0 deletions
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 @@ uint32_t dummy_chip_readl(const volatile void *addr)
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;
+}