1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

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>
This commit is contained in:
Carl-Daniel Hailfinger
2009-05-14 12:59:36 +00:00
parent d02b73f9e9
commit bfe2e0cf67
3 changed files with 33 additions and 3 deletions

View File

@ -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;
}