From 1b0ba893529cf93ae54b91607d93d3ad49c259e5 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Sun, 20 Jun 2010 10:58:32 +0000 Subject: [PATCH] Add SPI chip read support to the dummy flasher This allows using the dummy flasher for SPI read debugging. Corresponding to flashrom svn r1053. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Sean Nelson --- dummyflasher.c | 8 ++++++++ flash.h | 1 + spi.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dummyflasher.c b/dummyflasher.c index 8ebd6959f..b543222cc 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -23,6 +23,7 @@ #include #include #include "flash.h" +#include "chipdrivers.h" int dummy_init(void) { @@ -157,3 +158,10 @@ int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, msg_pspew("\n"); return 0; } + +int dummy_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len) +{ + /* Maximum read length is unlimited, use 64kB. */ + return spi_read_chunked(flash, buf, start, len, 64 * 1024); +} + diff --git a/flash.h b/flash.h index 13f7981bb..93776f1fc 100644 --- a/flash.h +++ b/flash.h @@ -454,6 +454,7 @@ uint32_t dummy_chip_readl(const chipaddr addr); void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len); int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); +int dummy_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); #endif /* nic3com.c */ diff --git a/spi.c b/spi.c index 2074d21e6..bc80cbd05 100644 --- a/spi.c +++ b/spi.c @@ -99,7 +99,7 @@ const struct spi_programmer spi_programmer[] = { { /* SPI_CONTROLLER_DUMMY */ .command = dummy_spi_send_command, .multicommand = default_spi_send_multicommand, - .read = NULL, + .read = dummy_spi_read, .write_256 = NULL, }, #endif