From bfe2e0cf677ef4609e3eacb337efc669c869f209 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Thu, 14 May 2009 12:59:36 +0000 Subject: 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 Acked-by: Uwe Hermann --- dummyflasher.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'dummyflasher.c') 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; +} -- cgit v1.1