Patchwork [U-Boot,PATCHv2,3/6] spl_mmc: add Falcon mode support for FAT variant

login
register
mail settings
Submitter Peter Korsgaard
Date May 8, 2013, 7:09 p.m.
Message ID <1368040196-21987-4-git-send-email-peter.korsgaard@barco.com>
Download mbox | patch
Permalink /patch/242640/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Peter Korsgaard - May 8, 2013, 7:09 p.m.
If Falcon mode support is enabled (and the system isn't directed into
booting u-boot), it will instead try to load kernel from
CONFIG_SPL_FAT_LOAD_KERNEL_NAME file and kernel argument parameters from
CONFIG_SPL_FAT_LOAD_ARGS_NAME, both from the same partition as u-boot.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
---
 README                |    8 ++++++++
 drivers/mmc/spl_mmc.c |   21 +++++++++++++++++++++
 2 files changed, 29 insertions(+)

Patch

diff --git a/README b/README
index 0d37d56..595c05d 100644
--- a/README
+++ b/README
@@ -2921,6 +2921,14 @@  FIT uImage format:
 		CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME
 		Filename to read to load U-Boot when reading from FAT
 
+		CONFIG_SPL_FAT_LOAD_KERNEL_NAME
+		Filename to read to load kernel uImage when reading
+		from FAT (for Falcon mode)
+
+		CONFIG_SPL_FAT_LOAD_ARGS_NAME
+		Filename to read to load kernel argument parameters
+		when reading from FAT (for Falcon mode)
+
 		CONFIG_SPL_MPC83XX_WAIT_FOR_NAND
 		Set this for NAND SPL on PPC mpc83xx targets, so that
 		start.S waits for the rest of the SPL to load before
diff --git a/drivers/mmc/spl_mmc.c b/drivers/mmc/spl_mmc.c
index fac6f2d..d250b40 100644
--- a/drivers/mmc/spl_mmc.c
+++ b/drivers/mmc/spl_mmc.c
@@ -91,6 +91,24 @@  end:
 
 	return (err <= 0);
 }
+
+#ifdef CONFIG_SPL_OS_BOOT
+static int mmc_load_image_fat_os(struct mmc *mmc)
+{
+	int err;
+
+	err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME,
+			    (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
+	if (err <= 0) {
+		printf("spl: error reading image %s, err - %d\n",
+		       CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
+		return -1;
+	}
+
+	return mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_KERNEL_NAME);
+}
+#endif
+
 #endif
 
 void spl_mmc_load_image(void)
@@ -128,6 +146,9 @@  void spl_mmc_load_image(void)
 			hang();
 		}
 
+#ifdef CONFIG_SPL_OS_BOOT
+		if (spl_start_uboot() || mmc_load_image_fat_os(mmc))
+#endif
 		err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
 #endif
 	} else {