Skip to contentSkip to conversation

mtd: spi-nor: micron-st: Enable die erase support for MT35XU02GCBA

PATCH Superseded Haoyu Lu 2 participants 3 messages Mar 31

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Haoyu Lu

author
#0 lore raw

PATCH v2 1/1 mtd: spi-nor: micron-st: Enable die erase support for MT35XU02GCBA

The MT35XU02GCBA flash device does not support chip erase according to its datasheet, but supports die erase. The existing code had a TODO comment noting that the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled and the driver implementation needs to be converted to use die erase.

This patch enables the SPI_NOR_IO_MODE_EN_VOLATILE flag and adds the mt35_two_die_fixups to the MT35XU02GCBA entry, which includes the micron_st_nor_two_die_late_init() function that sets up die erase support.

With these changes, the flash device can properly use die erase operations instead of chip erase.

---
v2: Remove TODO comment and rename mt35xu01gbba_fixups to mt35_two_die_fixups per review.

 drivers/mtd/spi-nor/micron-st.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/micron-st.c +3 -4
index 4e8c6ef14697..c22d62545391 100644
@@ -185,7 +185,7 @@ static const struct spi_nor_fixups mt35xu512aba_fixups = {
 	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
 };
 
-static const struct spi_nor_fixups mt35xu01gbba_fixups = {
+static const struct spi_nor_fixups mt35_two_die_fixups = {
 	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
 	.late_init = micron_st_nor_two_die_late_init,
 };
@@ -202,7 +202,7 @@ static const struct flash_info micron_nor_parts[] = {
 		.id = SNOR_ID(0x2c, 0x5b, 0x1b),
 		.mfr_flags = USE_FSR,
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
-		.fixups = &mt35xu01gbba_fixups,
+		.fixups = &mt35_two_die_fixups,
 	}, {
 		/*
 		 * The MT35XU02GCBA flash device does not support chip erase,
@@ -212,7 +212,6 @@ static const struct flash_info micron_nor_parts[] = {
 		 * MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably
 		 * needs to be enabled.
 		 *
-		 * TODO: Fix these and test on real hardware.
 		 */
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
 		.name = "mt35xu02g",
@@ -221,7 +220,7 @@ static const struct flash_info micron_nor_parts[] = {
 		.no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ,
 		.mfr_flags = USE_FSR,
 		.fixup_flags = SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE,
-		.fixups = &mt35xu01gbba_fixups,
+		.fixups = &mt35_two_die_fixups,
 	},
 };
 
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 44 lines · Haoyu Lu

The MT35XU02GCBA flash device does not support chip erase according to its datasheet, but supports die erase. The existing code had a TODO comment noting that the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled and the driver implementation needs to be converted to use die erase.

This patch enables the SPI_NOR_IO_MODE_EN_VOLATILE flag and adds the mt35_two_die_fixups to the MT35XU02GCBA entry, which includes the micron_st_nor_two_die_late_init() function that sets up die erase support.

With these changes, the flash device can properly use die erase operations instead of chip erase.

---
v2: Remove TODO comment and rename mt35xu01gbba_fixups to mt35_two_die_fixups per review.

 drivers/mtd/spi-nor/micron-st.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/micron-st.c +2 -2
index 4e8c6ef14697..c22d62545391 100644
@@ -185,7 +185,7 @@ static const struct spi_nor_fixups mt35xu512aba_fixups = {
 	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
 };
 
-static const struct spi_nor_fixups mt35xu01gbba_fixups = {
+static const struct spi_nor_fixups mt35_two_die_fixups = {
 	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
 	.late_init = micron_st_nor_two_die_late_init,
 };
@@ -202,7 +202,7 @@ static const struct flash_info micron_nor_parts[] = {
 		.id = SNOR_ID(0x2c, 0x5b, 0x1b),
 		.mfr_flags = USE_FSR,
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
-		.fixups = &mt35xu01gbba_fixups,
+		.fixups = &mt35_two_die_fixups,
 	}, {
 		/*
 		 * The MT35XU02GCBA flash device does not support chip erase,

drivers/mtd/spi-nor/micron-st.c static const struct flash_info micron_nor_parts[] = { · line 215

Quoted 4 lines
drivers/mtd/spi-nor/micron-st.c +0 -1
@@ -212,7 +212,6 @@ static const struct flash_info micron_nor_parts[] = {
 		 * MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably
 		 * needs to be enabled.
 		 *
-		 * TODO: Fix these and test on real hardware.

I meant to drop the whole comment. But no problem, I can do that when applying.

Thanks for the patch!

Quoted 12 lines
drivers/mtd/spi-nor/micron-st.c +1 -1
 		 */
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
 		.name = "mt35xu02g",
@@ -221,7 +220,7 @@ static const struct flash_info micron_nor_parts[] = {
 		.no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ,
 		.mfr_flags = USE_FSR,
 		.fixup_flags = SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE,
-		.fixups = &mt35xu01gbba_fixups,
+		.fixups = &mt35_two_die_fixups,
 	},
 };
 
Signature · 2 lines
Regards,
Pratyush Yadav
maintainer
#2 lore raw
In reply to Haoyu Lu

Hi Haoyu,

Quoted 11 lines · Haoyu Lu

The MT35XU02GCBA flash device does not support chip erase according to its datasheet, but supports die erase. The existing code had a TODO comment noting that the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled and the driver implementation needs to be converted to use die erase.

This patch enables the SPI_NOR_IO_MODE_EN_VOLATILE flag and adds the mt35_two_die_fixups to the MT35XU02GCBA entry, which includes the micron_st_nor_two_die_late_init() function that sets up die erase support.

Quoted 4 lines

With these changes, the flash device can properly use die erase operations instead of chip erase.

I tried applying this patch and it fails to apply. It seems you have sent the v2 on top of your v1 patch. You should do the v2 as a fresh patch on top of spi-nor/next with all the changes, and not a incremental version on top of v1.

Please squash your two patches and resend.

[...]

Signature · 2 lines
Regards,
Pratyush Yadav