Skip to content

Commit 798aafe

Browse files
zmlin1998ambarus
authored andcommitted
mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ta: fix alignment to match open parenthesis] Signed-off-by: Tudor Ambarus <[email protected]>
1 parent 03e7bb8 commit 798aafe

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/mtd/spi-nor/macronix.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,26 @@ mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
4545
return 0;
4646
}
4747

48+
static int
49+
macronix_qpp4b_post_sfdp_fixups(struct spi_nor *nor)
50+
{
51+
/* PP_1_1_4_4B is supported but missing in 4BAIT. */
52+
struct spi_nor_flash_parameter *params = nor->params;
53+
54+
params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4;
55+
spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_1_1_4],
56+
SPINOR_OP_PP_1_1_4_4B, SNOR_PROTO_1_1_4);
57+
58+
return 0;
59+
}
60+
4861
static const struct spi_nor_fixups mx25l25635_fixups = {
4962
.post_bfpt = mx25l25635_post_bfpt_fixups,
63+
.post_sfdp = macronix_qpp4b_post_sfdp_fixups,
64+
};
65+
66+
static const struct spi_nor_fixups macronix_qpp4b_fixups = {
67+
.post_sfdp = macronix_qpp4b_post_sfdp_fixups,
5068
};
5169

5270
static const struct flash_info macronix_nor_parts[] = {
@@ -102,11 +120,13 @@ static const struct flash_info macronix_nor_parts[] = {
102120
.size = SZ_64M,
103121
.no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
104122
.fixup_flags = SPI_NOR_4B_OPCODES,
123+
.fixups = &macronix_qpp4b_fixups,
105124
}, {
106125
.id = SNOR_ID(0xc2, 0x20, 0x1b),
107126
.name = "mx66l1g45g",
108127
.size = SZ_128M,
109128
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
129+
.fixups = &macronix_qpp4b_fixups,
110130
}, {
111131
.id = SNOR_ID(0xc2, 0x23, 0x14),
112132
.name = "mx25v8035f",
@@ -148,18 +168,21 @@ static const struct flash_info macronix_nor_parts[] = {
148168
.size = SZ_64M,
149169
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
150170
.fixup_flags = SPI_NOR_4B_OPCODES,
171+
.fixups = &macronix_qpp4b_fixups,
151172
}, {
152173
.id = SNOR_ID(0xc2, 0x25, 0x3a),
153174
.name = "mx66u51235f",
154175
.size = SZ_64M,
155176
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
156177
.fixup_flags = SPI_NOR_4B_OPCODES,
178+
.fixups = &macronix_qpp4b_fixups,
157179
}, {
158180
.id = SNOR_ID(0xc2, 0x25, 0x3c),
159181
.name = "mx66u2g45g",
160182
.size = SZ_256M,
161183
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
162184
.fixup_flags = SPI_NOR_4B_OPCODES,
185+
.fixups = &macronix_qpp4b_fixups,
163186
}, {
164187
.id = SNOR_ID(0xc2, 0x26, 0x18),
165188
.name = "mx25l12855e",

0 commit comments

Comments
 (0)