* [PATCH v2 0/2] Add support for Quad Input Page Program
@ 2025-02-11 6:30 Cheng Ming Lin
2025-02-11 6:30 ` [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups " Cheng Ming Lin
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Cheng Ming Lin @ 2025-02-11 6:30 UTC (permalink / raw)
To: tudor.ambarus, pratyush, mwalle, miquel.raynal, richard,
vigneshr, linux-mtd, linux-kernel
Cc: alvinzhou, leoyu, Cheng Ming Lin
From: Cheng Ming Lin <chengminglin@mxic.com.tw>
Support for the Quad Input Page Program feature.
Some Macronix NOR flash support the Quad Input Page Program feature, but
the 4-Byte Address Instruction Table definition in the SFDP is incorrect.
To properly enable this feature, a post_sfdp fixups implementation is
introduced.
v2:
* Add a partname comment to easily identify flash entries
Cheng Ming Lin (2):
mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page
Program
mtd: spi-nor: macronix: Add support for Macronix NOR Flash
drivers/mtd/spi-nor/macronix.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
2025-02-11 6:30 [PATCH v2 0/2] Add support for Quad Input Page Program Cheng Ming Lin
@ 2025-02-11 6:30 ` Cheng Ming Lin
2025-02-11 7:20 ` Tudor Ambarus
2025-02-11 6:30 ` [PATCH v2 2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash Cheng Ming Lin
2025-03-07 6:35 ` [PATCH v2 0/2] Add support for Quad Input Page Program Tudor Ambarus
2 siblings, 1 reply; 10+ messages in thread
From: Cheng Ming Lin @ 2025-02-11 6:30 UTC (permalink / raw)
To: tudor.ambarus, pratyush, mwalle, miquel.raynal, richard,
vigneshr, linux-mtd, linux-kernel
Cc: alvinzhou, leoyu, Cheng Ming Lin
From: Cheng Ming Lin <chengminglin@mxic.com.tw>
Although certain Macronix NOR flash support the Quad Input Page Program
feature, the corresponding information in the 4-byte Address Instruction
Table of these flash is not properly filled. As a result, this feature
cannot be enabled as expected.
To address this issue, a post_sfdp fixups implementation is required to
correct the missing information.
Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
---
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c22019
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 0f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff d6 59 dd 00 82 9f 03 db 44 03 67 38 |.....Y......D.g8|
00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d........|
00000120
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2201a
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 1f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff d6 49 c5 00 81 df 04 e3 44 03 67 38 |.....I......D.g8|
00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f ef ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d........|
00000120
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2201b
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 3f 44 eb 08 6b 08 3b 04 bb |. .....?D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff d6 49 c5 00 85 df 04 e3 44 03 67 38 |.....I......D.g8|
00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f ef ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d........|
00000120
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2253a
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 1f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff 87 49 b5 00 82 df 04 e2 44 03 67 38 |.....I......D.g8|
00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 20 50 16 9d f9 c0 64 85 cb ff ff ff ff ff ff |. P....d........|
00000120
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2253c
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 7f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff 89 49 bd 00 8d 12 00 e2 44 03 67 44 |.....I......D.gD|
00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 20 00 17 9d f9 c0 64 85 cb ff ff ff ff ff ff |. .....d........|
00000120
drivers/mtd/spi-nor/macronix.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index 830da21eea08..ada17999ccbb 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -45,8 +45,26 @@ mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
return 0;
}
+static int
+macronix_qpp4b_post_sfdp_fixups(struct spi_nor *nor)
+{
+ /* PP_1_1_4_4B is supported but missing in 4BAIT. */
+ struct spi_nor_flash_parameter *params = nor->params;
+
+ params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4;
+ spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP_1_1_4],
+ SPINOR_OP_PP_1_1_4_4B, SNOR_PROTO_1_1_4);
+
+ return 0;
+}
+
static const struct spi_nor_fixups mx25l25635_fixups = {
.post_bfpt = mx25l25635_post_bfpt_fixups,
+ .post_sfdp = macronix_qpp4b_post_sfdp_fixups,
+};
+
+static const struct spi_nor_fixups macronix_qpp4b_fixups = {
+ .post_sfdp = macronix_qpp4b_post_sfdp_fixups,
};
static const struct flash_info macronix_nor_parts[] = {
@@ -102,11 +120,13 @@ static const struct flash_info macronix_nor_parts[] = {
.size = SZ_64M,
.no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixup_flags = SPI_NOR_4B_OPCODES,
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x20, 0x1b),
.name = "mx66l1g45g",
.size = SZ_128M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x23, 0x14),
.name = "mx25v8035f",
@@ -154,18 +174,21 @@ static const struct flash_info macronix_nor_parts[] = {
.size = SZ_64M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixup_flags = SPI_NOR_4B_OPCODES,
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x3a),
.name = "mx66u51235f",
.size = SZ_64M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixup_flags = SPI_NOR_4B_OPCODES,
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x3c),
.name = "mx66u2g45g",
.size = SZ_256M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixup_flags = SPI_NOR_4B_OPCODES,
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x26, 0x18),
.name = "mx25l12855e",
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash
2025-02-11 6:30 [PATCH v2 0/2] Add support for Quad Input Page Program Cheng Ming Lin
2025-02-11 6:30 ` [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups " Cheng Ming Lin
@ 2025-02-11 6:30 ` Cheng Ming Lin
2025-03-07 6:35 ` [PATCH v2 0/2] Add support for Quad Input Page Program Tudor Ambarus
2 siblings, 0 replies; 10+ messages in thread
From: Cheng Ming Lin @ 2025-02-11 6:30 UTC (permalink / raw)
To: tudor.ambarus, pratyush, mwalle, miquel.raynal, richard,
vigneshr, linux-mtd, linux-kernel
Cc: alvinzhou, leoyu, Cheng Ming Lin
From: Cheng Ming Lin <chengminglin@mxic.com.tw>
Due to incorrect values in the 4-BAIT table for these two flash IDs,
it is necessary to add these two flash IDs with fixups.
Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2201c
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 7f 44 eb 08 6b 08 3b 04 bb |. ......D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff 87 49 bd 00 84 d2 04 e2 44 03 67 38 |.....I......D.g8|
00000060 30 b0 30 b0 f7 bd ff 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 36 00 27 9d f9 c0 64 85 cb ff ff ff ff ff ff |.6.'...d........|
00000120
zynq> sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
9af233495e5cffd2f38e9e2b8334a0d51c01fa93e9a17a991f674c8d6a350358 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
zynq> cat /sys/kernel/debug/spi-nor/spi0.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-1S-4S
opcode 0x34
1S-4S-4S
opcode 0x3e
zynq> cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id c2 20 1c c2 20 1c
size 256 MiB
write size 1
page size 256
address nbytes 4
flags 4B_OPCODES | HAS_4BAIT | SOFT_RESET
opcodes
read 0xec
dummy cycles 6
erase 0xdc
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 (256 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+----------
00000000-0fffffff | [ 3] | no
zynq> dd if=/dev/urandom of=/tmp/spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 0.082418 seconds, 24.3MB/s
zynq> mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read
Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read
zynq> hexdump /tmp/spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
zynq> sha256sum /tmp/spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_read
zynq> mtd_debug write /dev/mtd0 0 2097152 /tmp/spi_test
Copied 2097152 bytes from /tmp/spi_test to address 0x00000000 in flash
zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read
Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read
zynq> sha256sum /tmp/spi*
affd6358abe2a75a7edd4d28a9c62bbb25d485c8958993d6e4fbc3de579b8dc0 /tmp/spi_read
affd6358abe2a75a7edd4d28a9c62bbb25d485c8958993d6e4fbc3de579b8dc0 /tmp/spi_test
zynq> mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read
Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read
zynq> sha256sum /tmp/spi*
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_read
affd6358abe2a75a7edd4d28a9c62bbb25d485c8958993d6e4fbc3de579b8dc0 /tmp/spi_test
zynq> mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 268435456 (256M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2253b
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
zynq> hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000 53 46 44 50 06 01 02 ff 00 06 01 10 30 00 00 ff |SFDP........0...|
00000010 c2 00 01 04 10 01 00 ff 84 00 01 02 c0 00 00 ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 3f 44 eb 08 6b 08 3b 04 bb |. .....?D..k.;..|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff 89 49 bd 00 8d 12 00 e2 44 03 67 44 |.....I......D.gD|
00000060 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 |0.0....\J.)..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 7f 8f ff ff 21 5c dc ff ff ff ff ff ff ff ff ff |....!\..........|
(wrong bit here, 7f should be ff)
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 00 20 00 17 9d f9 c0 64 85 cb ff ff ff ff ff ff |. .....d........|
00000120
zynq> sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
ef47525560aa30ca7eb4634eb2eb15a0aa618d3b61f774933f9935d05fb475f6 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
zynq> cat /sys/kernel/debug/spi-nor/spi0.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-1S-4S
opcode 0x34
1S-4S-4S
opcode 0x3e
zynq> cat /sys/kernel/debug/spi-nor/spi0.0/params
name (null)
id c2 25 3b c2 25 3b
size 128 MiB
write size 1
page size 256
address nbytes 4
flags 4B_OPCODES | HAS_4BAIT | SOFT_RESET
opcodes
read 0xec
dummy cycles 6
erase 0xdc
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 (128 MiB)
sector map
region (in hex) | erase mask | overlaid
------------------+------------+----------
00000000-07ffffff | [ 3] | no
zynq> dd if=/dev/urandom of=/tmp/spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 0.082397 seconds, 24.3MB/s
zynq> mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read
Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read
zynq> hexdump /tmp/spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000
zynq> sha256sum /tmp/spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_read
zynq> mtd_debug write /dev/mtd0 0 2097152 /tmp/spi_test
Copied 2097152 bytes from /tmp/spi_test to address 0x00000000 in flash
zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read
Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read
zynq> sha256sum /tmp/spi*
8b57e38d293cf08cca7ef239ee70d20d70356ae798c2065576463414e490a759 /tmp/spi_read
8b57e38d293cf08cca7ef239ee70d20d70356ae798c2065576463414e490a759 /tmp/spi_test
zynq> mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
zynq> mtd_debug read /dev/mtd0 0 2097152 /tmp/spi_read
Copied 2097152 bytes from address 0x00000000 in flash to /tmp/spi_read
zynq> sha256sum /tmp/spi*
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 /tmp/spi_read
8b57e38d293cf08cca7ef239ee70d20d70356ae798c2065576463414e490a759 /tmp/spi_test
zynq> mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 134217728 (128M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
drivers/mtd/spi-nor/macronix.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index ada17999ccbb..39a2a88ad54b 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -127,6 +127,10 @@ static const struct flash_info macronix_nor_parts[] = {
.size = SZ_128M,
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixups = ¯onix_qpp4b_fixups,
+ }, {
+ /* MX66L2G45G */
+ .id = SNOR_ID(0xc2, 0x20, 0x1c),
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x23, 0x14),
.name = "mx25v8035f",
@@ -182,6 +186,10 @@ static const struct flash_info macronix_nor_parts[] = {
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
.fixup_flags = SPI_NOR_4B_OPCODES,
.fixups = ¯onix_qpp4b_fixups,
+ }, {
+ /* MX66U1G45G */
+ .id = SNOR_ID(0xc2, 0x25, 0x3b),
+ .fixups = ¯onix_qpp4b_fixups,
}, {
.id = SNOR_ID(0xc2, 0x25, 0x3c),
.name = "mx66u2g45g",
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
2025-02-11 6:30 ` [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups " Cheng Ming Lin
@ 2025-02-11 7:20 ` Tudor Ambarus
2025-03-06 11:01 ` Tudor Ambarus
0 siblings, 1 reply; 10+ messages in thread
From: Tudor Ambarus @ 2025-02-11 7:20 UTC (permalink / raw)
To: Cheng Ming Lin, pratyush, mwalle, miquel.raynal, richard,
vigneshr, linux-mtd, linux-kernel
Cc: alvinzhou, leoyu, Cheng Ming Lin
Haven't checked the actual bit, but I trust you you verified thoroughly.
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
On 2/11/25 6:30 AM, Cheng Ming Lin wrote:
> .fixup_flags = SPI_NOR_4B_OPCODES,
> + .fixups = ¯onix_qpp4b_fixups,
For your next patch that'll drop the redundant flash info fields, you
can drop SPI_NOR_4B_OPCODES as well if these flashes define the 4bait
sfdp table.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
2025-02-11 7:20 ` Tudor Ambarus
@ 2025-03-06 11:01 ` Tudor Ambarus
2025-03-06 11:39 ` Cheng Ming Lin
0 siblings, 1 reply; 10+ messages in thread
From: Tudor Ambarus @ 2025-03-06 11:01 UTC (permalink / raw)
To: Cheng Ming Lin, pratyush, mwalle, miquel.raynal, richard,
vigneshr, linux-mtd, linux-kernel
Cc: alvinzhou, leoyu, Cheng Ming Lin
On 2/11/25 7:20 AM, Tudor Ambarus wrote:
> On 2/11/25 6:30 AM, Cheng Ming Lin wrote:
>> .fixup_flags = SPI_NOR_4B_OPCODES,
>> + .fixups = ¯onix_qpp4b_fixups,
> For your next patch that'll drop the redundant flash info fields, you
> can drop SPI_NOR_4B_OPCODES as well if these flashes define the 4bait
> sfdp table.
Any plan in doing this, please?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
2025-03-06 11:01 ` Tudor Ambarus
@ 2025-03-06 11:39 ` Cheng Ming Lin
2025-03-06 14:42 ` Tudor Ambarus
0 siblings, 1 reply; 10+ messages in thread
From: Cheng Ming Lin @ 2025-03-06 11:39 UTC (permalink / raw)
To: Tudor Ambarus
Cc: pratyush, mwalle, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, alvinzhou, leoyu, Cheng Ming Lin
Hi Tudor,
Tudor Ambarus <tudor.ambarus@linaro.org> 於 2025年3月6日 週四 下午7:01寫道:
>
>
>
> On 2/11/25 7:20 AM, Tudor Ambarus wrote:
> > On 2/11/25 6:30 AM, Cheng Ming Lin wrote:
> >> .fixup_flags = SPI_NOR_4B_OPCODES,
> >> + .fixups = ¯onix_qpp4b_fixups,
> > For your next patch that'll drop the redundant flash info fields, you
> > can drop SPI_NOR_4B_OPCODES as well if these flashes define the 4bait
> > sfdp table.
>
> Any plan in doing this, please?
Sorry for the late reply.
This matter is currently in progress. Since collecting all the chips
will take some more time, the project has been delayed. Once I
have all the chips, I will start the verification process immediately.
Thanks for the reminder.
Thanks,
Cheng Ming Lin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
2025-03-06 11:39 ` Cheng Ming Lin
@ 2025-03-06 14:42 ` Tudor Ambarus
2025-03-07 1:32 ` Cheng Ming Lin
0 siblings, 1 reply; 10+ messages in thread
From: Tudor Ambarus @ 2025-03-06 14:42 UTC (permalink / raw)
To: Cheng Ming Lin
Cc: pratyush, mwalle, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, alvinzhou, leoyu, Cheng Ming Lin
On 3/6/25 11:39 AM, Cheng Ming Lin wrote:
> Hi Tudor,
>
> Tudor Ambarus <tudor.ambarus@linaro.org> 於 2025年3月6日 週四 下午7:01寫道:
>>
>>
>>
>> On 2/11/25 7:20 AM, Tudor Ambarus wrote:
>>> On 2/11/25 6:30 AM, Cheng Ming Lin wrote:
>>>> .fixup_flags = SPI_NOR_4B_OPCODES,
>>>> + .fixups = ¯onix_qpp4b_fixups,
>>> For your next patch that'll drop the redundant flash info fields, you
>>> can drop SPI_NOR_4B_OPCODES as well if these flashes define the 4bait
>>> sfdp table.
>>
>> Any plan in doing this, please?
>
> Sorry for the late reply.
>
> This matter is currently in progress. Since collecting all the chips
> will take some more time, the project has been delayed. Once I
> have all the chips, I will start the verification process immediately.
> Thanks for the reminder.
>
Thanks, Cheng. Switching them one by one is fine too.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
2025-03-06 14:42 ` Tudor Ambarus
@ 2025-03-07 1:32 ` Cheng Ming Lin
0 siblings, 0 replies; 10+ messages in thread
From: Cheng Ming Lin @ 2025-03-07 1:32 UTC (permalink / raw)
To: Tudor Ambarus
Cc: pratyush, mwalle, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, alvinzhou, leoyu, Cheng Ming Lin
Hi Tudor,
Tudor Ambarus <tudor.ambarus@linaro.org> 於 2025年3月6日 週四 下午10:42寫道:
>
>
>
> On 3/6/25 11:39 AM, Cheng Ming Lin wrote:
> > Hi Tudor,
> >
> > Tudor Ambarus <tudor.ambarus@linaro.org> 於 2025年3月6日 週四 下午7:01寫道:
> >>
> >>
> >>
> >> On 2/11/25 7:20 AM, Tudor Ambarus wrote:
> >>> On 2/11/25 6:30 AM, Cheng Ming Lin wrote:
> >>>> .fixup_flags = SPI_NOR_4B_OPCODES,
> >>>> + .fixups = ¯onix_qpp4b_fixups,
> >>> For your next patch that'll drop the redundant flash info fields, you
> >>> can drop SPI_NOR_4B_OPCODES as well if these flashes define the 4bait
> >>> sfdp table.
> >>
> >> Any plan in doing this, please?
> >
> > Sorry for the late reply.
> >
> > This matter is currently in progress. Since collecting all the chips
> > will take some more time, the project has been delayed. Once I
> > have all the chips, I will start the verification process immediately.
> > Thanks for the reminder.
> >
>
> Thanks, Cheng. Switching them one by one is fine too.
Got it, no problem. I will start the verification with the
chips I have on hand.
Thanks,
Cheng Ming Lin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/2] Add support for Quad Input Page Program
2025-02-11 6:30 [PATCH v2 0/2] Add support for Quad Input Page Program Cheng Ming Lin
2025-02-11 6:30 ` [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups " Cheng Ming Lin
2025-02-11 6:30 ` [PATCH v2 2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash Cheng Ming Lin
@ 2025-03-07 6:35 ` Tudor Ambarus
2025-03-10 1:49 ` Cheng Ming Lin
2 siblings, 1 reply; 10+ messages in thread
From: Tudor Ambarus @ 2025-03-07 6:35 UTC (permalink / raw)
To: pratyush, mwalle, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, Cheng Ming Lin
Cc: Tudor Ambarus, alvinzhou, leoyu, Cheng Ming Lin
On Tue, 11 Feb 2025 14:30:26 +0800, Cheng Ming Lin wrote:
> Support for the Quad Input Page Program feature.
>
> Some Macronix NOR flash support the Quad Input Page Program feature, but
> the 4-Byte Address Instruction Table definition in the SFDP is incorrect.
> To properly enable this feature, a post_sfdp fixups implementation is
> introduced.
>
> [...]
Please rnu ./scripts/checkpatch --strict before submitting. Fixed alignment
to match open pharenthesis, updated commit subject.
Applied, thanks!
[1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
https://git.kernel.org/mtd/c/798aafeffb36
[2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash
https://git.kernel.org/mtd/c/797bbaa7531f
Best regards,
--
Tudor Ambarus <tudor.ambarus@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/2] Add support for Quad Input Page Program
2025-03-07 6:35 ` [PATCH v2 0/2] Add support for Quad Input Page Program Tudor Ambarus
@ 2025-03-10 1:49 ` Cheng Ming Lin
0 siblings, 0 replies; 10+ messages in thread
From: Cheng Ming Lin @ 2025-03-10 1:49 UTC (permalink / raw)
To: Tudor Ambarus
Cc: pratyush, mwalle, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel, alvinzhou, leoyu, Cheng Ming Lin
Hi Tudor,
Tudor Ambarus <tudor.ambarus@linaro.org> 於 2025年3月7日 週五 下午2:35寫道:
>
>
> On Tue, 11 Feb 2025 14:30:26 +0800, Cheng Ming Lin wrote:
> > Support for the Quad Input Page Program feature.
> >
> > Some Macronix NOR flash support the Quad Input Page Program feature, but
> > the 4-Byte Address Instruction Table definition in the SFDP is incorrect.
> > To properly enable this feature, a post_sfdp fixups implementation is
> > introduced.
> >
> > [...]
>
> Please rnu ./scripts/checkpatch --strict before submitting. Fixed alignment
> to match open pharenthesis, updated commit subject.
Got it, thanks for the reminder. I'll make sure to do that from now on.
> Applied, thanks!
>
> [1/2] mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
> https://git.kernel.org/mtd/c/798aafeffb36
> [2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash
> https://git.kernel.org/mtd/c/797bbaa7531f
>
> Best regards,
> --
> Tudor Ambarus <tudor.ambarus@linaro.org>
Thanks,
Cheng Ming Lin
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-03-10 1:54 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-11 6:30 [PATCH v2 0/2] Add support for Quad Input Page Program Cheng Ming Lin
2025-02-11 6:30 ` [PATCH v2 1/2] mtd: spi-nor: macronix: Add post_sfdp fixups " Cheng Ming Lin
2025-02-11 7:20 ` Tudor Ambarus
2025-03-06 11:01 ` Tudor Ambarus
2025-03-06 11:39 ` Cheng Ming Lin
2025-03-06 14:42 ` Tudor Ambarus
2025-03-07 1:32 ` Cheng Ming Lin
2025-02-11 6:30 ` [PATCH v2 2/2] mtd: spi-nor: macronix: Add support for Macronix NOR Flash Cheng Ming Lin
2025-03-07 6:35 ` [PATCH v2 0/2] Add support for Quad Input Page Program Tudor Ambarus
2025-03-10 1:49 ` Cheng Ming Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®