From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vignesh R Date: Wed, 28 Nov 2018 22:56:04 +0530 Subject: [U-Boot] [RFC PATCH 3/6] spi: spi-mem: Enable all SPI modes In-Reply-To: <20181128172607.10179-1-vigneshr@ti.com> References: <20181128172607.10179-1-vigneshr@ti.com> Message-ID: <20181128172607.10179-4-vigneshr@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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