[PATCH 4/7] mtd: spi-nor: macronix: Handle ID collision b/w MX25L12805D and MX25L12835F

Heiko Thiery heiko.thiery at gmail.com
Sun Jul 4 06:11:51 PDT 2021


Hi Tudor,

Am Fr., 2. Juli 2021 um 16:41 Uhr schrieb Tudor Ambarus
<tudor.ambarus at microchip.com>:
>
> MX25L12835F define SFDP, while MX25L12805D does not.

I tested this on the kontron pitx-imx8m board with a MX25L12835F equipped.

[    1.213448] spi-nor spi0.0: mx25l12835f (16384 Kbytes)

>
> Signed-off-by: Tudor Ambarus <tudor.ambarus at microchip.com>

Testd-by: Heiko Thiery <heiko.thiery at gmail.com>

> ---
>  drivers/mtd/spi-nor/macronix.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
> index 83a097708949..38701347bf04 100644
> --- a/drivers/mtd/spi-nor/macronix.c
> +++ b/drivers/mtd/spi-nor/macronix.c
> @@ -8,6 +8,26 @@
>
>  #include "core.h"
>
> +static const char *mx25l12835f = "mx25l12835f";
> +
> +static int mx25l12835f_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: MX25L12835F collides
> +        * with MX25L12805D. MX25L12835F defines SFDP tables, while the older
> +        * variant does not.
> +        */
> +       nor->name = mx25l12835f;
> +
> +       return 0;
> +}
> +
> +static struct spi_nor_fixups mx25l12835f_fixups = {
> +       .post_bfpt = mx25l12835f_post_bfpt_fixups,
> +};
> +
>  static const char *mx25l3233f = "mx25l3233f";
>
>  static int mx25l3233f_post_bfpt_fixups(struct spi_nor *nor,
> @@ -71,8 +91,9 @@ static const struct flash_info macronix_parts[] = {
>         { "mx25u4035",   INFO(0xc22533, 0, 64 * 1024,   8, SECT_4K) },
>         { "mx25u8035",   INFO(0xc22534, 0, 64 * 1024,  16, SECT_4K) },
>         { "mx25u6435f",  INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
> -       { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, SECT_4K |
> -                             SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) },
> +       { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, SPI_NOR_PARSE_SFDP |
> +                             SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP)
> +               .fixups = &mx25l12835f_fixups },
>         { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
>         { "mx25r1635f",  INFO(0xc22815, 0, 64 * 1024,  32,
>                               SECT_4K | SPI_NOR_DUAL_READ |

Thank you


--
Heiko



More information about the linux-mtd mailing list