[PATCH 01/12] treewide: Replace CONFIG_DM_SPI_FLASH with CONFIG_IS_ENABLED(DM_SPI_FLASH)

Sebastian Reichel sebastian.reichel at collabora.com
Wed Jul 1 19:26:14 CEST 2020


From: Marek Vasut <marek.vasut+renesas at gmail.com>

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>
Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.com>
---
 cmd/sf.c                   | 4 ++--
 drivers/mtd/spi/sf_probe.c | 2 +-
 drivers/net/fm/fm.c        | 4 ++--
 include/spi_flash.h        | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cmd/sf.c b/cmd/sf.c
index d18f6a888ce4..a6fed36b7c3e 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -91,7 +91,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(CONFIG_DM_SPI_FLASH)
 	struct udevice *new, *bus_dev;
 	int ret;
 #else
@@ -124,7 +124,7 @@ static int do_spi_flash_probe(int argc, char *const argv[])
 			return -1;
 	}
 
-#ifdef CONFIG_DM_SPI_FLASH
+#if CONFIG_IS_ENABLED(CONFIG_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 3548d6319b30..afda241dd067 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 8ab18163954c..bbb1738c4bdc 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -383,7 +383,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 */
@@ -470,7 +470,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/include/spi_flash.h b/include/spi_flash.h
index d9b2af856c08..b33661948765 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -39,7 +39,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
  *
-- 
2.27.0



More information about the U-Boot mailing list