mtd: spi: update spi-nor protected property for some flash types
PATCH 1/1 mtd: spi: update spi-nor protected property for some flash types
Add protected property for SPI flash mx25l4005a, mx25l3205d, mx25l6405d, and m25p32.
This will enable spi_nor_init() to unlock these SPI flash automatically.
---
--- drivers/mtd/spi/spi-nor-ids.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/spi/spi-nor-ids.c +4 -4
@@ -309,11 +309,11 @@ const struct flash_info spi_nor_ids[] = { #ifdef CONFIG_SPI_FLASH_MACRONIX /* MACRONIX */ /* Macronix */ { INFO("mx25l2005a", 0xc22012, 0, 64 * 1024, 4, SECT_4K) }, - { INFO("mx25l4005a", 0xc22013, 0, 64 * 1024, 8, SECT_4K) }, + { INFO("mx25l4005a", 0xc22013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) }, { INFO("mx25l8005", 0xc22014, 0, 64 * 1024, 16, 0) }, { INFO("mx25l1606e", 0xc22015, 0, 64 * 1024, 32, SECT_4K) }, - { INFO("mx25l3205d", 0xc22016, 0, 64 * 1024, 64, SECT_4K) }, - { INFO("mx25l6405d", 0xc22017, 0, 64 * 1024, 128, SECT_4K) }, + { INFO("mx25l3205d", 0xc22016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, + { INFO("mx25l6405d", 0xc22017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_LOCK) }, { INFO("mx25u2033e", 0xc22532, 0, 64 * 1024, 4, SECT_4K) }, { INFO("mx25u1635e", 0xc22535, 0, 64 * 1024, 32, SECT_4K) }, { INFO("mx25u3235f", 0xc22536, 0, 4 * 1024, 1024, SECT_4K) },
@@ -529,7 +529,7 @@ const struct flash_info spi_nor_ids[] = { { INFO("m25p40", 0x202013, 0, 64 * 1024, 8, 0) }, { INFO("m25p80", 0x202014, 0, 64 * 1024, 16, 0) }, { INFO("m25p16", 0x202015, 0, 64 * 1024, 32, 0) }, - { INFO("m25p32", 0x202016, 0, 64 * 1024, 64, 0) }, + { INFO("m25p32", 0x202016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, { INFO("m25p64", 0x202017, 0, 64 * 1024, 128, 0) }, { INFO("m25p128", 0x202018, 0, 256 * 1024, 64, 0) }, { INFO("m25pe16", 0x208015, 0, 64 * 1024, 32, SECT_4K) },
---
base-commit: a44f46af0aa17e48572e0d46c0d082886ee353c3
change-id: 20260914-spi_nor_protected-1c7a59ac0648
Best regards,
Signature · 1 line
Tony Dinh <[email protected]>
Hi,
Quoted 3 lines
Add protected property for SPI flash mx25l4005a, mx25l3205d, mx25l6405d, and m25p32.
This will enablespi_nor_init()to unlock these SPI flash automatically.
Please make sure the locking feature works properly with the HAS_LOCK flag enabled. The HAS_LOCK flag should not be added just to support startup unlocking.
Thanks,
Takahiro
Hi Takahiro,
Quoted 10 lines · On Tue, Sep 15, 2026 at 6:08 PM <[email protected]> wrote:
Hi,
Quoted 3 lines
Add protected property for SPI flash mx25l4005a, mx25l3205d, mx25l6405d, and m25p32.
This will enablespi_nor_init()to unlock these SPI flash automatically.Please make sure the locking feature works properly with the
HAS_LOCKflag enabled. TheHAS_LOCKflag should not be added just to support startup unlocking.
Of course you're right. My patch description should have mentioned the datasheets and the tests that I've done to verify the locking feature is working. I was about to send in a V2 patch, but realized that we have a related issue in the saveenv command. If the SPI flash is *locked*, the user can change envs and saveenv behaves like the flash was updated and saved, but in reality it was not saved. I think I will track that down before sending the V2 version of this patch.
Thanks,
Tony