Author: hailfinger
Date: Sun Jun 20 12:58:32 2010
New Revision: 1053
URL: http://flashrom.org/trac/coreboot/changeset/1053

Log:
Add SPI chip read support to the dummy flasher. This allows using the
dummy flasher for SPI read debugging.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>
Acked-by: Sean Nelson <[email protected]>

Modified:
   trunk/dummyflasher.c
   trunk/flash.h
   trunk/spi.c

Modified: trunk/dummyflasher.c
==============================================================================
--- trunk/dummyflasher.c        Sun Jun 20 12:41:35 2010        (r1052)
+++ trunk/dummyflasher.c        Sun Jun 20 12:58:32 2010        (r1053)
@@ -23,6 +23,7 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include "flash.h"
+#include "chipdrivers.h"
 
 int dummy_init(void)
 {
@@ -157,3 +158,10 @@
        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);
+}
+

Modified: trunk/flash.h
==============================================================================
--- trunk/flash.h       Sun Jun 20 12:41:35 2010        (r1052)
+++ trunk/flash.h       Sun Jun 20 12:58:32 2010        (r1053)
@@ -454,6 +454,7 @@
 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 */

Modified: trunk/spi.c
==============================================================================
--- trunk/spi.c Sun Jun 20 12:41:35 2010        (r1052)
+++ trunk/spi.c Sun Jun 20 12:58:32 2010        (r1053)
@@ -99,7 +99,7 @@
        { /* SPI_CONTROLLER_DUMMY */
                .command = dummy_spi_send_command,
                .multicommand = default_spi_send_multicommand,
-               .read = NULL,
+               .read = dummy_spi_read,
                .write_256 = NULL,
        },
 #endif

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to