Skip to contentSkip to conversation

spi: spi-mem: check the dummy buswidth only for rx mode

PATCH New [email protected] 1 participant 1 message Dec 10, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-mem: check the dummy buswidth only for rx mode

From: Haibo Chen <[email protected]>

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")
---
 drivers/spi/spi-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-mem.c +1 -1
index abc6792e738c..bc9f09a9e5a0 100644
@@ -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 &&
Signature · 1 line
2.34.1