diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-07-22 15:36:50 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-07-22 15:36:50 +0000 |
commit | 83226cf65e500744ee4b593f66ad7820a75dff63 (patch) | |
tree | f63fae957dd853e016abfffdd8fff62ffb2ebb1f /ichspi.c | |
parent | 56c7181f6dbc4c1461060fc2fe066bfd9fd6c7a7 (diff) | |
download | flashrom-83226cf65e500744ee4b593f66ad7820a75dff63.zip flashrom-83226cf65e500744ee4b593f66ad7820a75dff63.tar.gz |
Replace most of the switch cases in the spi code with lookup on a struct instead
This brings the SPI code in line with the generic programmer infrastructure.
This patch is a reworked version of a patch by Jakob Bornecrantz.
Corresponding to flashrom svn r657.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Jakob Bornecrantz <wallbraker@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'ichspi.c')
-rw-r--r-- | ichspi.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -742,3 +742,23 @@ int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt, return result; } + +int ich_spi_send_multicommand(struct spi_command *spicommands) +{ + int ret = 0; + while ((spicommands->writecnt || spicommands->readcnt) && !ret) { + ret = ich_spi_send_command(spicommands->writecnt, spicommands->readcnt, + spicommands->writearr, spicommands->readarr); + /* This awful hack needs to be smarter. + */ + if ((ret == SPI_INVALID_OPCODE) && + ((spicommands->writearr[0] == JEDEC_WREN) || + (spicommands->writearr[0] == JEDEC_EWSR))) { + printf_debug(" due to SPI master limitation, ignoring" + " and hoping it will be run as PREOP\n"); + ret = 0; + } + spicommands++; + } + return ret; +} |