diff mbox series

mtd: spi-nor: Guard SPI_STACKED_PARALLEL with DM_SPI check

Message ID 20241031183732.3602102-1-trini@konsulko.com
State Accepted
Commit e61ea9f2e5d2967826c2c6e3edba961064fbbaa1
Delegated to: Tom Rini
Headers show
Series mtd: spi-nor: Guard SPI_STACKED_PARALLEL with DM_SPI check | expand

Commit Message

Tom Rini Oct. 31, 2024, 6:37 p.m. UTC
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")
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 drivers/mtd/spi/spi-nor-core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini Oct. 31, 2024, 6:51 p.m. UTC | #1
On Thu, Oct 31, 2024 at 12:37:32PM -0600, Tom Rini wrote:
> 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")
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  drivers/mtd/spi/spi-nor-core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index a3a62fff213e..ec841fb13bd4 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -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);
>  

Whoops, forgot to CC Marek.
Marek Vasut Oct. 31, 2024, 7:13 p.m. UTC | #2
On 10/31/24 7:51 PM, Tom Rini wrote:
> On Thu, Oct 31, 2024 at 12:37:32PM -0600, Tom Rini wrote:
>> 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")
>> Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Tom Rini Oct. 31, 2024, 7:34 p.m. UTC | #3
On Thu, Oct 31, 2024 at 08:13:00PM +0100, Marek Vasut wrote:
> On 10/31/24 7:51 PM, Tom Rini wrote:
> > On Thu, Oct 31, 2024 at 12:37:32PM -0600, Tom Rini wrote:
> > > 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")
> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index a3a62fff213e..ec841fb13bd4 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -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);