[U-Boot] [PATCH] treewide: Replace CONFIG_DM_SPI_FLASH with CONFIG_IS_ENABLED(DM_SPI_FLASH)

Schrempf Frieder frieder.schrempf at kontron.de
Wed Feb 20 11:18:37 UTC 2019


On 19.02.19 06:07, Marek Vasut wrote:
> Perform the replacement to allow platforms use non-DM SPI flash access
> in SPL/TPL. This is thus far needed on platforms with size constraints.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> Cc: Jagan Teki <jagan at openedev.com>
> Cc: Vignesh R <vigneshr at ti.com>

I stumbled upon this issue when trying to build a non-DM SPL for imx 
with SPI flash access. This fixes the build.

Reviewed-by: Frieder Schrempf <frieder.schrempf at kontron.de>
Tested-by: Frieder Schrempf <frieder.schrempf at kontron.de>

> ---
>   cmd/sf.c                   | 4 ++--
>   drivers/mtd/spi/sf_probe.c | 2 +-
>   drivers/net/fm/fm.c        | 4 ++--
>   env/sf.c                   | 2 +-
>   include/spi_flash.h        | 2 +-
>   5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/cmd/sf.c b/cmd/sf.c
> index 738ef0e46d..7e92a43b2c 100644
> --- a/cmd/sf.c
> +++ b/cmd/sf.c
> @@ -84,7 +84,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
>   	unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
>   	unsigned int mode = CONFIG_SF_DEFAULT_MODE;
>   	char *endp;
> -#ifdef CONFIG_DM_SPI_FLASH
> +#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   	struct udevice *new, *bus_dev;
>   	int ret;
>   	/* In DM mode defaults will be taken from DT */
> @@ -119,7 +119,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
>   			return -1;
>   	}
>   
> -#ifdef CONFIG_DM_SPI_FLASH
> +#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   	/* Remove the old device, otherwise probe will just be a nop */
>   	ret = spi_find_bus_and_cs(bus, cs, &bus_dev, &new);
>   	if (!ret) {
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 7f1378f494..4282d48f26 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -53,7 +53,7 @@ err_read_id:
>   	return ret;
>   }
>   
> -#ifndef CONFIG_DM_SPI_FLASH
> +#if !CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
>   				  unsigned int max_hz, unsigned int spi_mode)
>   {
> diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
> index e19d7777dc..6a5c9bbc9d 100644
> --- a/drivers/net/fm/fm.c
> +++ b/drivers/net/fm/fm.c
> @@ -377,7 +377,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
>   		addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
>   		int ret = 0;
>   
> -#ifdef CONFIG_DM_SPI_FLASH
> +#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   		struct udevice *new;
>   
>   		/* speed and mode will be read from DT */
> @@ -464,7 +464,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
>   	void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
>   	int ret = 0;
>   
> -#ifdef CONFIG_DM_SPI_FLASH
> +#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   	struct udevice *new;
>   
>   	/* speed and mode will be read from DT */
> diff --git a/env/sf.c b/env/sf.c
> index b3dec82c35..ee639b90fc 100644
> --- a/env/sf.c
> +++ b/env/sf.c
> @@ -52,7 +52,7 @@ static struct spi_flash *env_flash;
>   
>   static int setup_flash_device(void)
>   {
> -#ifdef CONFIG_DM_SPI_FLASH
> +#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   	struct udevice *new;
>   	int	ret;
>   
> diff --git a/include/spi_flash.h b/include/spi_flash.h
> index 7f691e8559..09f3896fb9 100644
> --- a/include/spi_flash.h
> +++ b/include/spi_flash.h
> @@ -51,7 +51,7 @@ struct dm_spi_flash_ops {
>   /* Access the serial operations for a device */
>   #define sf_get_ops(dev) ((struct dm_spi_flash_ops *)(dev)->driver->ops)
>   
> -#ifdef CONFIG_DM_SPI_FLASH
> +#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
>   /**
>    * spi_flash_read_dm() - Read data from SPI flash
>    *
> 


More information about the U-Boot mailing list