diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2017-03-14 17:47:58 +0100 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-03-16 00:11:42 -0700 |
commit | dd94e6e2ebfcebf31dd4530909ef818299cb8f3e (patch) | |
tree | 57a1d97c43c6684e33ca15c6362f8fd10077a3a4 /chip/stm32/spi_master.c | |
parent | 879b7bc8f13e42123ac2e767d8934f86676ab9b2 (diff) | |
download | chrome-ec-dd94e6e2ebfcebf31dd4530909ef818299cb8f3e.tar.gz |
stm32: clean-up the SPI_READBACK_ALL implementation
As advised by Daisuke makes the new API slightly better:
- remove the useless rxlen assignment.
- keep the normal asynchronous behavior of the function by skipping the
last dma wait.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:35648259
TEST=on Eve, use the FP sensor with the passthru.
Change-Id: Iedb8e77cb1af58c273ab5ae6f0a670ce93dfde5a
Reviewed-on: https://chromium-review.googlesource.com/454699
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'chip/stm32/spi_master.c')
-rw-r--r-- | chip/stm32/spi_master.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/chip/stm32/spi_master.c b/chip/stm32/spi_master.c index 647dcd9e7a..3d7fd070b2 100644 --- a/chip/stm32/spi_master.c +++ b/chip/stm32/spi_master.c @@ -219,7 +219,6 @@ int spi_transaction_async(const struct spi_device_t *spi_device, if (rxlen == SPI_READBACK_ALL) { buf = rxdata; - rxlen = txlen; full_readback = 1; } else { rv = shared_mem_acquire(MAX(txlen, rxlen), &buf); @@ -238,11 +237,14 @@ int spi_transaction_async(const struct spi_device_t *spi_device, if (rv != EC_SUCCESS) goto err_free; + if (full_readback) + return EC_SUCCESS; + rv = spi_dma_wait(port); if (rv != EC_SUCCESS) goto err_free; - if (!full_readback && rxlen) { + if (rxlen) { rv = spi_dma_start(port, buf, rxdata, rxlen); if (rv != EC_SUCCESS) goto err_free; |