Skip to content

Commit

Permalink
mtd: spi-nor: macronix: Handle ID collision b/w MX25L3233F and MX25L3…
Browse files Browse the repository at this point in the history
…205D

Macronix has a bad habbit of reusing flash IDs. While MX25L3233F supports
RDSFDP opcode, MX25L3205D does not support it and does not recommend
issuing opcodes that are not supported ("It is not recommended to adopt
any other code not in the command definition table, which will potentially
enter the hidden mode.").

We tested the RDSFDP on the MX25L3205D and the conclusion is that the
flash didn't reply anything. Given that it is unlikely that RDSFDP will
cause any problems for the old MX25L3205D, differentiate between the two
flashes by parsing SFDP.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
  • Loading branch information
ambarus committed Jun 29, 2021
1 parent 4457bfe commit b760260
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion drivers/mtd/spi-nor/macronix.c
Expand Up @@ -8,6 +8,26 @@

#include "core.h"

static const char *mx25l3233f = "mx25l3233f";

static int mx25l3233f_post_bfpt_fixups(struct spi_nor *nor,
const struct sfdp_parameter_header *bfpt_header,
const struct sfdp_bfpt *bfpt)
{
/*
* Macronix has a bad habit of reusing flash IDs: MX25L3233F collides
* with MX25L3205D. MX25L3233F defines SFDP tables, while the older
* variant does not.
*/
nor->name = mx25l3233f;

return 0;
}

static struct spi_nor_fixups mx25l3233f_fixups = {
.post_bfpt = mx25l3233f_post_bfpt_fixups,
};

static int
mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
const struct sfdp_parameter_header *bfpt_header,
Expand Down Expand Up @@ -39,7 +59,9 @@ static const struct flash_info macronix_parts[] = {
{ "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) },
{ "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) },
{ "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) },
{ "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) },
{ "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SPI_NOR_PARSE_SFDP |
SECT_4K)
.fixups = &mx25l3233f_fixups },
{ "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) },
{ "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) },
{ "mx25u2033e", INFO(0xc22532, 0, 64 * 1024, 4, SECT_4K) },
Expand Down

0 comments on commit b760260

Please sign in to comment.