summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAbel Vesa <abel.vesa@nxp.com>2018-08-02 19:39:01 +0300
committerTeo Hall <teo.hall@nxp.com>2018-08-09 15:18:18 -0500
commite6aa0a71ddcbab24c124542b035fe93197654d1c (patch)
tree95d1234579b35af44f774ab28fa734dce27047aa /common
parenta5a87b64245a4f6a226c0500ce67b3556324e745 (diff)
MLK-19183-8 iMX8QXP SPL: common: spl: Hack for allowing raw ATF image booting
Since the default way to boot ATF from SPL is by using a FIT blob, this hack allows us to boot raw ATF image, without checking anything in the header of the image since is non-existent. Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl.c27
-rw-r--r--common/spl/spl_mmc.c17
2 files changed, 35 insertions, 9 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index b1ce56d0d0..a45e9d5df2 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -139,6 +139,25 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
spl_image->name = "U-Boot";
}
+#if defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE)
+void spl_set_header_raw_atf(struct spl_image_info *spl_image)
+{
+ ulong u_boot_pos = binman_sym(ulong, u_boot_any, pos);
+
+ spl_image->size = CONFIG_SYS_MONITOR_LEN;
+ if (u_boot_pos != BINMAN_SYM_MISSING) {
+ /* biman does not support separate entry addresses at present */
+ spl_image->entry_point = u_boot_pos;
+ spl_image->load_addr = u_boot_pos;
+ } else {
+ spl_image->entry_point = CONFIG_SYS_ATF_START;
+ spl_image->load_addr = CONFIG_ATF_TEXT_BASE;
+ }
+ spl_image->os = IH_OS_ARM_TRUSTED_FIRMWARE;
+ spl_image->name = "Arm Trusted Firmware";
+}
+#endif
+
int spl_parse_image_header(struct spl_image_info *spl_image,
const struct image_header *header)
{
@@ -205,7 +224,11 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
/* Signature not found - assume u-boot.bin */
debug("mkimage signature not found - ih_magic = %x\n",
header->ih_magic);
+#if defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE)
+ spl_set_header_raw_atf(spl_image);
+#else
spl_set_header_raw_uboot(spl_image);
+#endif
#else
/* RAW image not supported, proceed to other boot methods. */
debug("Raw boot image support not enabled, proceeding to other boot methods\n");
@@ -430,10 +453,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
case IH_OS_U_BOOT:
debug("Jumping to U-Boot\n");
break;
-#if CONFIG_IS_ENABLED(ATF)
+#if CONFIG_IS_ENABLED(ATF) || defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE)
case IH_OS_ARM_TRUSTED_FIRMWARE:
debug("Jumping to U-Boot via ARM Trusted Firmware\n");
+#if !defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE)
spl_invoke_atf(&spl_image);
+#endif
break;
#endif
#ifdef CONFIG_SPL_OS_BOOT
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 351f4edd41..fd326f5828 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -56,21 +56,23 @@ static __maybe_unused
int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
struct mmc *mmc, unsigned long sector)
{
- unsigned long count;
- struct image_header *header;
+ struct image_header *header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
+ sizeof(struct image_header));
int ret = 0;
- header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
- sizeof(struct image_header));
+#if !defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE)
+ unsigned long count = 0;
/* read image header to find the image size & load address */
count = blk_dread(mmc_get_blk_desc(mmc), sector, 1, header);
debug("hdr read sector %lx, count=%lu\n", sector, count);
if (count == 0) {
- ret = -EIO;
- goto end;
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ puts("mmc_load_image_raw_sector: mmc block read error\n");
+#endif
+ return -1;
}
-
+#endif
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
image_get_magic(header) == FDT_MAGIC) {
struct spl_load_info load;
@@ -86,7 +88,6 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
ret = mmc_load_legacy(spl_image, mmc, sector, header);
}
-end:
if (ret) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
puts("mmc_load_image_raw_sector: mmc block read error\n");