[PATCH v2] mtd: spi-nor: macronix: remove mx25u25635f from parts list to enable SFDP

Parth Pancholi posted 1 patch 2 weeks, 4 days ago
drivers/mtd/spi-nor/macronix.c | 6 ------
1 file changed, 6 deletions(-)
[PATCH v2] mtd: spi-nor: macronix: remove mx25u25635f from parts list to enable SFDP
Posted by Parth Pancholi 2 weeks, 4 days ago
From: Parth Pancholi <parth.pancholi@toradex.com>

The Macronix mx25u25635f flash device supports SFDP initialization.
This commit removes the specific mx25u25635f entry (NOR ID 0xc22539),
along with its size and flags, from the NOR parts list. By removing
this entry, both mx25u25635f and mx25u25645g (which share the same
NOR ID) will utilize the generic flash driver configuration.

This change allows both devices (mx25u25635f and mx25u25645g) to
leverage SFDP-defined parameters, enabling dual and quad read
operations without the need for manual adjustment of no_sfdp_flags.

Link: https://www.macronix.com/Lists/Datasheet/Attachments/8663/MX25U25635F,%201.8V,%20256Mb,%20v1.5.pdf
Signed-off-by: Parth Pancholi <parth.pancholi@toradex.com>
---
v2: enable SFDP for mx25u25635f(and mx25u25645g) by removing it's entry from parts list

mx25u25645g flash is populated on the Toradex Aquila development carrier
board and was tested at 66 MHz frequency using the "ti,am654-ospi" SPI controller.

root@aquila-am69-02242602:~# cat /sys/bus/spi/devices/spi3.0/spi-nor/partname
spi-nor-generic

root@aquila-am69-02242602:~# cat /sys/bus/spi/devices/spi3.0/spi-nor/jedec_id
c22539c22539

root@aquila-am69-02242602:~# xxd -p /sys/bus/spi/devices/spi3.0/spi-nor/sfdp
53464450060102ff00060110300000ffc2000104100100ff84000102c000
00ffffffffffffffffffffffffffffffffffe520fbffffffff0f44eb086b
083b04bbfeffffffffff00ffffff44eb0c200f5210d800ff8749b50082d2
04d24403673830b030b0f7bdd55c4a9e29fff050f985ffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffff7f8fffff215cdcffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffff002050169df9c06485cbffffffffffff

root@aquila-am69-02242602:~# sha256sum /sys/bus/spi/devices/spi3.0/spi-nor/sfdp
cc74a7490301b752a45fa147a860be43ed71a6f1cf598adae7ac38b19fb745f1  /sys/bus/spi/devices/spi3.0/spi-nor/sfdp

root@aquila-am69-02242602:~# cat /sys/kernel/debug/spi-nor/spi3.0/capabilities
Supported read modes by the flash
 1S-1S-1S
  opcode        0x13
  mode cycles   0
  dummy cycles  0
 1S-1S-2S
  opcode        0x3c
  mode cycles   0
  dummy cycles  8
 1S-2S-2S
  opcode        0xbc
  mode cycles   0
  dummy cycles  4
 1S-1S-4S
  opcode        0x6c
  mode cycles   0
  dummy cycles  8
 1S-4S-4S
  opcode        0xec
  mode cycles   2
  dummy cycles  4
 4S-4S-4S
  opcode        0xec
  mode cycles   2
  dummy cycles  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-4S-4S
  opcode        0x3e

root@aquila-am69-02242602:~# cat /sys/kernel/debug/spi-nor/spi3.0/params
name            spi-nor-generic
id              c2 25 39 c2 25 39
size            32.0 MiB
write size      1
page size       256
address nbytes  4
flags           4B_OPCODES | HAS_4BAIT | SOFT_RESET

opcodes
 read           0xec
  dummy cycles  6
 erase          0x21
 program        0x3e
 8D extension   none

protocols
 read           1S-4S-4S
 write          1S-4S-4S
 register       1S-1S-1S

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

sector map
 region (in hex)   | erase mask | flags
 ------------------+------------+----------
 00000000-01ffffff |     [ 123] |

root@aquila-am69-02242602:~# 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.0147001 s, 143 MB/s

root@aquila-am69-02242602:~# mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@aquila-am69-02242602:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@aquila-am69-02242602:~# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@aquila-am69-02242602:~# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@aquila-am69-02242602:~# mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@aquila-am69-02242602:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@aquila-am69-02242602:~# sha256sum spi*
7156e42306db1fd79e6dfc22320adaa126b394361abde4777a679924cc9fc0fc  spi_read
7156e42306db1fd79e6dfc22320adaa126b394361abde4777a679924cc9fc0fc  spi_test

root@aquila-am69-02242602:~# mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@aquila-am69-02242602:~# mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@aquila-am69-02242602:~# sha256sum spi*
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read
7156e42306db1fd79e6dfc22320adaa126b394361abde4777a679924cc9fc0fc  spi_test

root@aquila-am69-02242602:~# mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 33554432 (32M)
mtd.erasesize = 4096 (4K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
---
 drivers/mtd/spi-nor/macronix.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index ea6be95e75a5..5a0d1af99afe 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -125,12 +125,6 @@ static const struct flash_info macronix_nor_parts[] = {
 		.name = "mx25u12835f",
 		.size = SZ_16M,
 		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
-	}, {
-		.id = SNOR_ID(0xc2, 0x25, 0x39),
-		.name = "mx25u25635f",
-		.size = SZ_32M,
-		.no_sfdp_flags = SECT_4K,
-		.fixup_flags = SPI_NOR_4B_OPCODES,
 	}, {
 		.id = SNOR_ID(0xc2, 0x25, 0x3a),
 		.name = "mx25u51245g",
-- 
2.34.1
Re: [PATCH v2] mtd: spi-nor: macronix: remove mx25u25635f from parts list to enable SFDP
Posted by Tudor Ambarus 1 week, 5 days ago

On 11/5/24 10:58 AM, Parth Pancholi wrote:
> From: Parth Pancholi <parth.pancholi@toradex.com>
> 
> The Macronix mx25u25635f flash device supports SFDP initialization.
> This commit removes the specific mx25u25635f entry (NOR ID 0xc22539),
> along with its size and flags, from the NOR parts list. By removing
> this entry, both mx25u25635f and mx25u25645g (which share the same
> NOR ID) will utilize the generic flash driver configuration.
> 
> This change allows both devices (mx25u25635f and mx25u25645g) to
> leverage SFDP-defined parameters, enabling dual and quad read
> operations without the need for manual adjustment of no_sfdp_flags.

I'm fine with this. We may re-add an entry when BP is used or if someone
reports there's a flash with this ID that doesn't support SFDP, which
has a reasonable amount of probability for macronix flashes, but I'm ok
taking the risk and fixing it afterwards if reported.

Waiting a bit more to get Michael's and Pratyush's opinions on this too.