diff mbox series

[v3,01/13] spl: Untagle spl_start_uboot() from spl_mmc.c

Message ID 20211008195655.46046-2-mr.nuke.me@gmail.com
State Deferred
Delegated to: Tom Rini
Headers show
Series stm32mp1: Support falcon mode with OP-TEE payloads | expand

Commit Message

Alex G. Oct. 8, 2021, 7:56 p.m. UTC
The symbol spl_start_uboot() is provided in spl_mmc.c, but it may also
be provided by platform code.

Fireworks can be created with the following combination:

    CONFIG_SPL_OS_BOOT is not set
    CONFIG_SPL_MMC=y
    ARCH provides spl_start_uboot()

A weak implementation of spl_start_uboot() exists in spl/spl.c, so
leverage that one and stop defining the symbol in spl_mmc.c. We need
the symbol because spl_start_uboot() is called in spl_mmc.c
irrespective of the Falcon mode being activated.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
 common/spl/spl.c     | 10 ++++++----
 common/spl/spl_mmc.c |  4 ----
 2 files changed, 6 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index a9304d4148..6232a23c9e 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -87,15 +87,17 @@  __weak int dram_init_banksize(void)
  * 0 to not start u-boot
  * positive if u-boot should start
  */
-#ifdef CONFIG_SPL_OS_BOOT
 __weak int spl_start_uboot(void)
 {
-	puts(SPL_TPL_PROMPT
-	     "Please implement spl_start_uboot() for your board\n");
-	puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n");
+	if (IS_ENABLED(CONFIG_SPL_OS_BOOT)){
+		puts(SPL_TPL_PROMPT
+		     "Please implement spl_start_uboot() for your board\n");
+		puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n");
+	}
 	return 1;
 }
 
+#ifdef CONFIG_SPL_OS_BOOT
 /*
  * Weak default function for arch specific zImage check. Return zero
  * and fill start and end address if image is recognized.
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index d52f8a3eef..a9a588b04f 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -252,10 +252,6 @@  static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
 	return 0;
 }
 #else
-int spl_start_uboot(void)
-{
-	return 1;
-}
 static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
 				 struct mmc *mmc)
 {