[U-Boot] [RFC PATCH 3/6] spi: spi-mem: Enable all SPI modes
Vignesh R
vigneshr at ti.com
Wed Nov 28 17:26:04 UTC 2018
SPI controllers can support Dual/Quad modes, therefore remove this
constraint. Also, add claim and release bus when call spi_mem calls as
well.
Signed-off-by: Vignesh R <vigneshr at ti.com>
---
drivers/spi/spi-mem.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index af9aef009a73..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);
@@ -323,15 +329,6 @@ int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
return -EIO;
#else
- /* U-Boot does not support parallel SPI data lanes */
- if ((op->cmd.buswidth != 1) ||
- (op->addr.nbytes && op->addr.buswidth != 1) ||
- (op->dummy.nbytes && op->dummy.buswidth != 1) ||
- (op->data.nbytes && op->data.buswidth != 1)) {
- printf("Dual/Quad raw SPI transfers not supported\n");
- return -ENOTSUPP;
- }
-
if (op->data.nbytes) {
if (op->data.dir == SPI_MEM_DATA_IN)
rx_buf = op->data.buf.in;
--
2.19.2
More information about the U-Boot
mailing list