mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shiji Yang <yangshiji66@outlook.com>
To: linchengming884@gmail.com
Cc: alvinzhou@mxic.com.tw, chengminglin@mxic.com.tw,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	miquel.raynal@bootlin.com, mwalle@kernel.org,
	pratyush@kernel.org, richard@nod.at,
	takahiro.kuwano@infineon.com, vigneshr@ti.com,
	Shiji Yang <yangshiji66@outlook.com>
Subject: Re: [PATCH v3 1/2] mtd: spi-nor: Add support for MX25L12833F and MX25L12845G
Date: Sat, 22 Aug 2026 20:06:25 +0800	[thread overview]
Message-ID: <OSZPR01MB77956D321DA7F2F6E17853A2BCA22@OSZPR01MB7795.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20260605084837.1875896-2-linchengming884@gmail.com>

On Fri,  5 Jun 2026 16:48:36 +0800, Cheng Ming Lin wrote:

> From: Cheng Ming Lin <chengminglin@mxic.com.tw>
> 
> Add support for Macronix MX25L12833F and MX25L12845G SPI NOR flashes.
> These parts share the same JEDEC ID (0xc2, 0x20, 0x18) as the legacy
> MX25L12805D.
> 
> The newer flashes support SFDP and 1-4-4 Page Program in 3-byte address
> mode, but this 4PP capability is not defined in their SFDP tables.
> Conversely, the legacy MX25L12805D lacks SFDP support entirely and does
> not support 4PP.
> 
> To safely enable 4PP for the newer flashes without breaking the legacy
> part, introduce a post_sfdp fixup. Since the legacy MX25L12805D does
> not support SFDP, it falls back to static parameters and will never
> execute the post_sfdp hook. The newer flashes will successfully parse
> the SFDP, trigger the hook, and safely append the SNOR_HWCAPS_PP_1_4_4
> capability.
> 
> Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
> ---
>  drivers/mtd/spi-nor/macronix.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
> index e97f5cbd9..1adb79832 100644
> --- a/drivers/mtd/spi-nor/macronix.c
> +++ b/drivers/mtd/spi-nor/macronix.c
> @@ -83,6 +83,25 @@ mx25l3255e_late_init_fixups(struct spi_nor *nor)
>  	return 0;
>  }
>  
> +static int
> +mx25l12805d_4pp3b_post_sfdp_fixups(struct spi_nor *nor)
> +{
> +	struct spi_nor_flash_parameter *params = nor->params;
> +
> +	/*
> +	 * JEDEC ID 0xc22018 is shared by MX25L12805D (no SFDP, no 4PP) and
> +	 * MX25L12833F/MX25L12845G (support SFDP and 4PP in 3-byte mode).
> +	 * The legacy 05D lacks SFDP and will not execute this hook. For
> +	 * the newer flashes, 3-byte 1-4-4 PP is not defined in SFDP, so
> +	 * we safely enable it here.
> +	 */
> +	params->hwcaps.mask |= SNOR_HWCAPS_PP_1_4_4;
> +	spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_1_4_4],
> +				SPINOR_OP_PP_1_4_4, SNOR_PROTO_1_4_4);
> +
> +	return 0;
> +}
> +
>  static const struct spi_nor_fixups mx25l25635_fixups = {
>  	.post_bfpt = mx25l25635_post_bfpt_fixups,
>  	.post_sfdp = macronix_qpp4b_post_sfdp_fixups,
> @@ -96,6 +115,10 @@ static const struct spi_nor_fixups mx25l3255e_fixups = {
>  	.late_init = mx25l3255e_late_init_fixups,
>  };
>  
> +static const struct spi_nor_fixups mx25l12805d_4pp3b_fixups = {
> +	.post_sfdp = mx25l12805d_4pp3b_post_sfdp_fixups,

It seems that this fixup won't be called at all because the dual/quad
io support is missing. See:

	if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
					SPI_NOR_QUAD_READ |
					SPI_NOR_OCTAL_READ |
					SPI_NOR_OCTAL_DTR_READ))
		spi_nor_sfdp_init_params_deprecated(nor);

> +};
> +
>  static const struct flash_info macronix_nor_parts[] = {
>  	{
>  		.id = SNOR_ID(0xc2, 0x20, 0x10),
> @@ -130,9 +153,10 @@ static const struct flash_info macronix_nor_parts[] = {
>  		.size = SZ_8M,
>  		.no_sfdp_flags = SECT_4K,
>  	}, {
> -		/* MX25L12805D */
> +		/* MX25L12805D, MX25L12833F, MX25L12845G */
>  		.id = SNOR_ID(0xc2, 0x20, 0x18),
>  		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP,
> +		.fixups = &mx25l12805d_4pp3b_fixups,
>  	}, {
>  		/* MX25L25635E, MX25L25645G */
>  		.id = SNOR_ID(0xc2, 0x20, 0x19),
> -- 
> 2.25.1
> 

Regards,
Shiji Yang

  parent reply	other threads:[~2026-08-22 12:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05  8:48 [PATCH v3 0/2] mtd: spi-nor: macronix: " Cheng Ming Lin
2026-06-05  8:48 ` [PATCH v3 1/2] mtd: spi-nor: " Cheng Ming Lin
2026-08-11  6:31   ` Michael Walle
2026-08-22 12:06   ` Shiji Yang [this message]
2026-08-22 15:09     ` Cheng Ming Lin
2026-06-05  8:48 ` [PATCH v3 2/2] mtd: spi-nor: macronix: Restore fallback parameters for MX25L12805D Cheng Ming Lin
2026-08-11  6:31   ` Michael Walle
2026-08-11  1:22 ` [PATCH v3 0/2] mtd: spi-nor: macronix: Add support for MX25L12833F and MX25L12845G Cheng Ming Lin
2026-08-11  6:31   ` Michael Walle
2026-08-18 10:48 ` Russell Senior
2026-09-04 13:40 ` Michael Walle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OSZPR01MB77956D321DA7F2F6E17853A2BCA22@OSZPR01MB7795.jpnprd01.prod.outlook.com \
    --to=yangshiji66@outlook.com \
    --cc=alvinzhou@mxic.com.tw \
    --cc=chengminglin@mxic.com.tw \
    --cc=linchengming884@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=takahiro.kuwano@infineon.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®