mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: JaimeLiao <jaimeliao.tw@gmail.com>
To: broonie@kernel.org, krzysztof.kozlowski@linaro.org,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jaimeliao@mxic.com.tw, JaimeLiao <jaimeliao.tw@gmail.com>
Subject: [PATCH v1 1/2] spi: spi-rpc-if: Add support for Octal DTR mode
Date: Thu, 24 Nov 2022 15:39:56 +0800	[thread overview]
Message-ID: <20221124073957.22471-2-jaimeliao.tw@gmail.com> (raw)
In-Reply-To: <20221124073957.22471-1-jaimeliao.tw@gmail.com>

Add Octal DTR mode support

Signed-off-by: JaimeLiao <jaimeliao.tw@gmail.com>
---
 drivers/spi/spi-rpc-if.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index 24ec1c83f379..f2c365c10610 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -26,10 +26,20 @@ static void rpcif_spi_mem_prepare(struct spi_device *spi_dev,
 	rpc_op.cmd.opcode = spi_op->cmd.opcode;
 	rpc_op.cmd.buswidth = spi_op->cmd.buswidth;
 
+	if (spi_op->cmd.dtr) {
+		rpc_op.cmd.opcode = spi_op->cmd.opcode >> 8;
+		rpc_op.ocmd.opcode = spi_op->cmd.opcode;
+		rpc_op.ocmd.buswidth = spi_op->cmd.buswidth;
+		rpc_op.cmd.ddr = spi_op->cmd.dtr;
+		rpc_op.ocmd.ddr = spi_op->cmd.dtr;
+	}
+
 	if (spi_op->addr.nbytes) {
 		rpc_op.addr.buswidth = spi_op->addr.buswidth;
 		rpc_op.addr.nbytes = spi_op->addr.nbytes;
 		rpc_op.addr.val = spi_op->addr.val;
+		if (spi_op->addr.dtr)
+			rpc_op.addr.ddr = spi_op->addr.dtr;
 	}
 
 	if (spi_op->dummy.nbytes) {
@@ -41,6 +51,8 @@ static void rpcif_spi_mem_prepare(struct spi_device *spi_dev,
 	if (spi_op->data.nbytes || (offs && len)) {
 		rpc_op.data.buswidth = spi_op->data.buswidth;
 		rpc_op.data.nbytes = spi_op->data.nbytes;
+		if (spi_op->data.dtr)
+			rpc_op.data.ddr = spi_op->data.dtr;
 		switch (spi_op->data.dir) {
 		case SPI_MEM_DATA_IN:
 			rpc_op.data.dir = RPCIF_DATA_IN;
@@ -67,8 +79,8 @@ static bool rpcif_spi_mem_supports_op(struct spi_mem *mem,
 	if (!spi_mem_default_supports_op(mem, op))
 		return false;
 
-	if (op->data.buswidth > 4 || op->addr.buswidth > 4 ||
-	    op->dummy.buswidth > 4 || op->cmd.buswidth > 4 ||
+	if (op->data.buswidth > 8 || op->addr.buswidth > 8 ||
+	    op->dummy.buswidth > 8 || op->cmd.buswidth > 8 ||
 	    op->addr.nbytes > 4)
 		return false;
 
@@ -153,7 +165,8 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 	ctlr->mem_ops = &rpcif_spi_mem_ops;
 
 	ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
-	ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_TX_QUAD | SPI_RX_QUAD;
+	ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_TX_QUAD | SPI_RX_QUAD |
+			  SPI_TX_OCTAL | SPI_RX_OCTAL;
 	ctlr->flags = SPI_CONTROLLER_HALF_DUPLEX;
 
 	error = rpcif_hw_init(rpc, false);
-- 
2.17.1


  reply	other threads:[~2022-11-24  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  7:39 [PATCH v1 0/2] Add Octal DTR support on RPC driver JaimeLiao
2022-11-24  7:39 ` JaimeLiao [this message]
2022-11-24  7:39 ` [PATCH v1 2/2] memory: renesas-rpc-if: Add Octal DTR mode support JaimeLiao
2022-11-24 13:36   ` Krzysztof Kozlowski
2022-11-30 14:34   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221124073957.22471-2-jaimeliao.tw@gmail.com \
    --to=jaimeliao.tw@gmail.com \
    --cc=broonie@kernel.org \
    --cc=jaimeliao@mxic.com.tw \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®