Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: haibo.chen@nxp.com
To: broonie@kernel.org, bbrezillon@kernel.org, frieder.schrempf@exceet.de
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, han.xu@nxp.com, chengminglin@mxic.com.tw,
	stable@vger.kernel.org, haibo.chen@nxp.com,
	jason.hui.liu@nxp.com
Subject: [PATCH] spi: spi-mem: check the dummy buswidth only for rx mode
Date: Tue, 10 Dec 2024 19:27:12 +0800	[thread overview]
Message-ID: <20241210112712.483893-1-haibo.chen@nxp.com> (raw)

From: Haibo Chen <haibo.chen@nxp.com>

Dummy usually used for rx, so combine the dummy buswidth check only
for rx mode.

Find issue after commit 98d1fb94ce75 ("mtd: spi-nor: core: replace
dummy buswidth from addr to data") on imx8mn-ddr4-evk board. On this
board, rx=4, tx=1, without the upper commit, chose SNOR_CMD_READ_1_1_4,
after this commit, chose SNOR_CMD_READ(1_1_1). This is because when
dummy buswidth = 4, spi_check_buswidth_req(mem, op->dummy.buswidth, true)
do not return the expected result.

Combine the cmd.buswidth and addr.buswidth check to tx is reasonable,
but for dummy buswidth, need to check the rx mode.

Fixes: c36ff266dc82 ("spi: Extend the core to ease integration of SPI memory controllers")
Cc: stable@vger.kernel.org
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/spi/spi-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index abc6792e738c..bc9f09a9e5a0 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -150,7 +150,7 @@ static bool spi_mem_check_buswidth(struct spi_mem *mem,
 		return false;
 
 	if (op->dummy.nbytes &&
-	    spi_check_buswidth_req(mem, op->dummy.buswidth, true))
+	    spi_check_buswidth_req(mem, op->dummy.buswidth, false))
 		return false;
 
 	if (op->data.dir != SPI_MEM_NO_DATA &&
-- 
2.34.1


                 reply	other threads:[~2024-12-10 11:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20241210112712.483893-1-haibo.chen@nxp.com \
    --to=haibo.chen@nxp.com \
    --cc=bbrezillon@kernel.org \
    --cc=broonie@kernel.org \
    --cc=chengminglin@mxic.com.tw \
    --cc=frieder.schrempf@exceet.de \
    --cc=han.xu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=jason.hui.liu@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=stable@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