[PATCH] mtd: spi-nor: core: Introduce spi_nor_abort_octal_dtr()

Michael Walle michael at walle.cc
Wed Dec 13 00:48:22 PST 2023


Hi,

>> To me it seems, that spi_nor_select_{read,pp,erase}() will select
>> the wrong commands/proto. So it should be fixed there. Probably
>> shared_mask is wrong.
> Features in shared_mask have include 2 parts as below.
> 1. Flash support the feature (by parse SFDP or ID table flags)
> 2. spi host controller support the feature (In 
> spi_nor_spimem_adjust_hwcaps)
> 
> But I think Octal DTR is a special case because, in addition to the 2 
> points
> mentioned above, there are also other conditions that need to be met.

Correct. And btw we would have the same problem for quad_enable if we 
wouldn't
have a default.

So in spi_nor_default_setup() I'd suggest to add something along

if (!nor->quad_enable)
   shared_mask &= ~SNOR_HWCAPS_4_4_4;

/* skip octal command mode if we don't have a .octal_enable callback */
if (!nor->octal_enable)
   shared_mask &= ~SNOR_HWCAPS_8_8_8;

#define SNOR_HWCAPS_4_4_4 (SNOR_HWCAPS_READ_4_4_4 | 
SNOR_HWCAPS_PP_4_4_4)

etc.


> My goal is to enable Octal DTR mode for Octal flashes listed in ID 
> table.
> For those not in ID table, choosing spi_nor_generic should allow 
> selecting
> either 1-1-8 protocol or, at the very least, 1-1-1 protocol.

That's understood.

-michael



More information about the linux-mtd mailing list