From 5cca01f3943d888f9ee5f1efcf9faa0269bf8533 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Tue, 24 Nov 2009 00:20:03 +0000 Subject: Cleanly validate ICH SPI preopcodes The code should work on Linux/*BSD/MacOSX and relies on the serial code implementation in serial.c. Support for additional platforms (Windows) will have to be added to serial.c for this to work. For tests without a Bus Pirate (or with non-functional serial code) it is possible to #define FAKE_COMMUNICATION in buspirate_spi.c. Thanks to Sean Nelson for the SPI mode settings code. I tweaked it a bit to make configuration from a commandline easier should anybody want that feature. Tested-by: Sean Nelson Corresponding to flashrom svn r772. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Stefan Reinauer Acked-by: Sean Nelson --- flash.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'flash.h') diff --git a/flash.h b/flash.h index 9f6a8bed4..b271b8ac0 100644 --- a/flash.h +++ b/flash.h @@ -103,6 +103,9 @@ enum programmer { #endif #if SERPROG_SUPPORT == 1 PROGRAMMER_SERPROG, +#endif +#if BUSPIRATE_SPI_SUPPORT == 1 + PROGRAMMER_BUSPIRATESPI, #endif PROGRAMMER_INVALID /* This must always be the last entry. */ }; @@ -484,6 +487,12 @@ int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf); +/* buspirate_spi.c */ +int buspirate_spi_init(void); +int buspirate_spi_shutdown(void); +int buspirate_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); +int buspirate_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); + /* flashrom.c */ extern char *programmer_param; extern int verbose; @@ -526,6 +535,9 @@ enum spi_controller { #endif #if DUMMY_SUPPORT == 1 SPI_CONTROLLER_DUMMY, +#endif +#if BUSPIRATE_SPI_SUPPORT == 1 + SPI_CONTROLLER_BUSPIRATE, #endif SPI_CONTROLLER_INVALID /* This must always be the last entry. */ }; -- cgit v1.2.3