[PATCH v16 6/8] mtd: spi-nor: Do not change nor->params->addr_nbytes at 4BAIT parsing time
tkuw584924 at gmail.com
tkuw584924 at gmail.com
Thu Jun 9 01:57:43 PDT 2022
From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
At the 4BAIT parsing time, we need to keep nor->params->addr_nbytes value
as it may be used as current address mode in SMPT parse and device specific
hooks.
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus at microchip.com>
---
Changes in v16:
- Update commit message and description
drivers/mtd/spi-nor/core.c | 2 ++
drivers/mtd/spi-nor/sfdp.c | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 883df4c47e4e..c6c7d1fd19bc 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2643,6 +2643,8 @@ static int spi_nor_quad_enable(struct spi_nor *nor)
static int spi_nor_set_addr_nbytes(struct spi_nor *nor)
{
if (nor->params->addr_nbytes) {
+ if (nor->flags & SNOR_F_HAS_4BAIT)
+ nor->params->addr_nbytes = 4;
nor->addr_nbytes = nor->params->addr_nbytes;
} else if (nor->read_proto == SNOR_PROTO_8_8_8_DTR) {
/*
diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index 3a48173a2d78..f72947a97981 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -1098,7 +1098,6 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
* Spansion memory. However this quirk is no longer needed with new
* SFDP compliant memories.
*/
- params->addr_nbytes = 4;
nor->flags |= SNOR_F_4B_OPCODES | SNOR_F_HAS_4BAIT;
/* fall through */
--
2.25.1
More information about the linux-mtd
mailing list