Re: [PATCH V1 1/1] linux: drivers: mtd: spi-nor: gigadevice.c

From: Tudor Ambarus
Date: Fri Jul 21 2023 - 03:39:10 EST




On 21.07.2023 09:51, Vlim wrote:
> Thanks, Tudor,
>

you're welcome

> Is PARSE_SFDP the command to read the SFDP parameters?

it's a flag, not a command, that when set at probe time the SFDP will be
read.

> It looks to me that the examples below are both using SFDP. But I do not
> see the flag that saying SFDP is used.

not quite

>
> { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256)
>             FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)

The locking support is not part of the JEDEC SFDP standard, but vendors
can define their own SFDP tables where they describe the locking
support. So for now, if you want to enable locking you have to specify
the locking flags, whatever they are. There are different flavors of
block protection locking, with 3 or 4 block protection bits, their
order, etc. You'll have to check the datasheet.

>             NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
>                         SPI_NOR_QUAD_READ) },

If the flash supports SFDP then the flags from above should be replaced
with PARSE_SFDP.

We have some requirements when one updates or adds new flash entries.
They have to dump the sysfs data, including the SFDP tables, and do some
sanity check with mtd_utils. Check the following cover letter to find
out how to do it:
https://lore.kernel.org/linux-mtd/cover.1686557139.git.Takahiro.Kuwano@xxxxxxxxxxxx/

>       { "gd25q256", INFO(0xc84019, 0, 64 * 1024, 512)
>             PARSE_SFDP
>             FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6)
>             FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
>             .fixups = &gd25q256_fixups },

these are all different types of flags. Use git blame to find the reason
why some were set.

Cheers,
ta