summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2020-06-29 23:51:29 -0700
committerYe Li <ye.li@nxp.com>2022-04-06 18:04:31 +0800
commitfcb5e288f7f5d3640dd3faed2bff1606b5f94e5c (patch)
tree4e6b8f0ed36037f6d050047d4c3b739e9df275de /common
parent6f18dfab1dd35e7ec7a084471cf9fbf213b6d3a2 (diff)
MLK-25504-7 imx: Support loading container image from RAM device
For some debug case, we have preloaded the full boot image to RAM device. Add the support that SPL can load the u-boot-atf container from the RAM device. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit d2c4568802708366b3157ce790bfe23a23a96cc2) (cherry picked from commit 1f2609289289f1bc9b6249e7d6f746d2d459cbb5)
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_ram.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index 3f7f7accc1..2093135403 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -21,12 +21,17 @@
# define CONFIG_SPL_LOAD_FIT_ADDRESS 0
#endif
+unsigned long __weak spl_ram_get_uboot_base(void)
+{
+ return CONFIG_SPL_LOAD_FIT_ADDRESS;
+}
+
static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
ulong count, void *buf)
{
debug("%s: sector %lx, count %lx, buf %lx\n",
__func__, sector, count, (ulong)buf);
- memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + sector), count);
+ memcpy(buf, (void *)(sector), count);
return count;
}
@@ -35,7 +40,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
{
struct image_header *header;
- header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+ header = (struct image_header *)spl_ram_get_uboot_base();
#if CONFIG_IS_ENABLED(DFU)
if (bootdev->boot_device == BOOT_DEVICE_DFU)
@@ -49,7 +54,15 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
debug("Found FIT\n");
load.bl_len = 1;
load.read = spl_ram_load_read;
- spl_load_simple_fit(spl_image, &load, 0, header);
+ spl_load_simple_fit(spl_image, &load, (ulong)header, header);
+ } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+ struct spl_load_info load;
+
+ memset(&load, 0, sizeof(load));
+ load.bl_len = 1;
+ load.read = spl_ram_load_read;
+
+ spl_load_imx_container(spl_image, &load, (ulong)header);
} else {
ulong u_boot_pos = binman_sym(ulong, u_boot_any, image_pos);