public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: core: replace dummy buswidth from addr to data
@ 2024-11-07  9:30 Cheng Ming Lin
  2024-11-07 17:00 ` Pratyush Yadav
  2024-11-11 10:18 ` Tudor Ambarus
  0 siblings, 2 replies; 7+ messages in thread
From: Cheng Ming Lin @ 2024-11-07  9:30 UTC (permalink / raw)
  To: tudor.ambarus, pratyush, mwalle, miquel.raynal, richard, vigneshr,
	linux-mtd, linux-kernel
  Cc: alvinzhou, leoyu, Cheng Ming Lin

From: Cheng Ming Lin <chengminglin@mxic.com.tw>

The default dummy cycle for Macronix SPI NOR flash in Octal Output
Read Mode(1-1-8) is 20.

Currently, the dummy buswidth is set according to the address bus width.
In the 1-1-8 mode, this means the dummy buswidth is 1. When converting
dummy cycles to bytes, this results in 20 x 1 / 8 = 2 bytes, causing the
host to read data 4 cycles too early.

Since the protocol data buswidth is always greater than or equal to the
address buswidth. Setting the dummy buswidth to match the data buswidth
increases the likelihood that the dummy cycle-to-byte conversion will be
divisible, preventing the host from reading data prematurely.

Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
---
 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index f9c189ed7353..c7aceaa8a43f 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -89,7 +89,7 @@ void spi_nor_spimem_setup_op(const struct spi_nor *nor,
 		op->addr.buswidth = spi_nor_get_protocol_addr_nbits(proto);
 
 	if (op->dummy.nbytes)
-		op->dummy.buswidth = spi_nor_get_protocol_addr_nbits(proto);
+		op->dummy.buswidth = spi_nor_get_protocol_data_nbits(proto);
 
 	if (op->data.nbytes)
 		op->data.buswidth = spi_nor_get_protocol_data_nbits(proto);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-11-12  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07  9:30 [PATCH] mtd: spi-nor: core: replace dummy buswidth from addr to data Cheng Ming Lin
2024-11-07 17:00 ` Pratyush Yadav
2024-11-11 10:18 ` Tudor Ambarus
2024-11-12  2:42   ` Cheng Ming Lin
2024-11-12  6:45     ` Tudor Ambarus
2024-11-12  7:06       ` Tudor Ambarus
2024-11-12  7:16         ` Cheng Ming Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox