summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2017-01-10 06:25:57 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2017-01-10 21:18:23 +0100
commit85b2b27e3309fcd783b825682dd715bee089ad01 (patch)
treed5196301bb83d52327146dd9f6d01488b6cb9ab7
parent5153cbfeb3498b75efdde6c7aa312d5920541702 (diff)
downloadcoreboot-85b2b27e3309fcd783b825682dd715bee089ad01.tar.xz
SPI: Fix command-response behavior
Fix SPI flash ops regressions after commit: c2973d1 spi: Get rid of SPI_ATOMIC_SEQUENCING When spi_flash_cmd() is called with argument response==NULL, only send out command without reading back the response. Change-Id: I28a94f208b4a1983d45d69d46db41391e267891d Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/18082 Tested-by: build bot (Jenkins) Reviewed-by: Timothy Pearson <tpearson@raptorengineering.com> Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
-rw-r--r--src/drivers/spi/spi_flash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index a0e310554a..95362f2618 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -49,11 +49,14 @@ static int do_spi_flash_cmd(const struct spi_slave *spi, const void *dout,
[1] = { .dout = NULL, .bytesout = 0,
.din = din, .bytesin = bytes_in },
};
+ size_t count = ARRAY_SIZE(vectors);
+ if (!bytes_in)
+ count = 1;
if (spi_claim_bus(spi))
return ret;
- if (spi_xfer_vector(spi, vectors, ARRAY_SIZE(vectors)) == 0)
+ if (spi_xfer_vector(spi, vectors, count) == 0)
ret = 0;
spi_release_bus(spi);