summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2018-12-26 21:45:54 -0800
committerYe Li <ye.li@nxp.com>2019-01-16 02:17:43 -0800
commit4b2850ccfd8b387590c9fb4abfffdd0ac5cc8e58 (patch)
tree3d4022f8403ff249bc896ece5f713ae0b7bb1ab5 /common
parentcf2acc5b7cde7c8af295e2e2424d83a63d8949f5 (diff)
MLK-20664-1 imx8qxp: spl: Enable SPL container support for NAND
Add the NAND support to SPL container parser and enable it for imx8qxp arm2 nand reworked board. The SPL NAND will read from nandfit mtdpart (128MB offset) to parsing the entire boot image and get the 3rd container from it. This requires burning tool (uuu) to program the entire boot image into nandfit. Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_nand.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 93d4774fff..91446dde5a 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -12,12 +12,20 @@
#include <linux/libfdt_env.h>
#include <fdt.h>
-#if defined(CONFIG_SPL_NAND_RAW_ONLY)
+#ifdef CONFIG_PARSE_CONTAINER
+int __weak nand_load_image_parse_container(struct spl_image_info *spl_image,
+ unsigned long offset)
+{
+ return -EINVAL;
+}
+#endif
+
uint32_t __weak spl_nand_get_uboot_raw_page(void)
{
return CONFIG_SYS_NAND_U_BOOT_OFFS;
}
+#if defined(CONFIG_SPL_NAND_RAW_ONLY)
int spl_nand_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
@@ -69,11 +77,15 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
load.read = spl_nand_fit_read;
return spl_load_simple_fit(spl_image, &load, offset, header);
} else {
+#ifdef CONFIG_PARSE_CONTAINER
+ return nand_load_image_parse_container(spl_image, offset);
+#else
err = spl_parse_image_header(spl_image, header);
if (err)
return err;
return nand_spl_load_image(offset, spl_image->size,
(void *)(ulong)spl_image->load_addr);
+#endif
}
}
@@ -144,7 +156,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
#endif
#endif
/* Load u-boot */
- err = spl_nand_load_element(spl_image, CONFIG_SYS_NAND_U_BOOT_OFFS,
+ err = spl_nand_load_element(spl_image, spl_nand_get_uboot_raw_page(),
header);
#ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
#if CONFIG_SYS_NAND_U_BOOT_OFFS != CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND