path: root/programmer.h
diff options
authorCarl-Daniel Hailfinger <>2010-09-15 00:17:37 +0000
committerCarl-Daniel Hailfinger <>2010-09-15 00:17:37 +0000
commit2822888c810eaf2d68271f4dac4a0ad639221fd3 (patch)
treea6e81bc8cf557252479496bc3a655c1981b6303e /programmer.h
parentec489e4ec65ec416a6c41ded6d5eae0b6ebd7103 (diff)
SPI bitbanging: request/release bus
SPI bitbanging on devices which speak SPI natively has a dual-use problem: We need to shut down normal SPI operations to do the bitbanging ourselves. Once we're done, it makes a lot of sense to reenable "normal" SPI operations again. Add request_bus/release_bus functions to struct bitbang_spi_master. Add a bitbang shutdown function (not used yet). Change MCP SPI and Intel NIC SPI to use the new request/release bus infrastructure. Cosmetic changes to a few error messages (80 column limit). There are multiple possible strategies for bus request/release: - Request at the start of a SPI command, release immediately afterwards. - Request at the start of a SPI multicommand, release once all commands of the multicommand are done. - Request on programmer init, release on shutdown. Each strategy has its own advantages. For now, we will stay with the first strategy which worked fine so far. Corresponding to flashrom svn r1171. Signed-off-by: Carl-Daniel Hailfinger <> Acked-by: Uwe Hermann <>
Diffstat (limited to 'programmer.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/programmer.h b/programmer.h
index 0d8e161..6407695 100644
--- a/programmer.h
+++ b/programmer.h
@@ -131,6 +131,8 @@ struct bitbang_spi_master {
void (*set_sck) (int val);
void (*set_mosi) (int val);
int (*get_miso) (void);
+ void (*request_bus) (void);
+ void (*release_bus) (void);
@@ -443,6 +445,7 @@ int mcp6x_spi_init(int want_spi);
/* bitbang_spi.c */
int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod);
+int bitbang_spi_shutdown(const struct bitbang_spi_master *master);
int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
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, int start, int len);
OpenPOWER on IntegriCloud