diff mbox series

[v2,2/5] spi: fsl_qspi: Build driver only if DM_SPI is available

Message ID 20210713091452.204680-3-frieder@fris.de
State Accepted
Commit 6b86554865ad271a71e93c125594335721b615c9
Delegated to: Stefano Babic
Headers show
Series [v2,1/5] mtd: spi-nor-ids: Add support for Macronix MX25V8035F and MX25R1635F | expand

Commit Message

Frieder Schrempf July 13, 2021, 9:14 a.m. UTC
From: Frieder Schrempf <frieder.schrempf@kontron.de>

The driver depends on DM_SPI and if it's not available (e. g. in SPL),
then we should not try to build it as this will fail.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 drivers/spi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Roese July 13, 2021, 12:44 p.m. UTC | #1
On 13.07.21 11:14, Frieder Schrempf wrote:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> The driver depends on DM_SPI and if it's not available (e. g. in SPL),
> then we should not try to build it as this will fail.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>

Looks good, but you could also add a "depends on DM_SPI" to the Kconfig
entry of this driver.

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/spi/Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index f70851e4bc..216e72c60f 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -11,6 +11,7 @@ obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
>   obj-$(CONFIG_SOFT_SPI) += soft_spi.o
>   obj-$(CONFIG_SPI_MEM) += spi-mem.o
>   obj-$(CONFIG_TI_QSPI) += ti_qspi.o
> +obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
>   else
>   obj-y += spi.o
>   obj-$(CONFIG_SPI_MEM) += spi-mem-nodm.o
> @@ -30,7 +31,6 @@ obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
>   obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
>   obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
>   obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
> -obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
>   obj-$(CONFIG_SYNQUACER_SPI) += spi-synquacer.o
>   obj-$(CONFIG_ICH_SPI) +=  ich.o
>   obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
> 


Viele Grüße,
Stefan
Jagan Teki July 14, 2021, 9:55 a.m. UTC | #2
On Tue, Jul 13, 2021 at 2:45 PM Frieder Schrempf <frieder@fris.de> wrote:
>
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> The driver depends on DM_SPI and if it's not available (e. g. in SPL),
> then we should not try to build it as this will fail.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>  drivers/spi/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index f70851e4bc..216e72c60f 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -11,6 +11,7 @@ obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
>  obj-$(CONFIG_SOFT_SPI) += soft_spi.o
>  obj-$(CONFIG_SPI_MEM) += spi-mem.o
>  obj-$(CONFIG_TI_QSPI) += ti_qspi.o
> +obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o

Why? driver entry in Kconfig already present in if DM_SPI construct
and it will build only if DM_SPI enabled.

Thanks,
Jagan.
Frieder Schrempf July 14, 2021, 10:32 a.m. UTC | #3
On 14.07.21 11:55, Jagan Teki wrote:
> On Tue, Jul 13, 2021 at 2:45 PM Frieder Schrempf <frieder@fris.de> wrote:
>>
>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>
>> The driver depends on DM_SPI and if it's not available (e. g. in SPL),
>> then we should not try to build it as this will fail.
>>
>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>> ---
>>  drivers/spi/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
>> index f70851e4bc..216e72c60f 100644
>> --- a/drivers/spi/Makefile
>> +++ b/drivers/spi/Makefile
>> @@ -11,6 +11,7 @@ obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
>>  obj-$(CONFIG_SOFT_SPI) += soft_spi.o
>>  obj-$(CONFIG_SPI_MEM) += spi-mem.o
>>  obj-$(CONFIG_TI_QSPI) += ti_qspi.o
>> +obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
> 
> Why? driver entry in Kconfig already present in if DM_SPI construct
> and it will build only if DM_SPI enabled.

In my case I have DM_SPI enabled for U-Boot proper and disabled for SPL. So CONFIG_DM_SPI is set but CONFIG_SPL_DM_SPI is not set. It seems like Kconfig only handles the dependency for DM_SPI not for SPL_DM_SPI. Without this patch the build fails as the driver is built for SPL.

If you have any suggestion for a better fix, let me know.

Thanks
Frieder
diff mbox series

Patch

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index f70851e4bc..216e72c60f 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -11,6 +11,7 @@  obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
 obj-$(CONFIG_TI_QSPI) += ti_qspi.o
+obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 else
 obj-y += spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem-nodm.o
@@ -30,7 +31,6 @@  obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
 obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
 obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
-obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 obj-$(CONFIG_SYNQUACER_SPI) += spi-synquacer.o
 obj-$(CONFIG_ICH_SPI) +=  ich.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o