[PATCH v3 2/5] mtd: spi-nor: micron-st: move set_octal_dtr to late_init()

Haibo Chen posted 5 patches 2 months, 4 weeks ago
There is a newer version of this series
[PATCH v3 2/5] mtd: spi-nor: micron-st: move set_octal_dtr to late_init()
Posted by Haibo Chen 2 months, 4 weeks ago
Move params->set_octal_dtr from flash_info->fixups->default_init()
to spi_nor_manufacturer-> fixups-> late_init(), this can cover
all Micorn and ST chips without repeat in each chip's flash_info.

With this, we can also remove flash_info->size if chip has SFDP.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/mtd/spi-nor/micron-st.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 92eb14ca76c57f29ece1edb3fe652c56d1c2888f..81a9bead1434056cce0893c97bd35ea248c15894 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -159,11 +159,6 @@ static int micron_st_nor_two_die_late_init(struct spi_nor *nor)
 	return spi_nor_set_4byte_addr_mode(nor, true);
 }
 
-static void mt35xu512aba_default_init(struct spi_nor *nor)
-{
-	nor->params->set_octal_dtr = micron_st_nor_set_octal_dtr;
-}
-
 static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)
 {
 	/* Set the Fast Read settings. */
@@ -187,7 +182,6 @@ static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)
 }
 
 static const struct spi_nor_fixups mt35xu512aba_fixups = {
-	.default_init = mt35xu512aba_default_init,
 	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
 };
 
@@ -635,6 +629,8 @@ static int micron_st_nor_late_init(struct spi_nor *nor)
 	if (!params->set_4byte_addr_mode)
 		params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_wren_en4b_ex4b;
 
+	params->set_octal_dtr = micron_st_nor_set_octal_dtr;
+
 	return 0;
 }
 

-- 
2.34.1
Re: [PATCH v3 2/5] mtd: spi-nor: micron-st: move set_octal_dtr to late_init()
Posted by Tudor Ambarus 2 months, 4 weeks ago

On 11/12/25 8:48 AM, Haibo Chen wrote:
> Move params->set_octal_dtr from flash_info->fixups->default_init()
> to spi_nor_manufacturer-> fixups-> late_init(), this can cover
> all Micorn and ST chips without repeat in each chip's flash_info.
> 
> With this, we can also remove flash_info->size if chip has SFDP.

you could remove flash_info->size when chip has SFDP even before
your patch, as params->size is first initialized with
flash_info->size and then overwritten with the flash size read
from SFDP.

So this comment is misleading and has to be dropped. With that:
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>