[U-Boot] [PATCH v6 29/29] SPL: Add support for loading image from ram in SPL.

Tom Rini trini at ti.com
Fri Aug 31 20:03:16 CEST 2012


From: Pavel Machek <pavel at denx.de>

Signed-off-by: Pavel Machek <pavel at denx.de>
Signed-off-by: Tom Rini <trini at ti.com>
---
Changes in v6:
- Add Pavel's spl_ram_load_image for when we've already got next image
  residing in DDR.
- Fix multiline comment in spl_ram_load_image.

 README           |    3 +++
 common/spl/spl.c |   22 ++++++++++++++++++++++
 doc/README.SPL   |    1 +
 3 files changed, 26 insertions(+)

diff --git a/README b/README
index ddbeb1b..016d8bc 100644
--- a/README
+++ b/README
@@ -2636,6 +2636,9 @@ FIT uImage format:
 		CONFIG_SPL_SPI_SUPPORT
 		Support for drivers/spi/libspi.o in SPL binary
 
+		CONFIG_SPL_RAM_DEVICE
+		Support for running image already present in ram, in SPL binary
+
 		CONFIG_SPL_LIBGENERIC_SUPPORT
 		Support for lib/libgeneric.o in SPL binary
 
diff --git a/common/spl/spl.c b/common/spl/spl.c
index f2f6de7..c640f87 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -128,6 +128,23 @@ static void __noreturn jump_to_image_no_args(void)
 	image_entry((u32 *)boot_params_ptr_addr);
 }
 
+#ifdef CONFIG_SPL_RAM_DEVICE
+static void spl_ram_load_image(void)
+{
+	const struct image_header *header;
+
+	/*
+	 * Get the header.  It will point to an address defined by handoff
+	 * which will tell where the image located inside the flash. For
+	 * now, it will temporary fixed to address pointed by U-Boot.
+	 */
+	header = (struct image_header *)
+		(CONFIG_SYS_TEXT_BASE -	sizeof(struct image_header));
+
+	spl_parse_image_header(header);
+}
+#endif
+
 void board_init_r(gd_t *dummy1, ulong dummy2)
 {
 	u32 boot_device;
@@ -145,6 +162,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	boot_device = spl_boot_device();
 	debug("boot device - %d\n", boot_device);
 	switch (boot_device) {
+#ifdef CONFIG_SPL_RAM_DEVICE
+	case BOOT_DEVICE_RAM:
+		spl_ram_load_image();
+		break;
+#endif
 #ifdef CONFIG_SPL_MMC_SUPPORT
 	case BOOT_DEVICE_MMC1:
 	case BOOT_DEVICE_MMC2:
diff --git a/doc/README.SPL b/doc/README.SPL
index e4a5ac3..2acafba 100644
--- a/doc/README.SPL
+++ b/doc/README.SPL
@@ -66,6 +66,7 @@ CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
 CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
 CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o)
 CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o)
+CONFIG_SPL_RAM_DEVICE (common/spl/spl.c)
 
 
 Normally CPU is assumed to be the same between the SPL and normal
-- 
1.7.9.5



More information about the U-Boot mailing list