Skip to contentSkip to conversation

mtd: spi-nor: Guard SPI_STACKED_PARALLEL with DM_SPI check

PATCH In review Tom Rini 2 participants 4 messages Oct 31, 2024 Memory technology devices (MTD)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 mtd: spi-nor: Guard SPI_STACKED_PARALLEL with DM_SPI check

While we want to compile the SPI_STACKED_PARALLEL code everywhere we can, it must first be guarded with an #if for DM_SPI as not all cases where we have this code built, such as in SPL, will have the relevant DM_SPI option enabled.

Fixes 43423cdc5dc1 ("mtd: spi-nor: Always build SPI_STACKED_PARALLEL code")
---
 drivers/mtd/spi/spi-nor-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/spi/spi-nor-core.c +2 -0
index a3a62fff213e..ec841fb13bd4 100644
@@ -3166,6 +3166,7 @@ static int spi_nor_init_params(struct spi_nor *nor,
 		spi_nor_post_sfdp_fixups(nor, params);
 	}
 
+#if CONFIG_IS_ENABLED(DM_SPI)
 	if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) {
 		u64 flash_size[SNOR_FLASH_CNT_MAX] = { 0 };
 		struct udevice *dev = nor->spi->dev;
@@ -3227,6 +3228,7 @@ static int spi_nor_init_params(struct spi_nor *nor,
 			params->page_size <<= 1;
 		}
 	}
+#endif
 
 	spi_nor_late_init_fixups(nor, params);
 
Signature · 1 line
2.43.0
author
#1 lore raw
Quoted 24 lines · Tom Rini

While we want to compile the SPI_STACKED_PARALLEL code everywhere we can, it must first be guarded with an #if for DM_SPI as not all cases where we have this code built, such as in SPL, will have the relevant DM_SPI option enabled.

Fixes 43423cdc5dc1 ("mtd: spi-nor: Always build SPI_STACKED_PARALLEL code")
---
 drivers/mtd/spi/spi-nor-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/spi/spi-nor-core.c +1 -0
index a3a62fff213e..ec841fb13bd4 100644
@@ -3166,6 +3166,7 @@ static int spi_nor_init_params(struct spi_nor *nor,
 		spi_nor_post_sfdp_fixups(nor, params);
 	}
 
+#if CONFIG_IS_ENABLED(DM_SPI)
 	if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) {
 		u64 flash_size[SNOR_FLASH_CNT_MAX] = { 0 };
 		struct udevice *dev = nor->spi->dev;

drivers/mtd/spi/spi-nor-core.c static int spi_nor_init_params(struct spi_nor *nor, · line 3234

Quoted 7 lines
drivers/mtd/spi/spi-nor-core.c +1 -0
@@ -3227,6 +3228,7 @@ static int spi_nor_init_params(struct spi_nor *nor,
 			params->page_size <<= 1;
 		}
 	}
+#endif
 
 	spi_nor_late_init_fixups(nor, params);
 

Whoops, forgot to CC Marek.

Signature · 1 line
Tom
Reviewed-by
#2 lore raw
Quoted 8 lines · Tom Rini
Quoted 7 lines · Tom Rini

While we want to compile the SPI_STACKED_PARALLEL code everywhere we can, it must first be guarded with an #if for DM_SPI as not all cases where we have this code built, such as in SPL, will have the relevant DM_SPI option enabled.

Fixes 43423cdc5dc1 ("mtd: spi-nor: Always build SPI_STACKED_PARALLEL code")
author
#3 lore raw
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Tom Rini
Quoted 7 lines · Tom Rini

While we want to compile the SPI_STACKED_PARALLEL code everywhere we can, it must first be guarded with an #if for DM_SPI as not all cases where we have this code built, such as in SPL, will have the relevant DM_SPI option enabled.

Fixes 43423cdc5dc1 ("mtd: spi-nor: Always build SPI_STACKED_PARALLEL code")

Applied to u-boot/master, thanks!

Signature · 1 line
Tom