[U-Boot] [RFC PATCH v2 02/11] spi-mem: Claim SPI bus before spi mem access
Vignesh R
vigneshr at ti.com
Tue Dec 4 12:26:50 UTC 2018
It is necessary to call spi_claim_bus() before starting any SPI
transactions and this restriction would also apply when calling spi-mem
operationss. Therefore claim and release bus before requesting transfer
via exec_op.
Signed-off-by: Vignesh R <vigneshr at ti.com>
---
drivers/spi/spi-mem.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 1da20b8de5c4..4c1463118ab2 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -231,7 +231,13 @@ int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
mutex_lock(&ctlr->bus_lock_mutex);
mutex_lock(&ctlr->io_mutex);
#endif
+ ret = spi_claim_bus(slave);
+ if (ret < 0)
+ return ret;
+
ret = ops->mem_ops->exec_op(slave, op);
+
+ spi_release_bus(slave);
#ifndef __UBOOT__
mutex_unlock(&ctlr->io_mutex);
mutex_unlock(&ctlr->bus_lock_mutex);
--
2.19.2
More information about the U-Boot
mailing list