|
11 | 11 | /* flash_info mfr_flag. Used to read proprietary FSR register. */
|
12 | 12 | #define USE_FSR BIT(0)
|
13 | 13 |
|
| 14 | +#define SPINOR_OP_MT_DIE_ERASE 0xc4 /* Chip (die) erase opcode */ |
14 | 15 | #define SPINOR_OP_RDFSR 0x70 /* Read flag status register */
|
15 | 16 | #define SPINOR_OP_CLFSR 0x50 /* Clear flag status register */
|
16 | 17 | #define SPINOR_OP_MT_DTR_RD 0xfd /* Fast Read opcode in DTR mode */
|
@@ -192,6 +193,30 @@ static struct spi_nor_fixups mt25qu512a_fixups = {
|
192 | 193 | .post_bfpt = mt25qu512a_post_bfpt_fixup,
|
193 | 194 | };
|
194 | 195 |
|
| 196 | +static int st_nor_four_die_late_init(struct spi_nor *nor) |
| 197 | +{ |
| 198 | + struct spi_nor_flash_parameter *params = nor->params; |
| 199 | + |
| 200 | + params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE; |
| 201 | + params->n_dice = 4; |
| 202 | + |
| 203 | + /* |
| 204 | + * Unfortunately the die erase opcode does not have a 4-byte opcode |
| 205 | + * correspondent for these flashes. The SFDP 4BAIT table fails to |
| 206 | + * consider the die erase too. We're forced to enter in the 4 byte |
| 207 | + * address mode in order to benefit of the die erase. |
| 208 | + */ |
| 209 | + return spi_nor_set_4byte_addr_mode(nor, true); |
| 210 | +} |
| 211 | + |
| 212 | +static struct spi_nor_fixups n25q00_fixups = { |
| 213 | + .late_init = st_nor_four_die_late_init, |
| 214 | +}; |
| 215 | + |
| 216 | +static struct spi_nor_fixups mt25q02_fixups = { |
| 217 | + .late_init = st_nor_four_die_late_init, |
| 218 | +}; |
| 219 | + |
195 | 220 | static const struct flash_info st_nor_parts[] = {
|
196 | 221 | {
|
197 | 222 | .name = "m25p05-nonjedec",
|
@@ -366,16 +391,17 @@ static const struct flash_info st_nor_parts[] = {
|
366 | 391 | .name = "n25q00",
|
367 | 392 | .size = SZ_128M,
|
368 | 393 | .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
|
369 |
| - SPI_NOR_BP3_SR_BIT6 | NO_CHIP_ERASE, |
| 394 | + SPI_NOR_BP3_SR_BIT6, |
370 | 395 | .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
|
371 | 396 | .mfr_flags = USE_FSR,
|
| 397 | + .fixups = &n25q00_fixups, |
372 | 398 | }, {
|
373 | 399 | .id = SNOR_ID(0x20, 0xba, 0x22),
|
374 | 400 | .name = "mt25ql02g",
|
375 | 401 | .size = SZ_256M,
|
376 |
| - .flags = NO_CHIP_ERASE, |
377 | 402 | .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
|
378 | 403 | .mfr_flags = USE_FSR,
|
| 404 | + .fixups = &mt25q02_fixups, |
379 | 405 | }, {
|
380 | 406 | .id = SNOR_ID(0x20, 0xbb, 0x15),
|
381 | 407 | .name = "n25q016a",
|
@@ -433,16 +459,16 @@ static const struct flash_info st_nor_parts[] = {
|
433 | 459 | .id = SNOR_ID(0x20, 0xbb, 0x21),
|
434 | 460 | .name = "n25q00a",
|
435 | 461 | .size = SZ_128M,
|
436 |
| - .flags = NO_CHIP_ERASE, |
437 | 462 | .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
|
438 | 463 | .mfr_flags = USE_FSR,
|
| 464 | + .fixups = &n25q00_fixups, |
439 | 465 | }, {
|
440 | 466 | .id = SNOR_ID(0x20, 0xbb, 0x22),
|
441 | 467 | .name = "mt25qu02g",
|
442 | 468 | .size = SZ_256M,
|
443 |
| - .flags = NO_CHIP_ERASE, |
444 | 469 | .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
445 | 470 | .mfr_flags = USE_FSR,
|
| 471 | + .fixups = &mt25q02_fixups, |
446 | 472 | }
|
447 | 473 | };
|
448 | 474 |
|
|
0 commit comments