Skip to contentSkip to conversation

mtd: spi-nor: spansion: fix die erase support

PATCH Applied [email protected] 4 participants 7 messages May 27 – May 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover mtd: spi-nor: spansion: fix die erase support

From: Takahiro Kuwano <[email protected]>

Changes in v2:
- Collected trailers
- Fixed author email in headers

Takahiro Kuwano (2):
mtd: spi-nor: spansion: use die erase for multi-die devices only
mtd: spi-nor: spansion: add die erase support in s28hx-t

 drivers/mtd/spi-nor/spansion.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 mtd: spi-nor: spansion: use die erase for multi-die devices only

From: Takahiro Kuwano <[email protected]>

Die erase opcode is supported in multi-die devices only. For single die devices, default chip erase opcode must be used.

In s25hx_t_late_init(), die erase opcode is set only when the device is multi-die.

Fixes 461d0babb544 ("mtd: spi-nor: spansion: enable die erase for multi die flashes")
---
 drivers/mtd/spi-nor/spansion.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/spansion.c +3 -1
index 8498c7003d88..b6023076903a 100644
@@ -674,7 +674,9 @@ static int s25hx_t_late_init(struct spi_nor *nor)
 	params->ready = cypress_nor_sr_ready_and_clear;
 	cypress_nor_ecc_init(nor);
 
-	params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE;
+	if (params->n_dice > 1)
+		params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE;
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: spansion: use die erase for multi-die devices only

Quoted 8 lines · On Wed May 27, 2026 at 11:05 AM CEST, tkuw584924 wrote:

From: Takahiro Kuwano <[email protected]>

Die erase opcode is supported in multi-die devices only. For single die devices, default chip erase opcode must be used.

In s25hx_t_late_init(), die erase opcode is set only when the device is multi-die.

Quoted 6 lines
Fixes 461d0babb544 ("mtd: spi-nor: spansion: enable die erase for multi die flashes")
#3 lore raw

PATCH v2 2/2 mtd: spi-nor: spansion: add die erase support in s28hx-t

In reply to [email protected]

From: Takahiro Kuwano <[email protected]>

S28Hx-T family has multi-die devices that support die erase opcode. Update die erase opcode when the device is multi-die.

---
 drivers/mtd/spi-nor/spansion.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/spi-nor/spansion.c +3 -0
index b6023076903a..65227d989de1 100644
@@ -762,6 +762,9 @@ static int s28hx_t_late_init(struct spi_nor *nor)
 	params->ready = cypress_nor_sr_ready_and_clear;
 	cypress_nor_ecc_init(nor);
 
+	if (params->n_dice > 1)
+		params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE;
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
maintainer
#4 lore raw

Re: [PATCH v2 2/2] mtd: spi-nor: spansion: add die erase support in s28hx-t

Quoted 18 lines · On Wed May 27, 2026 at 11:05 AM CEST, tkuw584924 wrote:

From: Takahiro Kuwano <[email protected]>

S28Hx-T family has multi-die devices that support die erase opcode. Update die erase opcode when the device is multi-die.

---
 drivers/mtd/spi-nor/spansion.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/spi-nor/spansion.c +0 -0
index b6023076903a..65227d989de1 100644

drivers/mtd/spi-nor/spansion.c static int s28hx_t_late_init(struct spi_nor *nor) · line 767

Quoted 6 lines
drivers/mtd/spi-nor/spansion.c +3 -0
@@ -762,6 +762,9 @@ static int s28hx_t_late_init(struct spi_nor *nor)
 	params->ready = cypress_nor_sr_ready_and_clear;
 	cypress_nor_ecc_init(nor);
 
+	if (params->n_dice > 1)
+		params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE;
+

So this seems to be a common theme for the spansion/cypress flashes. Does it make sense to have a .mfr_flag USE_DIE_ERASE or SUPPORTS_DIE_ERASE that can be set in the flash entry instead of having many different fixups?

-michael

#5 lore raw

RE: [PATCH v2 2/2] mtd: spi-nor: spansion: add die erase support in s28hx-t

Quoted 23 lines · On Wed May 27, 2026 at 11:05 AM CEST, tkuw584924 wrote:
Quoted 21 lines

From: Takahiro Kuwano <[email protected]>

S28Hx-T family has multi-die devices that support die erase opcode. Update die erase opcode when the device is multi-die.

---
 drivers/mtd/spi-nor/spansion.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/spi-nor/spansion.c +0 -0
index b6023076903a..65227d989de1 100644
@@ -762,6 +762,9 @@ static int s28hx_t_late_init(struct spi_nor *nor)
 	params->ready = cypress_nor_sr_ready_and_clear;
 	cypress_nor_ecc_init(nor);
 
Quoted 8 lines

drivers/mtd/spi-nor/spansion.c static int s28hx_t_late_init(struct spi_nor *nor) · line 767

Quoted 3 lines
drivers/mtd/spi-nor/spansion.c +3 -0
+	if (params->n_dice > 1)
+		params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE;
+

So this seems to be a common theme for the spansion/cypress flashes. Does it make sense to have a .mfr_flag USE_DIE_ERASE or SUPPORTS_DIE_ERASE that can be set in the flash entry instead of having many different fixups?

Yes, actually I plan to cleanup spansion.c later on, by using mfr_flags. There are common features (incl. die-erase) across the device families that appear in different fixups. I think I need to consolidate them and reduce the number of fixup functions.

Thanks,
Takahiro