1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2005, Intec Automation Inc.
4 * Copyright (C) 2014, Freescale Semiconductor, Inc.
7 #include <linux/mtd/spi-nor.h>
12 mx25l25635_post_bfpt_fixups(struct spi_nor
*nor
,
13 const struct sfdp_parameter_header
*bfpt_header
,
14 const struct sfdp_bfpt
*bfpt
)
17 * MX25L25635F supports 4B opcodes but MX25L25635E does not.
18 * Unfortunately, Macronix has re-used the same JEDEC ID for both
19 * variants which prevents us from defining a new entry in the parts
21 * We need a way to differentiate MX25L25635E and MX25L25635F, and it
22 * seems that the F version advertises support for Fast Read 4-4-4 in
25 if (bfpt
->dwords
[SFDP_DWORD(5)] & BFPT_DWORD5_FAST_READ_4_4_4
)
26 nor
->flags
|= SNOR_F_4B_OPCODES
;
31 static const struct spi_nor_fixups mx25l25635_fixups
= {
32 .post_bfpt
= mx25l25635_post_bfpt_fixups
,
35 static const struct flash_info macronix_nor_parts
[] = {
37 .id
= SNOR_ID(0xc2, 0x20, 0x10),
40 .no_sfdp_flags
= SECT_4K
,
42 .id
= SNOR_ID(0xc2, 0x20, 0x12),
45 .no_sfdp_flags
= SECT_4K
,
47 .id
= SNOR_ID(0xc2, 0x20, 0x13),
50 .no_sfdp_flags
= SECT_4K
,
52 .id
= SNOR_ID(0xc2, 0x20, 0x14),
56 .id
= SNOR_ID(0xc2, 0x20, 0x15),
59 .no_sfdp_flags
= SECT_4K
,
61 .id
= SNOR_ID(0xc2, 0x20, 0x16),
64 .no_sfdp_flags
= SECT_4K
,
66 .id
= SNOR_ID(0xc2, 0x20, 0x17),
69 .no_sfdp_flags
= SECT_4K
,
71 .id
= SNOR_ID(0xc2, 0x20, 0x18),
72 .name
= "mx25l12805d",
74 .flags
= SPI_NOR_HAS_LOCK
| SPI_NOR_4BIT_BP
,
75 .no_sfdp_flags
= SECT_4K
,
77 .id
= SNOR_ID(0xc2, 0x20, 0x19),
78 .name
= "mx25l25635e",
80 .no_sfdp_flags
= SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
81 .fixups
= &mx25l25635_fixups
83 .id
= SNOR_ID(0xc2, 0x20, 0x1a),
84 .name
= "mx66l51235f",
86 .no_sfdp_flags
= SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
87 .fixup_flags
= SPI_NOR_4B_OPCODES
,
89 .id
= SNOR_ID(0xc2, 0x20, 0x1b),
92 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
94 .id
= SNOR_ID(0xc2, 0x23, 0x14),
97 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
99 .id
= SNOR_ID(0xc2, 0x25, 0x32),
100 .name
= "mx25u2033e",
102 .no_sfdp_flags
= SECT_4K
,
104 .id
= SNOR_ID(0xc2, 0x25, 0x33),
107 .no_sfdp_flags
= SECT_4K
,
109 .id
= SNOR_ID(0xc2, 0x25, 0x34),
112 .no_sfdp_flags
= SECT_4K
,
114 .id
= SNOR_ID(0xc2, 0x25, 0x36),
115 .name
= "mx25u3235f",
117 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
119 .id
= SNOR_ID(0xc2, 0x25, 0x37),
120 .name
= "mx25u6435f",
122 .no_sfdp_flags
= SECT_4K
,
124 .id
= SNOR_ID(0xc2, 0x25, 0x38),
125 .name
= "mx25u12835f",
127 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
129 .id
= SNOR_ID(0xc2, 0x25, 0x39),
130 .name
= "mx25u25635f",
132 .no_sfdp_flags
= SECT_4K
,
133 .fixup_flags
= SPI_NOR_4B_OPCODES
,
135 .id
= SNOR_ID(0xc2, 0x25, 0x3a),
136 .name
= "mx25u51245g",
138 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
139 .fixup_flags
= SPI_NOR_4B_OPCODES
,
141 .id
= SNOR_ID(0xc2, 0x25, 0x3a),
142 .name
= "mx66u51235f",
144 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
145 .fixup_flags
= SPI_NOR_4B_OPCODES
,
147 .id
= SNOR_ID(0xc2, 0x25, 0x3c),
148 .name
= "mx66u2g45g",
150 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
151 .fixup_flags
= SPI_NOR_4B_OPCODES
,
153 .id
= SNOR_ID(0xc2, 0x26, 0x18),
154 .name
= "mx25l12855e",
157 .id
= SNOR_ID(0xc2, 0x26, 0x19),
158 .name
= "mx25l25655e",
161 .id
= SNOR_ID(0xc2, 0x26, 0x1b),
162 .name
= "mx66l1g55g",
164 .no_sfdp_flags
= SPI_NOR_QUAD_READ
,
166 .id
= SNOR_ID(0xc2, 0x28, 0x15),
167 .name
= "mx25r1635f",
169 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
171 .id
= SNOR_ID(0xc2, 0x28, 0x16),
172 .name
= "mx25r3235f",
174 .no_sfdp_flags
= SECT_4K
| SPI_NOR_DUAL_READ
| SPI_NOR_QUAD_READ
,
176 .id
= SNOR_ID(0xc2, 0x81, 0x3a),
177 .name
= "mx25uw51245g",
179 .flags
= SPI_NOR_RWW
,
181 .id
= SNOR_ID(0xc2, 0x9e, 0x16),
182 .name
= "mx25l3255e",
184 .no_sfdp_flags
= SECT_4K
,
188 static void macronix_nor_default_init(struct spi_nor
*nor
)
190 nor
->params
->quad_enable
= spi_nor_sr1_bit6_quad_enable
;
193 static int macronix_nor_late_init(struct spi_nor
*nor
)
195 if (!nor
->params
->set_4byte_addr_mode
)
196 nor
->params
->set_4byte_addr_mode
= spi_nor_set_4byte_addr_mode_en4b_ex4b
;
201 static const struct spi_nor_fixups macronix_nor_fixups
= {
202 .default_init
= macronix_nor_default_init
,
203 .late_init
= macronix_nor_late_init
,
206 const struct spi_nor_manufacturer spi_nor_macronix
= {
208 .parts
= macronix_nor_parts
,
209 .nparts
= ARRAY_SIZE(macronix_nor_parts
),
210 .fixups
= ¯onix_nor_fixups
,