Skip to contentSkip to conversation

spi-nor: spi-nor-ids: Merge "n25q512a" and "mt25qu512a" entries

PATCH New Vignesh Raghavendra 4 participants 18 messages Sep 10, 2019 – Sep 25, 2019 Memory technology devices (MTD)

lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

PATCH 1/2 spi-nor: spi-nor-ids: Merge "n25q512a" and "mt25qu512a" entries

mt25qu512a is just a rebranded name for n25q512a. All the 6 bytes of JEDEC ID bytes are same for mt25qu512a and n25q512a.
Commit 8385520f2931 ("mtd: spi: Add flash property for Micron mt25qu512a") added new entry for mt25qu512a before n25q512a entry. So on older boards with n25q512a "sf probe" now shows flash name as mt25qu512a. This creates confusion with users who used to seeing n25q512a and are not aware of the fact that both flashes are the same. Therefore fix this by renaming name to "mt25qu512a (n25q512a)" so as to make it clear that flash detected may be either of them.

With that we can have single entry for n25q512a and mt25qu512a.

---
 drivers/mtd/spi/spi-nor-ids.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/spi/spi-nor-ids.c +1 -3
index a3920ba520e0..f32a6c7d464b 100644
@@ -163,9 +163,7 @@ const struct flash_info spi_nor_ids[] = {
 	{ INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K | SPI_NOR_QUAD_READ) },
 	{ INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
 	{ INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-	{ INFO6("mt25qu512a",  0x20bb20, 0x104400, 64 * 1024, 1024,
-		 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-	{ INFO("n25q512a",    0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+	{ INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
 	{ INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
 	{ INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
 	{ INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
Signature · 1 line
2.23.0
author maintainer
#1 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Not all variants of n25q256* and n25q512* support 4 Byte stateless addressing opcodes and there is no easy way to discover at runtime whether the flash supports this feature or not. Therefore don't set SPI_NOR_4B_OPCODES for these flashes.

For n25q512ax3:

---
 drivers/mtd/spi/spi-nor-ids.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/spi/spi-nor-ids.c +3 -3
index f32a6c7d464b..5a7fe07c8309 100644
@@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
 	{ INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K | SPI_NOR_QUAD_READ) },
 	{ INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K | SPI_NOR_QUAD_READ) },
 	{ INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K | SPI_NOR_QUAD_READ) },
-	{ INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+	{ INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
 	{ INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-	{ INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-	{ INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+	{ INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
+	{ INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
 	{ INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
 	{ INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
 	{ INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Vignesh Raghavendra <[email protected]> schrieb am Di., 10. Sep. 2019, 19:07:

Quoted 5 lines

Not all variants of n25q256* and n25q512* support 4 Byte stateless addressing opcodes and there is no easy way to discover at runtime whether the flash supports this feature or not. Therefore don't set SPI_NOR_4B_OPCODES for these flashes.

I have one of those that supports 4 Byte opposes and would be glad if I could use them. Is there any chance of flagging the devicetree or something that enables them?

Regards,
Simon

Quoted 46 lines

For n25q512ax3:

---
 drivers/mtd/spi/spi-nor-ids.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/spi/spi-nor-ids.c +1 -1
index f32a6c7d464b..5a7fe07c8309 100644
@@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
        { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
 SPI_NOR_QUAD_READ) },
        { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
 SPI_NOR_QUAD_READ) },
        { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
 SPI_NOR_QUAD_READ) },
-       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
        { INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K |

SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },

-       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024,
SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024,
SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
+       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
USE_FSR | SPI_NOR_QUAD_READ) },
        { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048, SECT_4K |
USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
        { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048, SECT_4K |
USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
        { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K |

USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
--
2.23.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

In reply to Vignesh Raghavendra
Quoted 13 lines

-----Original Message-----
From: Vignesh Raghavendra <[email protected]>
Sent: Tuesday, September 10, 2019 10:36 PM
To: Jagan Teki <[email protected]>
Cc: Vignesh Raghavendra <[email protected]>; u-boot at lists.denx.de; Tom Rini <[email protected]>; Eugeniy Paltsev <[email protected]>; Alexey.Brodkin at synopsys.com; Ashish Kumar <[email protected]>
Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Quoted 6 lines

Caution: EXT Email

Not all variants of n25q256* and n25q512* support 4 Byte stateless addressing opcodes and there is no easy way to discover at runtime whether the flash supports this feature or not.
Therefore don't set SPI_NOR_4B_OPCODES for these flashes.

Hi Vignesh,

I think it will be good to keep it here and disable this for boards by using not set flag in config Like
# SPI_NOR_4B_OPCODES is not set

Regards
Ashish

Quoted 40 lines
---
 drivers/mtd/spi/spi-nor-ids.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/spi/spi-nor-ids.c +1 -1
index f32a6c7d464b..5a7fe07c8309 100644
@@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
        { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
 SPI_NOR_QUAD_READ) },
        { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
 SPI_NOR_QUAD_READ) },
        { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
 SPI_NOR_QUAD_READ) },
-       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
        { INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K |

SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },

-       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024,
SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR |
SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024,
SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
+       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
+ USE_FSR | SPI_NOR_QUAD_READ) },
        { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR |
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
        { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR |
SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
        { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR |

SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
--
2.23.0

#4 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Ashish Kumar <[email protected]> schrieb am Mi., 11. Sep. 2019, 10:49:

Quoted 18 lines
Quoted 13 lines

-----Original Message-----
From: Vignesh Raghavendra <[email protected]>
Sent: Tuesday, September 10, 2019 10:36 PM
To: Jagan Teki <[email protected]>
Cc: Vignesh Raghavendra <[email protected]>; u-boot at lists.denx.de; Tom Rini <[email protected]>; Eugeniy Paltsev <[email protected]>; Alexey.Brodkin at synopsys.com; Ashish Kumar <[email protected]>
Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Quoted 4 lines

Caution: EXT Email

Not all variants of n25q256* and n25q512* support 4 Byte stateless addressing opcodes and there is no easy way to discover at runtime

whether

Quoted 9 lines
Quoted 2 lines

the flash supports this feature or not. Therefore don't set SPI_NOR_4B_OPCODES for these flashes.

Hi Vignesh,

I think it will be good to keep it here and disable this for boards by using not set flag in config
Like
# SPI_NOR_4B_OPCODES is not set

I'd prefer to take this patch, as this is what Linux does. I think it's better to have an opt-in option. That way, all chips work with the default settings (even if that means some chips don't use 4 baste opcodes even if they could).

Still, so we have such an op-in possibility to enable 4 byte opcodes on these chips?

Regards,
Simon

Quoted 53 lines

Regards
Ashish

Review

Quoted 8 lines
---
 drivers/mtd/spi/spi-nor-ids.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/mtd/spi/spi-nor-ids.c

Quoted 16 lines

index f32a6c7d464b..5a7fe07c8309 100644

drivers/mtd/spi/spi-nor-ids.c +1 -1
@@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
        { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
 SPI_NOR_QUAD_READ) },
        { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
 SPI_NOR_QUAD_READ) },
        { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
 SPI_NOR_QUAD_READ) },
-       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
+       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
 SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
        { INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K |

SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },

Quoted 3 lines
-       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024,
SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |

USE_FSR |

Quoted 6 lines

SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },

+       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024, 1024,
SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
+       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
+ USE_FSR | SPI_NOR_QUAD_READ) },
        { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048, SECT_4K |

USE_FSR |

Quoted 2 lines

SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },

        { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048, SECT_4K |

USE_FSR |

Quoted 2 lines

SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },

        { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096, SECT_4K |

USE_FSR |

Quoted 3 lines

SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
--
2.23.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author maintainer
#5 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi Ashish, Simon,

Quoted 31 lines · Simon Goldschmidt

Ashish Kumar <ashish.kumar at nxp.com <mailto:[email protected]>> schrieb am Mi., 11. Sep. 2019, 10:49:

Quoted 5 lines

-----Original Message-----
From: Vignesh Raghavendra <vigneshr at ti.com <mailto:[email protected]>>
Sent: Tuesday, September 10, 2019 10:36 PM
To: Jagan Teki <jagan at openedev.com <mailto:[email protected]>>
Cc: Vignesh Raghavendra <[email protected]

<mailto:[email protected]>>; u-boot at lists.denx.de <mailto:[email protected]>; Tom
> Rini <trini at konsulko.com <mailto:[email protected]>>; Eugeniy Paltsev > <[email protected] <mailto:[email protected]>>; Alexey.Brodkin at synopsys.com <mailto:[email protected]>; Ashish
> Kumar <ashish.kumar at nxp.com <mailto:[email protected]>> > Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable
> SPI_NOR_4B_OPCODES for n25q512* and n25q256*
>
> Caution: EXT Email
>
> Not all variants of n25q256* and n25q512* support 4 Byte stateless > addressing opcodes and there is no easy way to discover at runtime whether
> the flash supports this feature or not.
> Therefore don't set SPI_NOR_4B_OPCODES for these flashes.
Hi Vignesh,

Quoted 5 lines

I think it will be good to keep it here and disable this for boards by using not set flag in config
Like
# SPI_NOR_4B_OPCODES is not set

SPI_NOR_4B_OPCODES is not a config option. Are you suggesting to add one? config options don't scale well especially when same defconfig is used for multiple boards that potentially have different flashes

Quoted 2 lines

I'd prefer to take this patch, as this is what Linux does.

No, this is not what Linux does. There is no opt-in or opt-out option. Decision to use 4 byte opcode is done at runtime based on flash that's detected. Either based on info->flags for that part or by parsing SFDP table. There is no config option of DT option to force 4 byte addressing

Quoted 4 lines

I think it's better to have an opt-in option. That way, all chips work with the default settings (even if that means some chips don't use 4 baste opcodes even if they could).

One solution would be to look at SFDP tables of two variants of flash and see if there are any differences that can be used as a clue.

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have asked Eugeniy to provide dumps from his flash on the other thread. Lets see if something stands out.

Regards
Vignesh

Quoted 64 lines

Still, so we have such an op-in possibility to enable 4 byte opcodes on these chips?

Regards,
Simon

    Regards
    Ashish
    >
    > Signed-off-by: Vignesh Raghavendra <[email protected]
    <mailto:[email protected]>> For n25q512ax3:
    > Tested-by: Eugeniy Paltsev <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/mtd/spi/spi-nor-ids.c | 6 +++---
    >  1 file changed, 3 insertions(+), 3 deletions(-)
    >
    > diff --git a/drivers/mtd/spi/spi-nor-ids.c
    b/drivers/mtd/spi/spi-nor-ids.c
    > index f32a6c7d464b..5a7fe07c8309 100644
    > --- a/drivers/mtd/spi/spi-nor-ids.c
    > +++ b/drivers/mtd/spi/spi-nor-ids.c
    > @@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
    >         { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    > -       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > +       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
    >         { INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > -       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024,
    1024,
    > SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > -       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > +       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024,
    1024,
    > SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
    > +       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
    > + USE_FSR | SPI_NOR_QUAD_READ) },
    >         { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    > --
    > 2.23.0

    _______________________________________________
    U-Boot mailing list
    U-Boot at lists.denx.de <mailto:[email protected]>
    https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
Regards
Vignesh
#6 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Quoted 79 lines

-----Original Message-----
From: Vignesh Raghavendra <[email protected]>
Sent: Wednesday, September 11, 2019 3:37 PM
To: Simon Goldschmidt <[email protected]>; Ashish Kumar <[email protected]>
Cc: Jagan Teki <[email protected]>; u-boot at lists.denx.de; Alexey.Brodkin at synopsys.com; Eugeniy Paltsev <[email protected]>; Tom Rini <[email protected]>
Subject: Re: [U-Boot] [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Caution: EXT Email

Hi Ashish, Simon,

Quoted 9 lines · Simon Goldschmidt

Ashish Kumar <ashish.kumar at nxp.com <mailto:[email protected]>> schrieb am Mi., 11. Sep. 2019, 10:49:

Quoted 2 lines

-----Original Message-----
From: Vignesh Raghavendra <[email protected]

<mailto:[email protected]>>

Quoted 2 lines
Quoted 2 lines

Sent: Tuesday, September 10, 2019 10:36 PM
To: Jagan Teki <[email protected]

<mailto:[email protected]>>

Quoted 4 lines
Quoted 1 line
Cc Vignesh Raghavendra <[email protected]

<mailto:[email protected]>>; u-boot at lists.denx.de <mailto:[email protected]>; Tom
> Rini <trini at konsulko.com <mailto:[email protected]>>; Eugeniy

Paltsev

Quoted 2 lines
Quoted 1 line

<[email protected]

    <mailto:[email protected]>>;

Alexey.Brodkin at synopsys.com

Quoted 14 lines

<mailto:[email protected]>; Ashish
> Kumar <ashish.kumar at nxp.com <mailto:[email protected]>> > Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable > SPI_NOR_4B_OPCODES for n25q512* and n25q256*
>
> Caution: EXT Email
>
> Not all variants of n25q256* and n25q512* support 4 Byte stateless > addressing opcodes and there is no easy way to discover at runtime whether
> the flash supports this feature or not.
> Therefore don't set SPI_NOR_4B_OPCODES for these flashes. Hi Vignesh,

Quoted 5 lines

I think it will be good to keep it here and disable this for boards by using not set flag in config
Like
# SPI_NOR_4B_OPCODES is not set

SPI_NOR_4B_OPCODES is not a config option. Are you suggesting to add one? config options don't scale well especially when same defconfig is used for multiple boards that potentially have different flashes

Quoted 2 lines

I'd prefer to take this patch, as this is what Linux does.

No, this is not what Linux does. There is no opt-in or opt-out option. Decision to use 4 byte opcode is done at runtime based on flash that's detected. Either based on info->flags for that part or by parsing SFDP table. There is no config option of DT option to force 4 byte addressing

Quoted 4 lines

I think it's better to have an opt-in option. That way, all chips work with the default settings (even if that means some chips don't use 4 baste opcodes even if they could).

One solution would be to look at SFDP tables of two variants of flash and see if there are any differences that can be used as a clue.

Quoted 6 lines

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have asked Eugeniy to provide dumps from his flash on the other thread. Lets see if something stands out.

Hi Vignesh, Eugeniy,

Could you please provide me dump for n25q512a which consists of all 6 JEDEC id bytes. I had initiated mail chain with MICRON FAE, and they suggest that extended id may be different for n25q512a from mt25qu512a.

I have dumped JEDEC ID from mt25qu512a "20, bb, 20, 10, 44, 00" , the second last byte is supposed to be different as per FAE.

Bit 6
device
Generation
1 = 2nd
generation

Regards
Ashish

Quoted 84 lines

Regards
Vignesh

Quoted 24 lines

Still, so we have such an op-in possibility to enable 4 byte opcodes on these chips?

Regards,
Simon

    Regards
    Ashish
    >
    > Signed-off-by: Vignesh Raghavendra <[email protected]
    <mailto:[email protected]>> For n25q512ax3:
    > Tested-by: Eugeniy Paltsev <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/mtd/spi/spi-nor-ids.c | 6 +++---
    >  1 file changed, 3 insertions(+), 3 deletions(-)
    >
    > diff --git a/drivers/mtd/spi/spi-nor-ids.c
    b/drivers/mtd/spi/spi-nor-ids.c
    > index f32a6c7d464b..5a7fe07c8309 100644
    > --- a/drivers/mtd/spi/spi-nor-ids.c
    > +++ b/drivers/mtd/spi/spi-nor-ids.c
    > @@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
Quoted 8 lines
    >         { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    > -       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |

SPI_NOR_4B_OPCODES) },

Quoted 7 lines
Quoted 5 lines

+ { INFO("n25q256a", 0x20ba19, 0, 64 * 1024, 512, SECT_4K |
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { INFO("n25q256ax1", 0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
- { INFO("mt25qu512a (n25q512a)", 0x20bb20, 0, 64 * 1024,

1024,
> SECT_4K | USE_FSR | SPI_NOR_QUAD_READ |

SPI_NOR_4B_OPCODES) },

Quoted 24 lines
Quoted 1 line

- { INFO("n25q512ax3", 0x20ba20, 0, 64 * 1024, 1024,

    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > +       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024,
    1024,
    > SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
    > +       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
    > + USE_FSR | SPI_NOR_QUAD_READ) },
    >         { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    > --
    > 2.23.0

    _______________________________________________
    U-Boot mailing list
    U-Boot at lists.denx.de <mailto:[email protected]>
Quoted 2 lines

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.denx.de%2Flistinfo%2Fu-

boot&amp;data=02%7C01%7Cashish.kumar%40nxp.co

Quoted 1 line

m%7C5531cc6a339141ded6cc08d7369fbe9d%7C686ea1d3bc2b4c6fa92cd99c5c 30163

Quoted 1 line

5%7C0%7C0%7C637037932040085697&amp;sdata=1%2BbqG6OBWOLedplM1 19W7E%2Bgp

Quoted 2 lines

XlN1wasXZR3AJgzYaM%3D&amp;reserved=0

--
Regards
Vignesh

author maintainer
#7 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi Ashish,

Quoted 1 line · Ashish Kumar

[...]

Quoted 7 lines
Quoted 1 line

Lets see if something stands out.

Hi Vignesh, Eugeniy,

Could you please provide me dump for n25q512a which consists of all 6 JEDEC id bytes. I had initiated mail chain with MICRON FAE, and they suggest that extended id may be different for n25q512a from mt25qu512a.

Quoted 8 lines

I have dumped JEDEC ID from mt25qu512a "20, bb, 20, 10, 44, 00" , the second last byte is supposed to be different as per FAE.

Bit 6
device
Generation
1 = 2nd
generation

Thats great! Thanks for getting that information!

From Eugeniy's debug dumps in other mail chain, I see JEDEC ID of that flash is:
" 20 ba 20 10 00 00" (does not support 4 byte addressing opcodes)

So these variants can be differentiated quite easily. I will send out a series fixing those entries.

Regards
Vignesh

Quoted 86 lines

Regards
Ashish

Quoted 84 lines

Regards
Vignesh

Quoted 24 lines

Still, so we have such an op-in possibility to enable 4 byte opcodes on these chips?

Regards,
Simon

    Regards
    Ashish
    >
    > Signed-off-by: Vignesh Raghavendra <[email protected]
    <mailto:[email protected]>> For n25q512ax3:
    > Tested-by: Eugeniy Paltsev <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/mtd/spi/spi-nor-ids.c | 6 +++---
    >  1 file changed, 3 insertions(+), 3 deletions(-)
    >
    > diff --git a/drivers/mtd/spi/spi-nor-ids.c
    b/drivers/mtd/spi/spi-nor-ids.c
    > index f32a6c7d464b..5a7fe07c8309 100644
    > --- a/drivers/mtd/spi/spi-nor-ids.c
    > +++ b/drivers/mtd/spi/spi-nor-ids.c
    > @@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
Quoted 8 lines
    >         { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    > -       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |

SPI_NOR_4B_OPCODES) },

Quoted 7 lines
Quoted 5 lines

+ { INFO("n25q256a", 0x20ba19, 0, 64 * 1024, 512, SECT_4K |
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { INFO("n25q256ax1", 0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
- { INFO("mt25qu512a (n25q512a)", 0x20bb20, 0, 64 * 1024,

1024,
> SECT_4K | USE_FSR | SPI_NOR_QUAD_READ |

SPI_NOR_4B_OPCODES) },

Quoted 24 lines
Quoted 1 line

- { INFO("n25q512ax3", 0x20ba20, 0, 64 * 1024, 1024,

    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > +       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024,
    1024,
    > SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
    > +       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
    > + USE_FSR | SPI_NOR_QUAD_READ) },
    >         { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    > --
    > 2.23.0

    _______________________________________________
    U-Boot mailing list
    U-Boot at lists.denx.de <mailto:[email protected]>
Quoted 2 lines

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.denx.de%2Flistinfo%2Fu-

boot&amp;data=02%7C01%7Cashish.kumar%40nxp.co

Quoted 1 line

m%7C5531cc6a339141ded6cc08d7369fbe9d%7C686ea1d3bc2b4c6fa92cd99c5c 30163

Quoted 1 line

5%7C0%7C0%7C637037932040085697&amp;sdata=1%2BbqG6OBWOLedplM1 19W7E%2Bgp

Quoted 2 lines

XlN1wasXZR3AJgzYaM%3D&amp;reserved=0

--
Regards
Vignesh

Signature · 2 lines
Regards
Vignesh
#8 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

In reply to Vignesh Raghavendra
Quoted 58 lines · Vignesh Raghavendra

Hi Ashish, Simon,

Quoted 31 lines · Simon Goldschmidt

Ashish Kumar <ashish.kumar at nxp.com <mailto:[email protected]>> schrieb am Mi., 11. Sep. 2019, 10:49:

Quoted 5 lines

-----Original Message-----
From: Vignesh Raghavendra <vigneshr at ti.com <mailto:[email protected]>>
Sent: Tuesday, September 10, 2019 10:36 PM
To: Jagan Teki <jagan at openedev.com <mailto:[email protected]>>
Cc: Vignesh Raghavendra <[email protected]

<mailto:[email protected]>>; u-boot at lists.denx.de <mailto:[email protected]>; Tom
> Rini <trini at konsulko.com <mailto:[email protected]>>; Eugeniy Paltsev > <[email protected] <mailto:[email protected]>>; Alexey.Brodkin at synopsys.com <mailto:[email protected]>; Ashish
> Kumar <ashish.kumar at nxp.com <mailto:[email protected]>> > Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable
> SPI_NOR_4B_OPCODES for n25q512* and n25q256*
>
> Caution: EXT Email
>
> Not all variants of n25q256* and n25q512* support 4 Byte stateless > addressing opcodes and there is no easy way to discover at runtime whether
> the flash supports this feature or not.
> Therefore don't set SPI_NOR_4B_OPCODES for these flashes.
Hi Vignesh,

Quoted 5 lines

I think it will be good to keep it here and disable this for boards by using not set flag in config
Like
# SPI_NOR_4B_OPCODES is not set

SPI_NOR_4B_OPCODES is not a config option. Are you suggesting to add one? config options don't scale well especially when same defconfig is used for multiple boards that potentially have different flashes

Quoted 2 lines

I'd prefer to take this patch, as this is what Linux does.

No, this is not what Linux does. There is no opt-in or opt-out option. Decision to use 4 byte opcode is done at runtime based on flash that's detected. Either based on info->flags for that part or by parsing SFDP table. There is no config option of DT option to force 4 byte addressing

Quoted 4 lines

I think it's better to have an opt-in option. That way, all chips work with the default settings (even if that means some chips don't use 4 baste opcodes even if they could).

Quoted 6 lines

One solution would be to look at SFDP tables of two variants of flash and see if there are any differences that can be used as a clue.

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have a n251256a with JEDEC ID 20, ba, 19, 10, 44, 00. According to the docs, it should support 4-byte opcodes.

How would I dump the SFDP tables?

Regards,
Simon

Quoted 75 lines

I have asked Eugeniy to provide dumps from his flash on the other thread. Lets see if something stands out.

Regards
Vignesh

Quoted 55 lines

Still, so we have such an op-in possibility to enable 4 byte opcodes on these chips?

Regards,
Simon

    Regards
    Ashish
    >
    > Signed-off-by: Vignesh Raghavendra <[email protected]
    <mailto:[email protected]>> For n25q512ax3:
    > Tested-by: Eugeniy Paltsev <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/mtd/spi/spi-nor-ids.c | 6 +++---
    >  1 file changed, 3 insertions(+), 3 deletions(-)
    >
    > diff --git a/drivers/mtd/spi/spi-nor-ids.c
    b/drivers/mtd/spi/spi-nor-ids.c
    > index f32a6c7d464b..5a7fe07c8309 100644
    > --- a/drivers/mtd/spi/spi-nor-ids.c
    > +++ b/drivers/mtd/spi/spi-nor-ids.c
    > @@ -161,10 +161,10 @@ const struct flash_info spi_nor_ids[] = {
    >         { INFO("n25q064a",    0x20bb17, 0, 64 * 1024,  128, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a11",  0x20bb18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    >         { INFO("n25q128a13",  0x20ba18, 0, 64 * 1024,  256, SECT_4K |
    > SPI_NOR_QUAD_READ) },
    > -       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > +       { INFO("n25q256a",    0x20ba19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
    >         { INFO("n25q256ax1",  0x20bb19, 0, 64 * 1024,  512, SECT_4K |
    > SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > -       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024,
    1024,
    > SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > -       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
    > +       { INFO("mt25qu512a (n25q512a)",    0x20bb20, 0, 64 * 1024,
    1024,
    > SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
    > +       { INFO("n25q512ax3",  0x20ba20, 0, 64 * 1024, 1024, SECT_4K |
    > + USE_FSR | SPI_NOR_QUAD_READ) },
    >         { INFO("n25q00",      0x20ba21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("n25q00a",     0x20bb21, 0, 64 * 1024, 2048,
    SECT_4K | USE_FSR |
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    >         { INFO("mt25qu02g",   0x20bb22, 0, 64 * 1024, 4096,
    SECT_4K | USE_FSR |
Quoted 9 lines
    > SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
    > --
    > 2.23.0

    _______________________________________________
    U-Boot mailing list
    U-Boot at lists.denx.de <mailto:[email protected]>
    https://lists.denx.de/listinfo/u-boot

--
Regards
Vignesh

#9 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi, Simon,

Quoted 1 line · Simon Goldschmidt

How would I dump the SFDP tables?

this should do it. Make sure SPI_FLASH_SFDP_SUPPORT is selected in menuconfig.

Cheers,
ta

drivers/mtd/spi/spi-nor-core.c +4 -0
index 1acff745d1a2..7062f31226bf 100644
@@ -1680,6 +1680,10 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
        for (i = 0; i < BFPT_DWORD_MAX; i++)
                bfpt.dwords[i] = le32_to_cpu(bfpt.dwords[i]);
 
+       for (i = 0; i < BFPT_DWORD_MAX; i++)
+               dev_err(nor->dev, "bfpt.dwords[%d] = %08x\n", i,
+                       bfpt.dwords[i]);
+
#10 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi ,

Quoted 16 lines · On Mon, Sep 23, 2019 at 11:38 AM <[email protected]> wrote:

Hi, Simon,

Quoted 1 line · Simon Goldschmidt

How would I dump the SFDP tables?

this should do it. Make sure SPI_FLASH_SFDP_SUPPORT is selected in menuconfig.

Cheers,
ta

drivers/mtd/spi/spi-nor-core.c +0 -0
index 1acff745d1a2..7062f31226bf 100644

drivers/mtd/spi/spi-nor-core.c static int spi_nor_parse_bfpt(struct spi_nor *nor, · line 1686

Quoted 7 lines
drivers/mtd/spi/spi-nor-core.c +4 -0
@@ -1680,6 +1680,10 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
        for (i = 0; i < BFPT_DWORD_MAX; i++)
                bfpt.dwords[i] = le32_to_cpu(bfpt.dwords[i]);
 
+       for (i = 0; i < BFPT_DWORD_MAX; i++)
+               dev_err(nor->dev, "bfpt.dwords[%d] = %08x\n", i,
+                       bfpt.dwords[i]);
+

Unfortunately, that didn't work. It exits early when parsing the signature:
I get 0xffdddfdf instead of 0x50444653...

Regards,
Simon

#11 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi,

Quoted 23 lines · Simon Goldschmidt

Hi ,

Quoted 19 lines · On Mon, Sep 23, 2019 at 11:38 AM <[email protected]> wrote:

Hi, Simon,

Quoted 1 line · Simon Goldschmidt

How would I dump the SFDP tables?

this should do it. Make sure SPI_FLASH_SFDP_SUPPORT is selected in menuconfig.

Cheers,
ta

drivers/mtd/spi/spi-nor-core.c +0 -0
index 1acff745d1a2..7062f31226bf 100644
@@ -1680,6 +1680,10 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
        for (i = 0; i < BFPT_DWORD_MAX; i++)
                bfpt.dwords[i] = le32_to_cpu(bfpt.dwords[i]);
 
Quoted 7 lines

drivers/mtd/spi/spi-nor-core.c static int spi_nor_parse_bfpt(struct spi_nor *nor, · line 1686

Quoted 4 lines
drivers/mtd/spi/spi-nor-core.c +4 -0
+       for (i = 0; i < BFPT_DWORD_MAX; i++)
+               dev_err(nor->dev, "bfpt.dwords[%d] = %08x\n", i,
+                       bfpt.dwords[i]);
+

Unfortunately, that didn't work. It exits early when parsing the signature:
I get 0xffdddfdf instead of 0x50444653...

OK, so after setting cadence qspi driver back to 'spi-rx-bus-width = <1>' (thanks Vignesh), here's the ID and SFDP dump for my n25q256a:

JEDEC id bytes: 20, ba, 19, 10, 44, 00

bfpt.dwords[0] = fffb20e5
bfpt.dwords[1] = 0fffffff
bfpt.dwords[2] = 6b27eb29
bfpt.dwords[3] = bb273b27
bfpt.dwords[4] = ffffffff
bfpt.dwords[5] = bb27ffff
bfpt.dwords[6] = eb29ffff
bfpt.dwords[7] = d810200c
bfpt.dwords[8] = 0000520f
bfpt.dwords[9] = 00994a24
bfpt.dwords[10] = d4038e8b
bfpt.dwords[11] = 382701ac
bfpt.dwords[12] = 757a757a
bfpt.dwords[13] = 5cd5bdfb
bfpt.dwords[14] = ff820f4a
bfpt.dwords[15] = 363dbd81

Regards,
Simon

#12 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

In reply to Simon Goldschmidt

Hi, Simon,

On 09/23/2019 12:30 PM, Simon Goldschmidt wrote:

cut

Quoted 35 lines
Quoted 35 lines
Quoted 12 lines
Quoted 7 lines

Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Caution: EXT Email

Not all variants of n25q256* and n25q512* support 4 Byte stateless addressing opcodes and there is no easy way to discover at runtime

whether
> the flash supports this feature or not.
> Therefore don't set SPI_NOR_4B_OPCODES for these flashes. Hi Vignesh,

Quoted 5 lines

I think it will be good to keep it here and disable this for boards by using not set flag in config
Like
# SPI_NOR_4B_OPCODES is not set

SPI_NOR_4B_OPCODES is not a config option. Are you suggesting to add one? config options don't scale well especially when same defconfig is used for multiple boards that potentially have different flashes

Quoted 2 lines

I'd prefer to take this patch, as this is what Linux does.

No, this is not what Linux does. There is no opt-in or opt-out option. Decision to use 4 byte opcode is done at runtime based on flash that's detected. Either based on info->flags for that part or by parsing SFDP table. There is no config option of DT option to force 4 byte addressing

Quoted 4 lines

I think it's better to have an opt-in option. That way, all chips work with the default settings (even if that means some chips don't use 4 baste opcodes even if they could).

Quoted 8 lines
Quoted 6 lines

One solution would be to look at SFDP tables of two variants of flash and see if there are any differences that can be used as a clue.

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have a n251256a with JEDEC ID 20, ba, 19, 10, 44, 00.

Is this a n25q256a or a MT25QL256ABA? We want to check if there are n25q256a flashes that have the 6th bit of the Extended Device Id set to one or not. According to n25q256a datasheet the bit 6 is reserved (which probably translates to being zero), while on MT25QL256ABA is set to one.

Cheers,
ta

#13 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi Tudor,

Quoted 49 lines · On Tue, Sep 24, 2019 at 1:36 PM <[email protected]> wrote:

Hi, Simon,

On 09/23/2019 12:30 PM, Simon Goldschmidt wrote:

cut

Quoted 42 lines
Quoted 41 lines
Quoted 12 lines
Quoted 7 lines

Subject: [EXT] [PATCH 2/2] spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Caution: EXT Email

Not all variants of n25q256* and n25q512* support 4 Byte stateless addressing opcodes and there is no easy way to discover at runtime

whether
> the flash supports this feature or not.
> Therefore don't set SPI_NOR_4B_OPCODES for these flashes. Hi Vignesh,

Quoted 5 lines

I think it will be good to keep it here and disable this for boards by using not set flag in config
Like
# SPI_NOR_4B_OPCODES is not set

SPI_NOR_4B_OPCODES is not a config option. Are you suggesting to add one? config options don't scale well especially when same defconfig is used for multiple boards that potentially have different flashes

Quoted 2 lines

I'd prefer to take this patch, as this is what Linux does.

No, this is not what Linux does. There is no opt-in or opt-out option. Decision to use 4 byte opcode is done at runtime based on flash that's detected. Either based on info->flags for that part or by parsing SFDP table. There is no config option of DT option to force 4 byte addressing

Quoted 4 lines

I think it's better to have an opt-in option. That way, all chips work with the default settings (even if that means some chips don't use 4 baste opcodes even if they could).

One solution would be to look at SFDP tables of two variants of flash and see if there are any differences that can be used as a clue.

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

Quoted 6 lines
Quoted 1 line

I have a n251256a with JEDEC ID 20, ba, 19, 10, 44, 00.

Is this a n25q256a or a MT25QL256ABA? We want to check if there are n25q256a flashes that have the 6th bit of the Extended Device Id set to one or not. According to n25q256a datasheet the bit 6 is reserved (which probably translates to being zero), while on MT25QL256ABA is set to one.

Right, this really is a MT25QL256ABA, I guess. I'm not quite familiar with the print on the housing, sorry. We had both and here, it's probably the MT, not the nq.

I also wasn't really aware of the differences between those two, sorry.

Regards,
Simon

Quoted 4 lines

Cheers,
ta

author maintainer
#14 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Simon,

Quoted 4 lines · Simon Goldschmidt

Hi Tudor,

Quoted 1 line · On Tue, Sep 24, 2019 at 1:36 PM <[email protected]> wrote:

[...]

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have a n251256a with JEDEC ID 20, ba, 19, 10, 44, 00.

Quoted 9 lines
Quoted 4 lines

Is this a n25q256a or a MT25QL256ABA? We want to check if there are n25q256a flashes that have the 6th bit of the Extended Device Id set to one or not. According to n25q256a datasheet the bit 6 is reserved (which probably translates to being zero), while on MT25QL256ABA is set to one.

Right, this really is a MT25QL256ABA, I guess. I'm not quite familiar with the print on the housing, sorry. We had both and here, it's probably the MT, not the nq.

But, do you have access to n25q variants? And does that support 4 Byte addressing opcode? What does its JEDEC ID read?

Quoted 9 lines

I also wasn't really aware of the differences between those two, sorry.

Regards,
Simon

Quoted 4 lines

Cheers,
ta

#15 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi Vignesh,

Quoted 22 lines · Vignesh Raghavendra

Simon,

Quoted 4 lines · Simon Goldschmidt

Hi Tudor,

Quoted 1 line · On Tue, Sep 24, 2019 at 1:36 PM <[email protected]> wrote:

[...]

Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have a n251256a with JEDEC ID 20, ba, 19, 10, 44, 00.

Is this a n25q256a or a MT25QL256ABA? We want to check if there are n25q256a flashes that have the 6th bit of the Extended Device Id set to one or not. According to n25q256a datasheet the bit 6 is reserved (which probably translates to being zero), while on MT25QL256ABA is set to one.

Quoted 7 lines
Quoted 4 lines

Right, this really is a MT25QL256ABA, I guess. I'm not quite familiar with the print on the housing, sorry. We had both and here, it's probably the MT, not the nq.

But, do you have access to n25q variants? And does that support 4 Byte addressing opcode? What does its JEDEC ID read?

No, at the moment I don't. I'll see if I can get hold of one.

Regards,
Simon

Quoted 10 lines
Quoted 10 lines

I also wasn't really aware of the differences between those two, sorry.

Regards,
Simon

Quoted 4 lines

Cheers,
ta

#16 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Quoted 31 lines · Simon Goldschmidt

Hi Vignesh,

Quoted 27 lines · Vignesh Raghavendra

Simon,

Quoted 4 lines · Simon Goldschmidt

Hi Tudor,

Quoted 1 line · On Tue, Sep 24, 2019 at 1:36 PM <[email protected]> wrote:

[...]

Quoted 16 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

Simon,
Could you provide dump of SFDP tables and all the 6 bytes READ ID of the flash that you have?

I have a n251256a with JEDEC ID 20, ba, 19, 10, 44, 00.

Is this a n25q256a or a MT25QL256ABA? We want to check if there are n25q256a flashes that have the 6th bit of the Extended Device Id set to one or not. According to n25q256a datasheet the bit 6 is reserved (which probably translates to being zero), while on MT25QL256ABA is set to one.

Right, this really is a MT25QL256ABA, I guess. I'm not quite familiar with the print on the housing, sorry. We had both and here, it's probably the MT, not the nq.

Quoted 4 lines
Quoted 2 lines

But, do you have access to n25q variants? And does that support 4 Byte addressing opcode? What does its JEDEC ID read?

No, at the moment I don't. I'll see if I can get hold of one.

Ok, so I found a board with an n25q256a and tested that as well as the Altera/Intel EPCQ256N (on socfpga_socrateds) and both read the same ID and SFDP:

JEDEC id bytes: 20, ba, 19, 10, 00, 00
bfpt.dwords[0] = fffb20e5
bfpt.dwords[1] = 0fffffff
bfpt.dwords[2] = 6b27eb29
bfpt.dwords[3] = bb273b08
bfpt.dwords[4] = ffffffff
bfpt.dwords[5] = bb27ffff
bfpt.dwords[6] = eb29ffff
bfpt.dwords[7] = d810200c
bfpt.dwords[8] = 00000000
bfpt.dwords[9] = 00000000
bfpt.dwords[10] = 00000000
bfpt.dwords[11] = 00000000
bfpt.dwords[12] = 00000000
bfpt.dwords[13] = 00000000
bfpt.dwords[14] = 00000000
bfpt.dwords[15] = 00000000
SF: Detected n25q256a with page size 256 Bytes, erase size 64 KiB, total 32 MiB

I don't know whether one of these supports 4 byte opcodes, but I guess it's safe to say the 5th byte 0x44 is an mt25 which supports 4 byte opcodes.

Do you plan to port this series to Linux, too?

Regards,
Simon

Quoted 14 lines

Regards,
Simon

Quoted 10 lines
Quoted 10 lines

I also wasn't really aware of the differences between those two, sorry.

Regards,
Simon

Quoted 4 lines

Cheers,
ta

author maintainer
#17 lore raw

PATCH 2/2 spi-nor: spi-nor-ids: Disable SPI_NOR_4B_OPCODES for n25q512* and n25q256*

Hi,

Quoted 3 lines · Simon Goldschmidt
Quoted 1 line · Simon Goldschmidt

[...]

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines

But, do you have access to n25q variants? And does that support 4 Byte addressing opcode? What does its JEDEC ID read?

No, at the moment I don't. I'll see if I can get hold of one.

Ok, so I found a board with an n25q256a and tested that as well as the Altera/Intel EPCQ256N (on socfpga_socrateds) and both read the same ID and SFDP:

JEDEC id bytes: 20, ba, 19, 10, 00, 00
bfpt.dwords[0] = fffb20e5
bfpt.dwords[1] = 0fffffff
bfpt.dwords[2] = 6b27eb29
bfpt.dwords[3] = bb273b08
bfpt.dwords[4] = ffffffff
bfpt.dwords[5] = bb27ffff
bfpt.dwords[6] = eb29ffff
bfpt.dwords[7] = d810200c
bfpt.dwords[8] = 00000000

Quoted 9 lines

bfpt.dwords[9] = 00000000
bfpt.dwords[10] = 00000000
bfpt.dwords[11] = 00000000
bfpt.dwords[12] = 00000000
bfpt.dwords[13] = 00000000
bfpt.dwords[14] = 00000000
bfpt.dwords[15] = 00000000
SF: Detected n25q256a with page size 256 Bytes, erase size 64 KiB, total 32 MiB

Thanks for the logs!

Quoted 3 lines

I don't know whether one of these supports 4 byte opcodes, but I guess it's safe to say the 5th byte 0x44 is an mt25 which supports 4 byte opcodes.

There is a way to test if flash supports 4 byte addressing opcodes:

With plain U-Boot master (without any of my patches) that has SPI_NOR_4B_OPCODES set for n25q256a try following:

	sf erase 0x0 0x10000 /* erase one sector at 0x0 */
	sf erase 0x1000000 0x1000 /* erase one sector at 16M */
	sf write <address of random data>  0x1000000 0x100 /* write a page of data at 16M */
	sf read addr1  0x1000000 0x100 /* read back */
	md.b addr1

In case flash does not understand 4 byte addressing opcode, its possible that data written to flash may wrap and be written to 0x0-0x10000. So readback and see if 0x0 is still all 0xffs:

	sf read addr1  0x0 0x100
	md.b addr1

So if first md.b shows valid data and second md.b shows all 0xffs then flash supports 4 byte addressing opcode

Regards
Vignesh

Quoted 19 lines

Do you plan to port this series to Linux, too?

Regards,
Simon

Quoted 14 lines

Regards,
Simon

Quoted 10 lines
Quoted 10 lines

I also wasn't really aware of the differences between those two, sorry.

Regards,
Simon

Quoted 4 lines

Cheers,
ta

Signature · 2 lines
Regards
Vignesh