diff mbox series

[16/20] x86: apl: Enable SPI flash in TPL with APL_SPI_FLASH_BOOT

Message ID 20201003173142.3213123-17-sjg@chromium.org
State Accepted
Commit d07f31aea07ec642e8072fe0b83ba56ec83cc561
Delegated to: Simon Glass
Headers show
Series dm: Enhance of-platdata to support parent devices | expand

Commit Message

Simon Glass Oct. 3, 2020, 5:31 p.m. UTC
At present, enabling CONFIG_APL_SPI_FLASH_BOOT does not build since SPI
and SPI flash are not enabled for TPL. Add a condition to fix this and
tidy up a build warning in the SPI-flash driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/x86/cpu/apollolake/Kconfig | 2 ++
 drivers/spi/ich.c               | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 30, 2020, 3:34 a.m. UTC | #1
At present, enabling CONFIG_APL_SPI_FLASH_BOOT does not build since SPI
and SPI flash are not enabled for TPL. Add a condition to fix this and
tidy up a build warning in the SPI-flash driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/x86/cpu/apollolake/Kconfig | 2 ++
 drivers/spi/ich.c               | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/arch/x86/cpu/apollolake/Kconfig b/arch/x86/cpu/apollolake/Kconfig
index 35a425cd1bc..c6c1350f4f0 100644
--- a/arch/x86/cpu/apollolake/Kconfig
+++ b/arch/x86/cpu/apollolake/Kconfig
@@ -85,6 +85,8 @@  config APL_SPI_FLASH_BOOT
 	bool "Support booting with SPI-flash driver instead memory-mapped SPI"
 	select TPL_SPI_FLASH_SUPPORT
 	select TPL_SPI_SUPPORT
+	select TPL_DM_SPI
+	select TPL_DM_SPI_FLASH
 	help
 	  This enables SPI and SPI flash in TPL. Without the this only
 	  available boot method is to use memory-mapped SPI. Since this is
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index e1336b89c5a..a91cb785680 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -615,6 +615,7 @@  static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
 	return ret;
 }
 
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
 /**
  * ich_spi_get_basics() - Get basic information about the ICH device
  *
@@ -657,6 +658,7 @@  static int ich_spi_get_basics(struct udevice *bus, bool can_probe,
 
 	return ret;
 }
+#endif
 
 /**
  * ich_get_mmap_bus() - Handle the get_mmap() method for a bus
@@ -946,10 +948,10 @@  static int ich_spi_child_pre_probe(struct udevice *dev)
 static int ich_spi_ofdata_to_platdata(struct udevice *dev)
 {
 	struct ich_spi_platdata *plat = dev_get_platdata(dev);
-	int ret;
 
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct ich_spi_priv *priv = dev_get_priv(dev);
+	int ret;
 
 	ret = ich_spi_get_basics(dev, true, &priv->pch, &plat->ich_version,
 				 &plat->mmio_base);