diff mbox series

[v2,3/6] mtd: spi-nor: Check nor->info before setting macronix_octal_fixups

Message ID 8bd7edaaeefd69eb9bf2fa469ddbaeebd2433013.1714020303.git.Takahiro.Kuwano@infineon.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series mtd: Make sure UBIFS does not do multi-pass page programming on flashes that don't support it | expand

Commit Message

Takahiro Kuwano April 25, 2024, 4:52 a.m. UTC
From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>

The macronix_octal_fixups should be set only when mfr and flags match.

Fixes: df3d5f9e41 ("mtd: spi-nor: add support for Macronix Octal flash")
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Cc: JaimeLiao <jaimeliao.tw@gmail.com>
---
 drivers/mtd/spi/spi-nor-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tudor Ambarus April 25, 2024, 6:17 a.m. UTC | #1
On 4/25/24 05:52, tkuw584924@gmail.com wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
> 
> The macronix_octal_fixups should be set only when mfr and flags match.
> 
> Fixes: df3d5f9e41 ("mtd: spi-nor: add support for Macronix Octal flash")
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
> Cc: JaimeLiao <jaimeliao.tw@gmail.com>
> ---
>  drivers/mtd/spi/spi-nor-core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index 1bfef6797f..c2d2ddf0c8 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -4003,7 +4003,9 @@ void spi_nor_set_fixups(struct spi_nor *nor)
>  #endif
>  
>  #if CONFIG_IS_ENABLED(SPI_FLASH_MACRONIX)
> -	nor->fixups = &macronix_octal_fixups;
> +	if (JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX &&
> +	    nor->info->flags & SPI_NOR_OCTAL_DTR_READ)
> +		nor->fixups = &macronix_octal_fixups;

we still have the mfr checks in u-boot, sigh.

sounds sane:
Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
>  #endif /* SPI_FLASH_MACRONIX */
>  }
>
diff mbox series

Patch

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 1bfef6797f..c2d2ddf0c8 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -4003,7 +4003,9 @@  void spi_nor_set_fixups(struct spi_nor *nor)
 #endif
 
 #if CONFIG_IS_ENABLED(SPI_FLASH_MACRONIX)
-	nor->fixups = &macronix_octal_fixups;
+	if (JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX &&
+	    nor->info->flags & SPI_NOR_OCTAL_DTR_READ)
+		nor->fixups = &macronix_octal_fixups;
 #endif /* SPI_FLASH_MACRONIX */
 }