Re: [PATCH] mtd: spi-nor: spansion: add SPI_NOR_HAS_LOCK to s25fl064k

From: Miquel Raynal

Date: Thu Dec 03 2026 - 04:22:30 EST


On 03/12/2026 at 06:40:40 GMT, <Takahiro.Kuwano@xxxxxxxxxxxx> wrote:

> Hi,
>
>> The s25fl064k entry also matches the Winbond W25Q64, which has the same
>> ID. Both protect blocks with the BP0-2 and TB bits of the status
>> register. Commit 3b1fba74306b ("mtd: spi-nor: winbond: W25Q64JV-Q/N:
>> Fill locking information") set SPI_NOR_HAS_LOCK and SPI_NOR_HAS_TB on
>> the winbond w25q64 entry, but that entry is never used for this ID, as
>> the spansion table is searched first. Set both flags on the s25fl064k
>> entry too.
>
> Why don't we remove the redundant entry?
> We need to keep "s25fl064k" name as it is in spi_nor_dev_ids[].
>
>>
>> Without SPI_NOR_HAS_LOCK the block protection is never cleared, so on a
>> W25Q64 that ships fully protected, erases and writes silently fail.
>>
>> Signed-off-by: Naresh Solanki <naresh.solanki.2011@xxxxxxxxx>

Yes, that is true and I documented it in my previous series. I actually
commented out the Spansion part for the tests I conducted otherwise that
entry was indeed picked-up instead. I found no time to cover this
problem yet.

>> @@ -1065,6 +1065,7 @@ static const struct flash_info spansion_nor_parts[] = {
>> .id = SNOR_ID(0xef, 0x40, 0x17),
>> .name = "s25fl064k",
>> .size = SZ_8M,
>> + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
>
> Do we also need to add HAS_CMP and QUAD_PP?

I don't think the Spansion entry supports CMP. For Quad PP, it does not
matter much since the extra gain is small.

Thanks,
Miquèl