[PATCH v10 1/4] mtd: spi-nor: sfdp: Use nor->info->addr_width as address width for SMPT parse
tkuw584924 at gmail.com
tkuw584924 at gmail.com
Sun Apr 10 22:23:22 PDT 2022
From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
At the point spi_nor_smpt_addr_width() is called, nor->addr_width is set
to 4 while the S25HS/HL-T boots with 3 byte addressing by default and SMPT
parse cannot be done correctly. To solve this, use nor->info->addr_width
as default and current address width.
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
---
This is an alternative way to fix
https://patchwork.ozlabs.org/project/linux-mtd/patch/20201212115817.5122-1-vigneshr@ti.com/
drivers/mtd/spi-nor/sfdp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index a5211543d30d..9f8897e7fd7c 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -652,6 +652,13 @@ static u8 spi_nor_smpt_addr_width(const struct spi_nor *nor, const u32 settings)
case SMPT_CMD_ADDRESS_LEN_4:
return 4;
case SMPT_CMD_ADDRESS_LEN_USE_CURRENT:
+ /*
+ * Let's assume 'nor->info->addr_width' has the default address
+ * width and it is currently in use, if available.
+ */
+ if (nor->info->addr_width)
+ return nor->info->addr_width;
+ fallthrough;
default:
return nor->addr_width;
}
--
2.25.1
More information about the linux-mtd
mailing list