lkml.org 
[lkml]   [2022]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/11] spi: dw: add check for support of dual/quad/octal
Date
Before doing the mem op spi controller will be queried about the
buswidths it supports. Add the dual/quad/octal if the controller
has the DW_SPI_CAP_EXT_SPI capability.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@sifive.com>
---
drivers/spi/spi-dw-core.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c
index 97e72da7c120..77529e359b6d 100644
--- a/drivers/spi/spi-dw-core.c
+++ b/drivers/spi/spi-dw-core.c
@@ -488,8 +488,23 @@ static int dw_spi_adjust_mem_op_size(struct spi_mem *mem, struct spi_mem_op *op)
static bool dw_spi_supports_mem_op(struct spi_mem *mem,
const struct spi_mem_op *op)
{
- if (op->data.buswidth > 1 || op->addr.buswidth > 1 ||
- op->dummy.buswidth > 1 || op->cmd.buswidth > 1)
+ struct dw_spi *dws = spi_controller_get_devdata(mem->spi->controller);
+
+ /*
+ * Only support TT0 mode in enhanced SPI for now.
+ * TT0 = Instruction and Address will be sent in
+ * Standard SPI Mode.
+ */
+ if (op->addr.buswidth > 1 || op->dummy.buswidth > 1 ||
+ op->cmd.buswidth > 1)
+ return false;
+
+ /* In enhanced SPI 1, 2, 4, 8 all are valid modes. */
+ if (op->data.buswidth > 1 && (!(dws->caps & DW_SPI_CAP_EXT_SPI)))
+ return false;
+
+ /* Only support upto 32 bit address in enhanced SPI for now. */
+ if (op->data.buswidth > 1 && op->addr.nbytes > 4)
return false;

return spi_mem_default_supports_op(mem, op);
--
2.30.2
\
 
 \ /
  Last update: 2022-08-02 19:59    [W:0.378 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site