diff mbox series

mtd: spi-nor: macronix: Add support for mx66l2g45g

Message ID 20240215155520.68159-1-sebastian.falbesoner@gmail.com
State Changes Requested
Delegated to: Michael Walle
Headers show
Series mtd: spi-nor: macronix: Add support for mx66l2g45g | expand

Commit Message

Sebastian Falbesoner Feb. 15, 2024, 3:55 p.m. UTC
From: Sebastian Falbesoner <s.falbesoner@schrack-seconet.com>

For reference, see the corresponding entry in u-boot,
introduced in commit baef13ec9d592a27b5d3bf03967bfd2bebd65157:

[ in drivers/mtd/spi/spi-nor-ids.c:274 ]
----
{ INFO("mx66l2g45g",  0xc2201c, 0, 64 * 1024, 4096,
  SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
----

Signed-off-by: Sebastian Falbesoner <s.falbesoner@schrack-seconet.com>
---
 drivers/mtd/spi-nor/macronix.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Joakim Tjernlund Feb. 15, 2024, 4:02 p.m. UTC | #1
On Thu, 2024-02-15 at 16:55 +0100, Sebastian Falbesoner wrote:
> From: Sebastian Falbesoner <s.falbesoner@schrack-seconet.com>
> 
> For reference, see the corresponding entry in u-boot,
> introduced in commit baef13ec9d592a27b5d3bf03967bfd2bebd65157:
> 
> [ in drivers/mtd/spi/spi-nor-ids.c:274 ]

I think this should go to stable as well?

> ----
> { INFO("mx66l2g45g",  0xc2201c, 0, 64 * 1024, 4096,
>   SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
> ----
> 
> Signed-off-by: Sebastian Falbesoner <s.falbesoner@schrack-seconet.com>
> ---
>  drivers/mtd/spi-nor/macronix.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
> index ea6be95e75a5..1a8f8b654dda 100644
> --- a/drivers/mtd/spi-nor/macronix.c
> +++ b/drivers/mtd/spi-nor/macronix.c
> @@ -90,6 +90,12 @@ static const struct flash_info macronix_nor_parts[] = {
>  		.name = "mx66l1g45g",
>  		.size = SZ_128M,
>  		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> +	}, {
> +		.id = SNOR_ID(0xc2, 0x20, 0x1c),
> +		.name = "mx66l2g45g",
> +		.size = SZ_256M,
> +		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> +		.fixup_flags = SPI_NOR_4B_OPCODES,
>  	}, {
>  		.id = SNOR_ID(0xc2, 0x23, 0x14),
>  		.name = "mx25v8035f",
Michael Walle Feb. 15, 2024, 4:13 p.m. UTC | #2
Hi,

On Thu Feb 15, 2024 at 4:55 PM CET, Sebastian Falbesoner wrote:
> From: Sebastian Falbesoner <s.falbesoner@schrack-seconet.com>
>
> For reference, see the corresponding entry in u-boot,
> introduced in commit baef13ec9d592a27b5d3bf03967bfd2bebd65157:

Please keep in mind that you still need a proper commit message,
SFDP dumps and test have it included in linux, see [1].

>
> [ in drivers/mtd/spi/spi-nor-ids.c:274 ]
> ----
> { INFO("mx66l2g45g",  0xc2201c, 0, 64 * 1024, 4096,
>   SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
> ----
>
> Signed-off-by: Sebastian Falbesoner <s.falbesoner@schrack-seconet.com>
> ---
>  drivers/mtd/spi-nor/macronix.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
> index ea6be95e75a5..1a8f8b654dda 100644
> --- a/drivers/mtd/spi-nor/macronix.c
> +++ b/drivers/mtd/spi-nor/macronix.c
> @@ -90,6 +90,12 @@ static const struct flash_info macronix_nor_parts[] = {
>  		.name = "mx66l1g45g",
>  		.size = SZ_128M,
>  		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> +	}, {
> +		.id = SNOR_ID(0xc2, 0x20, 0x1c),
> +		.name = "mx66l2g45g",
> +		.size = SZ_256M,
> +		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> +		.fixup_flags = SPI_NOR_4B_OPCODES,
>  	}, {
>  		.id = SNOR_ID(0xc2, 0x23, 0x14),
>  		.name = "mx25v8035f",

I'm pretty sure, this flash will work without any modification by
using the generic driver (and maybe using the vendor fixups). See
also previous discussions [2]. Thus, I think the following should be
enough:
+	{ .id = SNOR_ID(0xc2, 0x20, 0x1c) }

*But* there is already a patchset under review to add SNOR_ID(0xc2)
to match any macronix flashes. Therefore, with the patch in [2]
applied, this flash should work without any further entries.

-michael

[1] https://docs.kernel.org/driver-api/mtd/spi-nor.html
[2] https://lore.kernel.org/linux-mtd/?q=mx66l2g45g
[3] https://lore.kernel.org/r/8b80cf233ea0065adf9841408e59f6a2@kernel.org/
Michael Walle Feb. 22, 2024, 2:06 p.m. UTC | #3
Hi,

> I'm pretty sure, this flash will work without any modification by
> using the generic driver (and maybe using the vendor fixups). See
> also previous discussions [2]. Thus, I think the following should be
> enough:
> +	{ .id = SNOR_ID(0xc2, 0x20, 0x1c) }
>
> *But* there is already a patchset under review to add SNOR_ID(0xc2)
> to match any macronix flashes. Therefore, with the patch in [2]
> applied, this flash should work without any further entries.

It looks like that series it taking a while. If you want to speed
things up, add this to the macronix_nor_parts[], test whether it
works for your flash and submit a patch for it.

+    /* Need the manufacturer fixups. Keep this last */
+    { .id = SNOR_ID(0xc2) }

-michael

> [1] https://docs.kernel.org/driver-api/mtd/spi-nor.html
> [2] https://lore.kernel.org/linux-mtd/?q=mx66l2g45g
> [3] https://lore.kernel.org/r/8b80cf233ea0065adf9841408e59f6a2@kernel.org/
diff mbox series

Patch

diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index ea6be95e75a5..1a8f8b654dda 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -90,6 +90,12 @@  static const struct flash_info macronix_nor_parts[] = {
 		.name = "mx66l1g45g",
 		.size = SZ_128M,
 		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc2, 0x20, 0x1c),
+		.name = "mx66l2g45g",
+		.size = SZ_256M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+		.fixup_flags = SPI_NOR_4B_OPCODES,
 	}, {
 		.id = SNOR_ID(0xc2, 0x23, 0x14),
 		.name = "mx25v8035f",