Re: [PATCH v4 2/2] mtd: spi-nor: micron-st: use SFDP table for mt25qu512a

From: Pratyush Yadav
Date: Tue Oct 17 2023 - 11:09:21 EST


On Tue, Oct 17 2023, Tudor Ambarus wrote:

> From: Mamta Shukla <mamta.shukla@xxxxxxxxxxxxxxxxxxxx>
>
[...]
> diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
> index 756391c906e5..8920547c12bf 100644
> --- a/drivers/mtd/spi-nor/micron-st.c
> +++ b/drivers/mtd/spi-nor/micron-st.c
> @@ -180,6 +180,18 @@ static const struct flash_info micron_nor_parts[] = {
> },
> };
>
> +static int mt25qu512a_post_bfpt_fixup(struct spi_nor *nor,
> + const struct sfdp_parameter_header *bfpt_header,
> + const struct sfdp_bfpt *bfpt)
> +{
> + nor->flags &= ~SNOR_F_HAS_16BIT_SR;
> + return 0;
> +}
> +
> +static struct spi_nor_fixups mt25qu512a_fixups = {
> + .post_bfpt = mt25qu512a_post_bfpt_fixup,
> +};
> +
> static const struct flash_info st_nor_parts[] = {
> {
> .name = "m25p05-nonjedec",
> @@ -407,10 +419,8 @@ static const struct flash_info st_nor_parts[] = {
> .name = "mt25qu512a",
> .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
> SPI_NOR_BP3_SR_BIT6,
> - .size = SZ_64M,
> - .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
> - .fixup_flags = SPI_NOR_4B_OPCODES,

Hmm, I have missed some recent developments in SPI NOR and I was
confused why you did not add a PARSE_SFDP flag. But now I understand
that you just need to drop the .size parameter and it will automatically
use SFDP. So LGTM.

Reviewed-by: Pratyush Yadav <pratyush@xxxxxxxxxx>

> .mfr_flags = USE_FSR,
> + .fixups = &mt25qu512a_fixups,
> }, {
> .id = SNOR_ID(0x20, 0xbb, 0x20),
> .name = "n25q512a",

--
Regards,
Pratyush Yadav