Skip to contentSkip to conversation

mtd: spi-nor: micron-st: few clean up for micron spi nor chip

PATCH Applied Haibo Chen 3 participants 11 messages Nov 12, 2025 – Nov 18, 2025

Subsystems (3)
lore
Share & tools
lore

Haibo Chen

author
#0 lore raw

v4 cover mtd: spi-nor: micron-st: few clean up for micron spi nor chip

mt35xu02gcba, mt35xu01gbba and mt35xu512aba are similar, but with different number of dies. According to the datasheet:
https://datasheet.octopart.com/MT35XU02GCBA1G12-0AAT-Micron-datasheet-138896808.pdf
these chips all support die erase command, but do not support chip erase. But accroding to test, mt35xu512aba support chip erase, do not support die erase. mt35xu01gbba do not support chip erase, but support die erase.
This patch set clean up the mt35xu512aba, and add mt35xu01gbba. since do not have mt35xu02gcba to do the test, just add some comment under mt35xu02gcba for further work.

---
Changes in v4:
- PATCH 2: change the commit log accroding to Tudor's suggestion.
- PATCH 3/4: remove sector_size, SFDP alredy contain this info.
- PATCH 5: change the commit message according to Tudor's suggestion.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- only change the commit message of PATCH4, no other change.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- PATCH 1: edit the commit message, mention the function move a bit up, and add Tudor's ack.
- PATCH 2: new involved in v2, move set_octal_dtr to late_init() to benifit all micron/st chips.
- PATCH 3: v1 add die erase for mt35xu512aba, but find it is wrong after test. mt35xu512aba can support chip erase, but not die erase. v2 also remove some fixup flags and size, because mt35xu512aba has SFDP.
- PATCH 4: V2 use SFDP, remove some fixup flags and size.
- PATCH 5: V2 remove the code change for mt35xu02gcba, because has no chip to test, just add some comment to remider a code change in future if has a chance to test on this chip.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Haibo Chen (5):
mtd: spi-nor: micron-st: rename the die_late_init functions
mtd: spi-nor: micron-st: move set_octal_dtr to late_init()
mtd: spi-nor: micron-st: use SFDP of mt35xu512aba
mtd: spi-nor: micron-st: add mt35xu01gbba support
mtd: spi-nor: micron-st: add comment for mt35xu02gcba

 drivers/mtd/spi-nor/micron-st.c | 101 +++++++++++++++++++++++-----------------
 1 file changed, 57 insertions(+), 44 deletions(-)

---
base-commit: b179ce312bafcb8c68dc718e015aee79b7939ff0
change-id: 20251107-nor-84fe07ec3363

Best regards,

Signature · 1 line
Haibo Chen <[email protected]>
author
#1 lore raw

PATCH v4 1/5 mtd: spi-nor: micron-st: rename the die_late_init functions

st_nor_two/four_die_late_init() also suit for micron chips, so rename to micron_st_nor_two/four_die_late_init(), and move these functions up, then micron can use these function without declaration.

---
 drivers/mtd/spi-nor/micron-st.c | 70 ++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 35 deletions(-)
drivers/mtd/spi-nor/micron-st.c +35 -35
index 187239ccd549510c6e9a6eacf4ae41158287e077..92eb14ca76c57f29ece1edb3fe652c56d1c2888f 100644
@@ -127,6 +127,38 @@ static int micron_st_nor_set_octal_dtr(struct spi_nor *nor, bool enable)
 			micron_st_nor_octal_dtr_dis(nor);
 }
 
+static int micron_st_nor_four_die_late_init(struct spi_nor *nor)
+{
+	struct spi_nor_flash_parameter *params = nor->params;
+
+	params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
+	params->n_dice = 4;
+
+	/*
+	 * Unfortunately the die erase opcode does not have a 4-byte opcode
+	 * correspondent for these flashes. The SFDP 4BAIT table fails to
+	 * consider the die erase too. We're forced to enter in the 4 byte
+	 * address mode in order to benefit of the die erase.
+	 */
+	return spi_nor_set_4byte_addr_mode(nor, true);
+}
+
+static int micron_st_nor_two_die_late_init(struct spi_nor *nor)
+{
+	struct spi_nor_flash_parameter *params = nor->params;
+
+	params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
+	params->n_dice = 2;
+
+	/*
+	 * Unfortunately the die erase opcode does not have a 4-byte opcode
+	 * correspondent for these flashes. The SFDP 4BAIT table fails to
+	 * consider the die erase too. We're forced to enter in the 4 byte
+	 * address mode in order to benefit of the die erase.
+	 */
+	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;
@@ -193,48 +225,16 @@ static const struct spi_nor_fixups mt25qu512a_fixups = {
 	.post_bfpt = mt25qu512a_post_bfpt_fixup,
 };
 
-static int st_nor_four_die_late_init(struct spi_nor *nor)
-{
-	struct spi_nor_flash_parameter *params = nor->params;
-
-	params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
-	params->n_dice = 4;
-
-	/*
-	 * Unfortunately the die erase opcode does not have a 4-byte opcode
-	 * correspondent for these flashes. The SFDP 4BAIT table fails to
-	 * consider the die erase too. We're forced to enter in the 4 byte
-	 * address mode in order to benefit of the die erase.
-	 */
-	return spi_nor_set_4byte_addr_mode(nor, true);
-}
-
-static int st_nor_two_die_late_init(struct spi_nor *nor)
-{
-	struct spi_nor_flash_parameter *params = nor->params;
-
-	params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
-	params->n_dice = 2;
-
-	/*
-	 * Unfortunately the die erase opcode does not have a 4-byte opcode
-	 * correspondent for these flashes. The SFDP 4BAIT table fails to
-	 * consider the die erase too. We're forced to enter in the 4 byte
-	 * address mode in order to benefit of the die erase.
-	 */
-	return spi_nor_set_4byte_addr_mode(nor, true);
-}
-
 static const struct spi_nor_fixups n25q00_fixups = {
-	.late_init = st_nor_four_die_late_init,
+	.late_init = micron_st_nor_four_die_late_init,
 };
 
 static const struct spi_nor_fixups mt25q01_fixups = {
-	.late_init = st_nor_two_die_late_init,
+	.late_init = micron_st_nor_two_die_late_init,
 };
 
 static const struct spi_nor_fixups mt25q02_fixups = {
-	.late_init = st_nor_four_die_late_init,
+	.late_init = micron_st_nor_four_die_late_init,
 };
 
 static const struct flash_info st_nor_parts[] = {
Signature · 1 line
2.34.1
author
#2 lore raw

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

In reply to Haibo Chen

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.

---
 drivers/mtd/spi-nor/micron-st.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mtd/spi-nor/micron-st.c +2 -6
index 92eb14ca76c57f29ece1edb3fe652c56d1c2888f..81a9bead1434056cce0893c97bd35ea248c15894 100644
@@ -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;
 }
 
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v4 3/5 mtd: spi-nor: micron-st: use SFDP of mt35xu512aba

In reply to Haibo Chen

mt35xu512aba has SFDP, already contain the necessary information, so remove size and some flags here.

---
1) This mt35xu512aba is populated on the imx943-evk board, was tested at 200MHz using nxp,imx94-xspi SPI controller.
2) root@imx943evk:~# cat /sys/bus/spi/devices/spi8.0/spi-nor/jedec_id 2c5b1a

   root@imx943evk:~# cat /sys/bus/spi/devices/spi8.0/spi-nor/manufacturer
   micron
   root@imx943evk:~# hexdump -Cv /sys/bus/spi/devices/spi8.0/spi-nor/sfdp
   00000000  53 46 44 50 0a 01 03 ff  00 08 01 17 30 00 00 ff  |SFDP........0...|
   00000010  84 00 01 02 90 00 00 ff  05 01 01 06 a0 00 00 ff  |................|
   00000020  0a 00 01 08 b0 00 00 ff  ff ff ff ff ff ff ff ff  |................|
   00000030  e5 20 8a ff ff ff ff 1f  00 00 00 00 00 00 00 00  |. ..............|
   00000040  ee ff ff ff ff ff 00 00  ff ff 00 00 0c 20 11 d8  |............. ..|
   00000050  0f 52 00 00 39 61 99 00  87 8e 03 d3 ac a1 27 3d  |.R..9a........'=|
   00000060  7a 75 7a 75 fb bd d5 5c  00 00 70 ff 81 50 f8 a1  |zuzu...\..p..P..|
   00000070  2f cb 27 8b 00 00 04 01  00 06 01 00 ff ff ff 8e  |/.'.............|
   00000080  00 00 00 00 00 00 00 00  00 00 00 00 ff ff ff ff  |................|
   00000090  43 0e ff ff 21 dc 5c ff  ff ff ff ff ff ff ff ff  |C...!.\.........|
   000000a0  00 0b 80 9e b1 81 b5 85  00 f0 ff 9f 00 0a 00 00  |................|
   000000b0  00 0a 1a 88 10 00 00 00  ff ff ff ff ff ff ff ff  |................|
   000000c0  00 00 06 01 00 00 00 00  14 01 81 03 00 00 00 00  |................|
   000000d0
   root@imx943evk:~# sha256sum /sys/bus/spi/devices/spi8.0/spi-nor/sfdp
   809cbdfc57ae56771e017ff7bfdae7122afcbcbb238f2502420cfe3b2fe20d11  /sys/bus/spi/devices/spi8.0/spi-nor/sfdp
3) root@imx943evk:~# cat /sys/kernel/debug/spi-nor/spi8.0/capabilities
   Supported read modes by the flash
    1S-1S-1S
     opcode        0x13
     mode cycles   0
     dummy cycles  0
    1S-1S-8S
     opcode        0x7c
     mode cycles   1
     dummy cycles  7
    1S-8S-8S
     opcode        0xcc
     mode cycles   1
     dummy cycles  15
    8D-8D-8D
     opcode        0xfd
     mode cycles   0
     dummy cycles  20

Supported page program modes by the flash

    1S-1S-1S
     opcode        0x12
     8D-8D-8D
     opcode        0x12
   root@imx943evk:~# cat /sys/kernel/debug/spi-nor/spi8.0/params
   name            (null)
   id              2c 5b 1a 10 41 00
   size            64.0 MiB
   write size      1
   page size       256
   address nbytes  4
   flags           4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | IO_MODE_EN_VOLATILE | SOFT_RESET

opcodes

    read           0xfd
      dummy cycles  20
    erase          0xdc
    program        0x12
    8D extension   repeat

protocols

    read           8D-8D-8D
    write          8D-8D-8D
    register       8D-8D-8D

erase commands

    21 (4.00 KiB) [1]
    5c (32.0 KiB) [2]
    dc (128 KiB) [3]
    c7 (64.0 MiB)

sector map

    region (in hex)   | erase mask | overlaid
    ------------------+------------+----------
    00000000-03ffffff |     [   3] | no

4) root@imx943evk:~# dd if=/dev/urandom of=./spi_test bs=1M count=2 2+0 records in
2+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0213893 s, 98.0 MB/s

   root@imx943evk:~# mtd_debug erase /dev/mtd0 0 2097152
   Erased 2097152 bytes from address 0x00000000 in flash
   root@imx943evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx943evk:~# hexdump spi_read
   0000000 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0200000
   root@imx943evk:~# sha256sum spi_read
   4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read
   root@imx943evk:~# mtd_debug write /dev/mtd0 0 2097152 spi_test
   Copied 2097152 bytes from spi_test to address 0x00000000 in flash
   root@imx943evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx943evk:~# sha256sum spi*
   f7d59270621c04aac29df9fc1742d0a0882047c618833ecf1577a57d109060ab  spi_read
   f7d59270621c04aac29df9fc1742d0a0882047c618833ecf1577a57d109060ab  spi_test
   root@imx943evk:~# mtd_debug erase /dev/mtd0 0 2097152
   Erased 2097152 bytes from address 0x00000000 in flash
   root@imx943evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx943evk:~# sha256sum spi*
   4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read
   f7d59270621c04aac29df9fc1742d0a0882047c618833ecf1577a57d109060ab  spi_test
   root@imx943evk:~# hexdump spi_read
   0000000 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0200000
   root@imx943evk:~# mtd_debug info /dev/mtd0
   mtd.type = MTD_NORFLASH
   mtd.flags = MTD_CAP_NORFLASH
   mtd.size = 67108864 (64M)
   mtd.erasesize = 131072 (128K)
   mtd.writesize = 1
   mtd.oobsize = 0
   regions = 0
   root@imx943evk:~# mtd_debug write /dev/mtd0 0 2097152 spi_test
   Copied 2097152 bytes from spi_test to address 0x00000000 in flash
   root@imx943evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx943evk:~# hexdump spi_read -n 20
   0000000 f3af 8ec6 388f 56a7 4b69 0859 7bde 910b
   0000010 ea09 0762
   0000014
   root@imx943evk:~# flash_erase /dev/mtd0 0 0
   Erasing 65536 Kibyte @ 0 -- 100 % complete
   root@imx943evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx943evk:~# hexdump spi_read
   0000000 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0200000
---
 drivers/mtd/spi-nor/micron-st.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mtd/spi-nor/micron-st.c +2 -6
index 81a9bead1434056cce0893c97bd35ea248c15894..9a8f82045e4d89f94d005086eb012cc0b3f11cfd 100644
@@ -187,14 +187,10 @@ static const struct spi_nor_fixups mt35xu512aba_fixups = {
 
 static const struct flash_info micron_nor_parts[] = {
 	{
+		/* MT35XU512ABA */
 		.id = SNOR_ID(0x2c, 0x5b, 0x1a),
-		.name = "mt35xu512aba",
-		.sector_size = SZ_128K,
-		.size = SZ_64M,
-		.no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ |
-				 SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP,
 		.mfr_flags = USE_FSR,
-		.fixup_flags = SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE,
+		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
 		.fixups = &mt35xu512aba_fixups,
 	}, {
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH v4 4/5 mtd: spi-nor: micron-st: add mt35xu01gbba support

In reply to Haibo Chen

mt35xu01gbba is similar with mt35xu512aba, but with two dies. mt35xu01gbba has SFDP and support 8D-8D-8D mode, but SFDP lack SNOR_F_IO_MODE_EN_VOLATILE, so add this fixup flags here. Besides, mt35xu01gbba do not support chip erase, but support die erase, so add that in late_init().

---
1) This mt35xu01gbba is populated on the imx95-19x19-evk board, was tested at 200MHz using nxp,imx95-fspi SPI controller.
2) root@imx95evk:~# cat /sys/bus/spi/devices/spi1.0/spi-nor/jedec_id 2c5b1b

   root@imx95evk:~# cat /sys/bus/spi/devices/spi1.0/spi-nor/manufacturer
   micron
   root@imx95evk:~# hexdump -Cv /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
   00000000  53 46 44 50 0a 01 03 ff  00 08 01 17 30 00 00 ff  |SFDP........0...|
   00000010  84 00 01 02 90 00 00 ff  05 01 01 06 a0 00 00 ff  |................|
   00000020  0a 00 01 08 b0 00 00 ff  ff ff ff ff ff ff ff ff  |................|
   00000030  e5 20 8a ff ff ff ff 3f  00 00 00 00 00 00 00 00  |. .....?........|
   00000040  ee ff ff ff ff ff 00 00  ff ff 00 00 0c 20 11 d8  |............. ..|
   00000050  0f 52 00 00 39 61 99 00  87 8e 03 d3 ac a1 27 3d  |.R..9a........'=|
   00000060  7a 75 7a 75 fb bd d5 5c  00 00 70 ff 81 50 f8 a1  |zuzu...\..p..P..|
   00000070  2f cb 27 8b 00 00 04 01  00 06 01 00 ff ff ff 8e  |/.'.............|
   00000080  00 00 00 00 00 00 00 00  00 00 00 00 ff ff ff ff  |................|
   00000090  43 0e ff ff 21 dc 5c ff  ff ff ff ff ff ff ff ff  |C...!.\.........|
   000000a0  00 0b 80 9e b1 81 b5 85  00 f0 ff 9f 00 0a 00 00  |................|
   000000b0  00 0a 1a 88 10 00 00 00  ff ff ff ff ff ff ff ff  |................|
   000000c0  00 00 06 01 00 00 00 00  14 01 81 03 00 00 00 00  |................|
   000000d0
   root@imx95evk:~# sha256sum /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
   3848f0bd2436d7ca1373cee33f90e09d6479d0f4dc4bfd19f6a082d9e0039495  /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
3) root@imx95evk:~# cat /sys/kernel/debug/spi-nor/spi1.0/capabilities
   Supported read modes by the flash
    1S-1S-1S
     opcode        0x13
     mode cycles   0
     dummy cycles  0
    1S-1S-8S
     opcode        0x7c
     mode cycles   1
     dummy cycles  7
    1S-8S-8S
     opcode        0xcc
     mode cycles   1
     dummy cycles  15
    8D-8D-8D
     opcode        0xfd
     mode cycles   0
     dummy cycles  20

Supported page program modes by the flash

    1S-1S-1S
     opcode        0x12
    8D-8D-8D
     opcode        0x12
   root@imx95evk:~# cat /sys/kernel/debug/spi-nor/spi1.0/params
   name            (null)
   id              2c 5b 1b 10 41 00
   size            128 MiB
   write size      1
   page size       256
   address nbytes  4
   flags           4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | IO_MODE_EN_VOLATILE | SOFT_RESET

opcodes

    read           0xfd
      dummy cycles  20
    erase          0xdc
    program        0x12
    8D extension   repeat

protocols

    read           8D-8D-8D
    write          8D-8D-8D
    register       8D-8D-8D

erase commands

     21 (4.00 KiB) [1]
     5c (32.0 KiB) [2]
     dc (128 KiB) [3]
     c4 (128 MiB)

sector map

     region (in hex)   | erase mask | overlaid
     ------------------+------------+----------
     00000000-07ffffff |     [   3] | no

4) root@imx95evk:~# dd if=/dev/urandom of=./spi_test bs=1M count=2 2+0 records in
2+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0207974 s, 101 MB/s

   root@imx95evk:~# mtd_debug erase /dev/mtd0 0 2097152
   Erased 2097152 bytes from address 0x00000000 in flash
   root@imx95evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx95evk:~# hexdump spi_read
   0000000 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0200000
   root@imx95evk:~# sha256sum spi_read
   4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read
   root@imx95evk:~# mtd_debug write /dev/mtd0 0 2097152 spi_test
   Copied 2097152 bytes from spi_test to address 0x00000000 in flash
   root@imx95evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx95evk:~# sha256sum spi*
   57300768c1271d4588b850dcbf4e1400f287f09b2d515eda610890456695b205  spi_read
   57300768c1271d4588b850dcbf4e1400f287f09b2d515eda610890456695b205  spi_test
   root@imx95evk:~# mtd_debug erase /dev/mtd0 0 2097152
   Erased 2097152 bytes from address 0x00000000 in flash
   root@imx95evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx95evk:~# sha256sum spi*
   4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read
   57300768c1271d4588b850dcbf4e1400f287f09b2d515eda610890456695b205  spi_test
   root@imx95evk:~# mtd_debug info /dev/mtd0
   mtd.type = MTD_NORFLASH
   mtd.flags = MTD_CAP_NORFLASH
   mtd.size = 134217728 (128M)
   mtd.erasesize = 131072 (128K)
   mtd.writesize = 1
   mtd.oobsize = 0
   regions = 0
   root@imx95evk:~# flash_erase /dev/mtd0 0 0
   Erasing 131072 Kibyte @ 0 -- 100 % complete
   root@imx95evk:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
   Copied 2097152 bytes from address 0x00000000 in flash to spi_read
   root@imx95evk:~# hexdump spi_read
   0000000 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0200000
---
 drivers/mtd/spi-nor/micron-st.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/mtd/spi-nor/micron-st.c +11 -0
index 9a8f82045e4d89f94d005086eb012cc0b3f11cfd..c89c06b1fc61a581fea2e18732be2501a15715f9 100644
@@ -185,6 +185,11 @@ static const struct spi_nor_fixups mt35xu512aba_fixups = {
 	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
 };
 
+static const struct spi_nor_fixups mt35xu01gbba_fixups = {
+	.post_sfdp = mt35xu512aba_post_sfdp_fixup,
+	.late_init = micron_st_nor_two_die_late_init,
+};
+
 static const struct flash_info micron_nor_parts[] = {
 	{
 		/* MT35XU512ABA */
@@ -192,6 +197,12 @@ static const struct flash_info micron_nor_parts[] = {
 		.mfr_flags = USE_FSR,
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
 		.fixups = &mt35xu512aba_fixups,
+	}, {
+		/* MT35XU01GBBA */
+		.id = SNOR_ID(0x2c, 0x5b, 0x1b),
+		.mfr_flags = USE_FSR,
+		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
+		.fixups = &mt35xu01gbba_fixups,
 	}, {
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
 		.name = "mt35xu02g",
Signature · 1 line
2.34.1
author
#6 lore raw

PATCH v4 5/5 mtd: spi-nor: micron-st: add comment for mt35xu02gcba

In reply to Haibo Chen

The MT35XU02GCBA flash device does not support chip erase, according to its datasheet. It supports die erase, which means the current driver implementation will likely need to be converted to use die erase.

Furthermore, similar to the MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled.

---
 drivers/mtd/spi-nor/micron-st.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mtd/spi-nor/micron-st.c +10 -0
index c89c06b1fc61a581fea2e18732be2501a15715f9..f94e9d2d17bf4aa7c36ba3aa37d34f767a9f93ac 100644
@@ -204,6 +204,16 @@ static const struct flash_info micron_nor_parts[] = {
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
 		.fixups = &mt35xu01gbba_fixups,
 	}, {
+		/*
+		 * The MT35XU02GCBA flash device does not support
+		 * chip erase, according to its datasheet.
+		 * It supports die erase, which means the current
+		 * driver implementation will likely need to be
+		 * converted to use die erase.
+		 * Furthermore, similar to the MT35XU01GBBA, the
+		 * SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs
+		 * to be enabled.
+		 */
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
 		.name = "mt35xu02g",
 		.sector_size = SZ_128K,
Signature · 1 line
2.34.1
maintainer
#7 lore raw

Re: [PATCH v4 5/5] mtd: spi-nor: micron-st: add comment for mt35xu02gcba

Quoted 23 lines · Haibo Chen

The MT35XU02GCBA flash device does not support chip erase, according to its datasheet. It supports die erase, which means the current driver implementation will likely need to be converted to use die erase.

Furthermore, similar to the MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled.

---
 drivers/mtd/spi-nor/micron-st.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mtd/spi-nor/micron-st.c +0 -0
index c89c06b1fc61a581fea2e18732be2501a15715f9..f94e9d2d17bf4aa7c36ba3aa37d34f767a9f93ac 100644
@@ -204,6 +204,16 @@ static const struct flash_info micron_nor_parts[] = {
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
 		.fixups = &mt35xu01gbba_fixups,
 	}, {

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

Quoted 10 lines
drivers/mtd/spi-nor/micron-st.c +10 -0
+		/*
+		 * The MT35XU02GCBA flash device does not support
+		 * chip erase, according to its datasheet.
+		 * It supports die erase, which means the current
+		 * driver implementation will likely need to be
+		 * converted to use die erase.
+		 * Furthermore, similar to the MT35XU01GBBA, the
+		 * SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs
+		 * to be enabled.
+		 */

Maybe I am missing some context from previous patches, but why are we adding this comment here instead of fixing the support for this flash? What does "the driver will likely need to be converted to use die erase" mean? If it doesn't support chip erase, then it _does_ need to be fixed by using die erase.

Also, why does the flash "probably" need SPI_NOR_IO_MODE_EN_VOLATILE? Are you guessing based on datasheet and do not have the hardware at hand?

The changelog should also explain _why_ this comment is added here, and not just repeat the text.

Quoted 3 lines
drivers/mtd/spi-nor/micron-st.c +0 -0
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
 		.name = "mt35xu02g",
 		.sector_size = SZ_128K,
Signature · 2 lines
Regards,
Pratyush Yadav
#8 lore raw

Re: [PATCH v4 5/5] mtd: spi-nor: micron-st: add comment for mt35xu02gcba

On 11/13/25 4:47 PM, Pratyush Yadav wrote:

Hi!

Quoted 42 lines · Haibo Chen
Quoted 24 lines

The MT35XU02GCBA flash device does not support chip erase, according to its datasheet. It supports die erase, which means the current driver implementation will likely need to be converted to use die erase.

Furthermore, similar to the MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled.

---
 drivers/mtd/spi-nor/micron-st.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mtd/spi-nor/micron-st.c +0 -0
index c89c06b1fc61a581fea2e18732be2501a15715f9..f94e9d2d17bf4aa7c36ba3aa37d34f767a9f93ac 100644
@@ -204,6 +204,16 @@ static const struct flash_info micron_nor_parts[] = {
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
 		.fixups = &mt35xu01gbba_fixups,
 	}, {

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

Quoted 10 lines
drivers/mtd/spi-nor/micron-st.c +10 -0
+		/*
+		 * The MT35XU02GCBA flash device does not support
+		 * chip erase, according to its datasheet.
+		 * It supports die erase, which means the current
+		 * driver implementation will likely need to be
+		 * converted to use die erase.
+		 * Furthermore, similar to the MT35XU01GBBA, the
+		 * SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs
+		 * to be enabled.
+		 */

Maybe I am missing some context from previous patches, but why are we adding this comment here instead of fixing the support for this flash? What does "the driver will likely need to be converted to use die erase" mean? If it doesn't support chip erase, then it _does_ need to be fixed by using die erase.

Quoted 3 lines

Also, why does the flash "probably" need SPI_NOR_IO_MODE_EN_VOLATILE? Are you guessing based on datasheet and do not have the hardware at hand?

Yes, no hardware at hand. He can test with mt35xu01gbba which is a smaller flash that share the datasheet with this flash, so that's why the TODO and not a direct change.

Quoted 8 lines

The changelog should also explain _why_ this comment is added here, and not just repeat the text.

Quoted 3 lines
drivers/mtd/spi-nor/micron-st.c +0 -0
 		.id = SNOR_ID(0x2c, 0x5b, 0x1c),
 		.name = "mt35xu02g",
 		.sector_size = SZ_128K,
maintainer
#9 lore raw

Re: [PATCH v4 5/5] mtd: spi-nor: micron-st: add comment for mt35xu02gcba

Quoted 46 lines · Tudor Ambarus

On 11/13/25 4:47 PM, Pratyush Yadav wrote:

Hi!

Quoted 42 lines · Haibo Chen
Quoted 24 lines

The MT35XU02GCBA flash device does not support chip erase, according to its datasheet. It supports die erase, which means the current driver implementation will likely need to be converted to use die erase.

Furthermore, similar to the MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled.

---
 drivers/mtd/spi-nor/micron-st.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mtd/spi-nor/micron-st.c +0 -0
index c89c06b1fc61a581fea2e18732be2501a15715f9..f94e9d2d17bf4aa7c36ba3aa37d34f767a9f93ac 100644
@@ -204,6 +204,16 @@ static const struct flash_info micron_nor_parts[] = {
 		.fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
 		.fixups = &mt35xu01gbba_fixups,
 	}, {

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

Quoted 10 lines
drivers/mtd/spi-nor/micron-st.c +10 -0
+		/*
+		 * The MT35XU02GCBA flash device does not support
+		 * chip erase, according to its datasheet.
+		 * It supports die erase, which means the current
+		 * driver implementation will likely need to be
+		 * converted to use die erase.
+		 * Furthermore, similar to the MT35XU01GBBA, the
+		 * SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs
+		 * to be enabled.
+		 */

Maybe I am missing some context from previous patches, but why are we adding this comment here instead of fixing the support for this flash? What does "the driver will likely need to be converted to use die erase" mean? If it doesn't support chip erase, then it _does_ need to be fixed by using die erase.

Quoted 7 lines
Quoted 3 lines

Also, why does the flash "probably" need SPI_NOR_IO_MODE_EN_VOLATILE? Are you guessing based on datasheet and do not have the hardware at hand?

Yes, no hardware at hand. He can test with mt35xu01gbba which is a smaller flash that share the datasheet with this flash, so that's why the TODO and not a direct change.

Okay, fair enough. I think the wording of the comment and commit message are kind of vague though. So I will do some massaging when applying.

[...]

Signature · 2 lines
Regards,
Pratyush Yadav
maintainer Applied
#10 lore raw
In reply to Haibo Chen
Quoted 11 lines · Haibo Chen

mt35xu02gcba, mt35xu01gbba and mt35xu512aba are similar, but with different number of dies. According to the datasheet:
https://datasheet.octopart.com/MT35XU02GCBA1G12-0AAT-Micron-datasheet-138896808.pdf
these chips all support die erase command, but do not support chip erase. But accroding to test, mt35xu512aba support chip erase, do not support die erase. mt35xu01gbba do not support chip erase, but support die erase.
This patch set clean up the mt35xu512aba, and add mt35xu01gbba. since do not have mt35xu02gcba to do the test, just add some comment under mt35xu02gcba for further work.

Quoted 1 line

Applied to spi-nor/next with the patch 5 touched up. See
https://git.kernel.org/mtd/c/7f77c561e2278. Thanks!

[...]

Signature · 2 lines
Regards,
Pratyush Yadav