summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Ming Lin <chengminglin@mxic.com.tw>2024-11-12 15:52:42 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-05 14:02:51 +0100
commit77f53f49ad628429cf0664d3df3ee7df41b4a7d8 (patch)
tree11965dfdf8ab6aa4dd0d2848b5764cb231985b9d
parent97b68bda72f7b1340c15c12150623c2728f897b9 (diff)
downloadlinux-77f53f49ad628429cf0664d3df3ee7df41b4a7d8.tar.gz
linux-77f53f49ad628429cf0664d3df3ee7df41b4a7d8.tar.bz2
linux-77f53f49ad628429cf0664d3df3ee7df41b4a7d8.zip
mtd: spi-nor: core: replace dummy buswidth from addr to data
commit 98d1fb94ce75f39febd456d6d3cbbe58b6678795 upstream. 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. Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol") Cc: stable@vger.kernel.org Reviewed-by: Pratyush Yadav <pratyush@kernel.org> Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw> Link: https://lore.kernel.org/r/20241112075242.174010-2-linchengming884@gmail.com Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mtd/spi-nor/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 9d6e85bf227b..8c57df44c40f 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);