diff options
author | Ye Li <ye.li@nxp.com> | 2020-06-29 23:51:29 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2022-04-06 18:04:31 +0800 |
commit | fcb5e288f7f5d3640dd3faed2bff1606b5f94e5c (patch) | |
tree | 4e6b8f0ed36037f6d050047d4c3b739e9df275de /arch/arm | |
parent | 6f18dfab1dd35e7ec7a084471cf9fbf213b6d3a2 (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 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/image-container.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c index 31e092cecc4..087b5e46cdb 100644 --- a/arch/arm/mach-imx/image-container.c +++ b/arch/arm/mach-imx/image-container.c @@ -20,6 +20,7 @@ #define NAND_DEV 2 #define QSPI_NOR_DEV 3 #define ROM_API_DEV 4 +#define RAM_DEV 5 /* The unit of second image offset number which provision by the fuse bits */ #define SND_IMG_OFF_UNIT (0x100000UL) @@ -146,6 +147,12 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset, } #endif +#ifdef CONFIG_SPL_RAM_SUPPORT + if (dev_type == RAM_DEV) + memcpy(buf, (const void *)offset, CONTAINER_HDR_ALIGNMENT); +#endif + + ret = get_container_size((ulong)buf, header_length); free(buf); @@ -215,6 +222,8 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type) offset = CONTAINER_HDR_QSPI_OFFSET + 0x08000000; } else if (dev_type == ROM_API_DEV) { offset = (unsigned long)dev; + } else if (dev_type == RAM_DEV) { + offset = (unsigned long)dev + CONTAINER_HDR_MMCSD_OFFSET; } debug("container set offset 0x%lx\n", offset); @@ -380,3 +389,17 @@ ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev) return end; } #endif + +#ifdef CONFIG_SPL_RAM_SUPPORT +unsigned long spl_ram_get_uboot_base(void) +{ + ulong end; + + end = get_imageset_end((void *)CONFIG_SPL_LOAD_FIT_ADDRESS, RAM_DEV); + end = ROUND(end, SZ_1K); + + printf("Load image from RAM 0x%lx\n", end); + + return end; +} +#endif |