mtd: spi-nor: micron-st: add SNOR_CMD_PP_8_8_8_DTR sfdp fixup for mt35xu512aba
Subsystems (3)
PATCH v2 1/1 mtd: spi-nor: micron-st: add SNOR_CMD_PP_8_8_8_DTR sfdp fixup for mt35xu512aba
Find two batches mt35xu512aba has different SFDP but with same jedec ID. The batch which use the new version of SFDP contain all the necessary information to support OCT DTR mode. The batch with old version do not contain the OCT DTR command information, but in fact it did support OCT DTR mode.
Current mt35xu512aba_post_sfdp_fixup() add some setting including SNOR_CMD_READ_8_8_8_DTR, but still lack SNOR_CMD_PP_8_8_8_DTR. Meet issue on the batch mt35xu512aba with old SFDP version. Because no SNOR_CMD_PP_8_8_8_DTR, micron_st_nor_octal_dtr_en() will not be called, then use SNOR_CMD_READ_8_8_8_DTR will meet issue.
---
Changes in v2:
- add 8D pp command in post sfdp fix up for the chip with old SFDP
- Link to v1: https://lore.kernel.org/r/[email protected]
---
first part: the batch mt35xu512aba with old version
1) This mt35xu512aba with label 0DA15 RW303 (old version) is populated on the imx8qm-mek board, was tested at 166MHz using nxp,imx8qxp-fspi SPI controller.
2) root@imx8qmmek:/sys/bus/spi/devices/spi4.0/spi-nor# ls jedec_id manufacturer sfdp
root@imx8qmmek:/sys/bus/spi/devices/spi4.0/spi-nor# cat jedec_id
2c5b1a
root@imx8qmmek:/sys/bus/spi/devices/spi4.0/spi-nor# cat manufacturer
micron
root@imx8qmmek:/sys/bus/spi/devices/spi4.0/spi-nor# hexdump -Cv sfdp
00000000 53 46 44 50 06 01 01 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 84 00 01 02 80 00 00 ff ff ff ff ff ff ff ff ff |................|
00000020 ff ff ff ff ff ff ff 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 24 5a 99 00 8b 8e 03 e1 ac 01 27 38 |.R..$Z........'8|
00000060 7a 75 7a 75 fb bd d5 5c 00 00 70 ff 81 b0 38 36 |zuzu...\..p...86|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 43 0e ff ff 21 dc 5c ff |C...!.\.|
00000088
root@imx8qmmek:~# sha256sum /sys/bus/spi/devices/spi4.0/spi-nor/sfdp
a2e3b364108c4d8052b26d50f31e7dfac6e4ad96aa3994f19678125ebdf8fb81 /sys/bus/spi/devices/spi4.0/spi-nor/sfdp
3) root@imx8qmmek:~# cat /sys/kernel/debug/spi-nor/spi4.0/capabilities
Supported read modes by the flash
1S-1S-1S
opcode 0x13
mode cycles 0
dummy cycles 0
8D-8D-8D
opcode 0xfd
mode cycles 0
dummy cycles 20Supported page program modes by the flash
1S-1S-1S
opcode 0x12
8D-8D-8D
opcode 0x12root@imx8qmmek:~# cat /sys/kernel/debug/spi-nor/spi4.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 | NO_READ_CR | IO_MODE_EN_VOLATILE | SOFT_RESET
opcodes
read 0xfd
dummy cycles 20
erase 0xdc
program 0x12
8D extension repeatprotocols
read 8D-8D-8D
write 8D-8D-8D
register 8D-8D-8Derase 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] | no4)root@imx8qmmek:~# 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.317497 s, 6.6 MB/s root@imx8qmmek:~# mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash root@imx8qmmek:~# mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read root@imx8qmmek:~# hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 root@imx8qmmek:~# sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read root@imx8qmmek:~# mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash root@imx8qmmek:~# mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read root@imx8qmmek:~# sha256sum spi* 16b3a0c63252b07501129a0e495e6c8cb8e40598e32bc9a9431838ba95266f3d spi_read 16b3a0c63252b07501129a0e495e6c8cb8e40598e32bc9a9431838ba95266f3d spi_test root@imx8qmmek:~# mtd_debug erase /dev/mtd0 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash root@imx8qmmek:~# mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read root@imx8qmmek:~# sha256sum spi* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 16b3a0c63252b07501129a0e495e6c8cb8e40598e32bc9a9431838ba95266f3d spi_test root@imx8qmmek:~# hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 root@imx8qmmek:~# 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@imx8qmmek:~# mtd_debug write /dev/mtd0 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash root@imx8qmmek:~# mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read root@imx8qmmek:~# hexdump spi_read -n 20 0000000 b6e2 a2b3 1b76 9184 3ee1 02c7 bc1f 23c0 0000010 475f 6526 0000014 root@imx8qmmek:~# flash_erase /dev/mtd0 0 0 Erasing 65536 Kibyte @ 0 -- 100 % complete root@imx8qmmek:~# mtd_debug read /dev/mtd0 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read root@imx8qmmek:~# hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000
Second part: the batch mt35xu512aba with new version
1) This mt35xu512aba with label 4KA17 RW303 (new version) 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:/sys/bus/spi/devices/spi8.0/spi-nor# hexdump -Cv 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 20Supported page program modes by the flash
1S-1S-1S
opcode 0x12
8D-8D-8D
opcode 0x12root@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 repeatprotocols
read 8D-8D-8D
write 8D-8D-8D
register 8D-8D-8Derase 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] | no4) 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.0216668 s, 96.8 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_* 8bf13c50e9f106d180e5657e803811e1721c0e092ff46281d5bf30d1b13ac368 spi_read 8bf13c50e9f106d180e5657e803811e1721c0e092ff46281d5bf30d1b13ac368 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 8bf13c50e9f106d180e5657e803811e1721c0e092ff46281d5bf30d1b13ac368 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 998e 471b fae3 9269 ce52 c6e5 42ae 5143 0000010 8f20 c41f 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 | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/spi-nor/micron-st.c +4 -0
@@ -167,6 +167,10 @@ static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)0 ,20 ,SPINOR_OP_MT_DTR_RD , SNOR_PROTO_8_8_8_DTR); + nor->params->hwcaps.mask |=SNOR_HWCAPS_PP_8_8_8_DTR ; +spi_nor_set_pp_settings (&nor->params->page_programs[SNOR_CMD_PP_8_8_8_DTR ], +SPINOR_OP_PP_4B ,SNOR_PROTO_8_8_8_DTR ); + nor->cmd_ext_type =SPI_NOR_EXT_REPEAT ; nor->params->rdsr_dummy =8 ; nor->params->rdsr_addr_nbytes =0 ;
---
base-commit: 4a5663c04bb679631985a15efab774da58c37815
change-id: 20251212-nor-2f37cf12eeca
Best regards,
Signature · 1 line
Haibo Chen <[email protected]>
Quoted 19 lines · Haibo Chen
Find two batches mt35xu512aba has different SFDP but with same jedec ID. The batch which use the new version of SFDP contain all the necessary information to support OCT DTR mode. The batch with old version do not contain the OCT DTR command information, but in fact it did support OCT DTR mode.
Current
mt35xu512aba_post_sfdp_fixup()add some setting includingSNOR_CMD_READ_8_8_8_DTR, but still lackSNOR_CMD_PP_8_8_8_DTR. Meet issue on the batch mt35xu512aba with old SFDP version. Because noSNOR_CMD_PP_8_8_8_DTR,micron_st_nor_octal_dtr_en()will not be called, then useSNOR_CMD_READ_8_8_8_DTRwill meet issue.Fixes 44dd635cd632 ("mtd: spi-nor: micron-st: use SFDP of mt35xu512aba")Signed-off-by Haibo Chen <[email protected]>---
Changes in v2:
- add 8D pp command in post sfdp fix up for the chip with old SFDP
- Link to v1: https://lore.kernel.org/r/[email protected]
---
[...]
drivers/mtd/spi-nor/micron-st.c static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor) · line 169
Quoted 12 lines
--- drivers/mtd/spi-nor/micron-st.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/mtd/spi-nor/micron-st.c +0
-0@@ -167,6 +167,10 @@ static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)0 ,20 ,SPINOR_OP_MT_DTR_RD , SNOR_PROTO_8_8_8_DTR);
Please also add a comment here explaining why this fixup is needed, as Michael suggested in v1. Probably a shorter version of the explanation in the commit message.
With that, feel free to add:
Quoted 13 lines
drivers/mtd/spi-nor/micron-st.c +4
-1+ nor->params->hwcaps.mask |=SNOR_HWCAPS_PP_8_8_8_DTR ; +spi_nor_set_pp_settings (&nor->params->page_programs[SNOR_CMD_PP_8_8_8_DTR ], +SPINOR_OP_PP_4B ,SNOR_PROTO_8_8_8_DTR ); + nor->cmd_ext_type =SPI_NOR_EXT_REPEAT ; nor->params->rdsr_dummy =8 ; nor->params->rdsr_addr_nbytes =0 ; ---base-commit:
4a5663c04bb679631985a15efab774da58c37815
change-id: 20251212-nor-2f37cf12eecaBest regards,
Signature · 2 lines
Regards, Pratyush Yadav
Quoted 66 lines
-----Original Message-----
From: Pratyush Yadav <[email protected]>
Sent: 2025年12月22日 23:40
To: Bough Chen <[email protected]>
Cc: Tudor Ambarus <[email protected]>; Pratyush Yadav <[email protected]>; Michael Walle <[email protected]>; Miquel Raynal <[email protected]>; Richard Weinberger <[email protected]>; Vignesh Raghavendra <[email protected]>; [email protected]; [email protected]; Han Xu <[email protected]>; [email protected]
Subject: Re: [PATCH v2] mtd: spi-nor: micron-st: addSNOR_CMD_PP_8_8_8_DTRsfdp fixup for mt35xu512abaQuoted 8 lines · Haibo Chen
Find two batches mt35xu512aba has different SFDP but with same jedec ID. The batch which use the new version of SFDP contain all the necessary information to support OCT DTR mode. The batch with old version do not contain the OCT DTR command information, but in fact it did support OCT DTR mode.
Current
mt35xu512aba_post_sfdp_fixup()add some setting includingSNOR_CMD_READ_8_8_8_DTR, but still lackSNOR_CMD_PP_8_8_8_DTR.Meet
Quoted 5 lines
issue on the batch mt35xu512aba with old SFDP version. Because no
SNOR_CMD_PP_8_8_8_DTR,micron_st_nor_octal_dtr_en()will not be called, then useSNOR_CMD_READ_8_8_8_DTRwill meet issue.Fixes 44dd635cd632 ("mtd: spi-nor: micron-st: use SFDP ofQuoted 8 lines
mt35xu512aba")
Signed-off-by Haibo Chen <[email protected]>---
Changes in v2:
- add 8D pp command in post sfdp fix up for the chip with old SFDP
- Link to v1:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
.kernel.org%2Fr%2F20251212-nor-v1-1-20a5a381979c%40nxp.com&data=05%7C0
Quoted 1 line
2%7Chaibo.chen%40nxp.com%7C9a2bf553aac042c4139208de4170560f%7C68 6ea1d3
Quoted 1 line
bc2b4c6fa92cd99c5c301635%7C0%7C0%7C639020147896277357%7CUnknown %7CTWFp
Quoted 1 line
bGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiI sIk
Quoted 1 line
FOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=pvXNIZ%2BXuZUX Hz6YJe
Quoted 2 lines
3bOz%2FobRo1Nxv0prnqlPqeG5c%3D&reserved=0
---[...]
Quoted 7 lines
--- drivers/mtd/spi-nor/micron-st.c | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/drivers/mtd/spi-nor/micron-st.cindex
88033384a71e5d19f5a26ca91f56a49e3017183a..5797bb748be696b340ff1398155fdrivers/mtd/spi-nor/micron-st.c static int mt35xu512aba_post_sfdp_fixup(struct
Quoted 4 lines
5ac8b1f74055100644drivers/mtd/spi-nor/micron-st.c +0
-0@@ -167,6 +167,10 @@ static int mt35xu512aba_post_sfdp_fixup(struct
spi_nor*nor)
Quoted 7 lines
drivers/mtd/spi-nor/micron-st.c static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor) · line 169
Quoted 3 lines
drivers/mtd/spi-nor/micron-st.c +0
-00 ,20 ,SPINOR_OP_MT_DTR_RD , SNOR_PROTO_8_8_8_DTR);Please also add a comment here explaining why this fixup is needed, as Michael suggested in v1. Probably a shorter version of the explanation in the commit message.
Sure, will add in next version.
Regards
Haibo Chen
Quoted 24 lines
With that, feel free to add:
Reviewed-by Pratyush Yadav <[email protected]>drivers/mtd/spi-nor/micron-st.c static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor) · line 173
Quoted 2 lines
drivers/mtd/spi-nor/micron-st.c +2
-0+ nor->params->hwcaps.mask |=SNOR_HWCAPS_PP_8_8_8_DTR ; +spi_nor_set_pp_settings(&nor->params->page_programs[SNOR_CMD_PP_8_8_8_DTR],
Quoted 11 lines
drivers/mtd/spi-nor/micron-st.c +2
-1+ SPINOR_OP_PP_4B, SNOR_PROTO_8_8_8_DTR); + nor->cmd_ext_type =SPI_NOR_EXT_REPEAT ; nor->params->rdsr_dummy =8 ; nor->params->rdsr_addr_nbytes =0 ; ---base-commit:
4a5663c04bb679631985a15efab774da58c37815
change-id: 20251212-nor-2f37cf12eecaBest regards,
--
Regards,
Pratyush Yadav