[U-Boot] [PATCH V2 1/9] spl: mmc: introduce spl_mmc_get_uboot_raw_sector

From: Peng Fan peng.fan@nxp.com
Introduce a weak function spl_mmc_get_uboot_raw_sector, then platform could have their own implementation.
Signed-off-by: Peng Fan peng.fan@nxp.com Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: Marek Vasut marex@denx.de Cc: Andreas Dannenberg dannenberg@ti.com Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Stefan Roese sr@denx.de Cc: Patrick Delaunay patrick.delaunay@st.com Cc: Miquel Raynal miquel.raynal@bootlin.com Cc: Michal Simek michal.simek@xilinx.com ---
V2: None
common/spl/spl_mmc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 6c6eaf4ec8..ebc566081a 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -313,6 +313,15 @@ int spl_boot_partition(const u32 boot_device) } #endif
+unsigned long __weak spl_mmc_get_uboot_raw_sector(struct mmc *mmc) +{ +#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR + return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR; +#else + return 0; +#endif +} + int spl_mmc_load(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, const char *filename, @@ -340,6 +349,8 @@ int spl_mmc_load(struct spl_image_info *spl_image, } }
+ raw_sect = spl_mmc_get_uboot_raw_sector(mmc); + boot_mode = spl_boot_mode(bootdev->boot_device); err = -EINVAL; switch (boot_mode) {

From: Peng Fan peng.fan@nxp.com
Introduce a weak function spl_spi_get_uboot_offs, then platform could have their own implementation.
Signed-off-by: Peng Fan peng.fan@nxp.com Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: Marek Vasut marex@denx.de Cc: Andreas Dannenberg dannenberg@ti.com Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Stefan Roese sr@denx.de Cc: Patrick Delaunay patrick.delaunay@st.com Cc: Miquel Raynal miquel.raynal@bootlin.com Cc: Michal Simek michal.simek@xilinx.com ---
V2: switch raw_sector to offs
common/spl/spl_spi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 9b74473377..84f20ea4ed 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -62,6 +62,12 @@ static ulong spl_spi_fit_read(struct spl_load_info *load, ulong sector, else return 0; } + +unsigned int __weak spl_spi_get_uboot_offs(struct spi_flash *flash) +{ + return CONFIG_SYS_SPI_U_BOOT_OFFS; +} + /* * The main entry for SPI booting. It's necessary that SDRAM is already * configured and available since this code loads the main U-Boot image @@ -71,7 +77,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { int err = 0; - unsigned payload_offs = CONFIG_SYS_SPI_U_BOOT_OFFS; + unsigned int payload_offs; struct spi_flash *flash; struct image_header *header;
@@ -90,6 +96,8 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, return -ENODEV; }
+ payload_offs = spl_spi_get_uboot_offs(flash); + header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)

From: Peng Fan peng.fan@nxp.com
Introduce weak spl_nor_get_uboot_base, then platform have their own implementation.
Signed-off-by: Peng Fan peng.fan@nxp.com Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: Marek Vasut marex@denx.de Cc: Andreas Dannenberg dannenberg@ti.com Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Stefan Roese sr@denx.de Cc: Patrick Delaunay patrick.delaunay@st.com Cc: Miquel Raynal miquel.raynal@bootlin.com Cc: Michal Simek michal.simek@xilinx.com ---
V2: None
common/spl/spl_nor.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 969e319de0..0f8afa6f92 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -18,6 +18,11 @@ static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector, } #endif
+unsigned long __weak spl_nor_get_uboot_base(void) +{ + return CONFIG_SYS_UBOOT_BASE; +} + static int spl_nor_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { @@ -80,25 +85,25 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, * defined location in SDRAM */ #ifdef CONFIG_SPL_LOAD_FIT - header = (const struct image_header *)CONFIG_SYS_UBOOT_BASE; + header = (const struct image_header *)spl_nor_get_uboot_base(); if (image_get_magic(header) == FDT_MAGIC) { debug("Found FIT format U-Boot\n"); load.bl_len = 1; load.read = spl_nor_load_read; ret = spl_load_simple_fit(spl_image, &load, - CONFIG_SYS_UBOOT_BASE, + spl_nor_get_uboot_base(), (void *)header);
return ret; } #endif ret = spl_parse_image_header(spl_image, - (const struct image_header *)CONFIG_SYS_UBOOT_BASE); + (const struct image_header *)spl_nor_get_uboot_base()); if (ret) return ret;
memcpy((void *)(unsigned long)spl_image->load_addr, - (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)), + (void *)(spl_nor_get_uboot_base() + sizeof(struct image_header)), spl_image->size);
return 0;

From: Peng Fan peng.fan@nxp.com
Introduce weak spl_nand_get_uboot_raw_page, then platform could have their own implementation.
Signed-off-by: Peng Fan peng.fan@nxp.com Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: Marek Vasut marex@denx.de Cc: Andreas Dannenberg dannenberg@ti.com Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Stefan Roese sr@denx.de Cc: Patrick Delaunay patrick.delaunay@st.com Cc: Miquel Raynal miquel.raynal@bootlin.com Cc: Michal Simek michal.simek@xilinx.com ---
V2: None
common/spl/spl_nand.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index e2bcefb111..d3185dc017 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -11,6 +11,11 @@ #include <linux/libfdt_env.h> #include <fdt.h>
+uint32_t __weak spl_nand_get_uboot_raw_page(void) +{ + return CONFIG_SYS_NAND_U_BOOT_OFFS; +} + #if defined(CONFIG_SPL_NAND_RAW_ONLY) static int spl_nand_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) @@ -21,7 +26,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, CONFIG_SYS_NAND_U_BOOT_DST);
- nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + nand_spl_load_image(spl_nand_get_uboot_raw_page(), CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); spl_set_header_raw_uboot(spl_image); @@ -139,7 +144,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

From: Peng Fan peng.fan@nxp.com
To avoid hardcoded offset when adding u-boot.cnt to flash.bin, we use flexible offset which is calculated based on the size of the container image generated int the first stage. And pad u-boot.cnt at 1KB alignment.
So add code to get the offset when SPL loading u-boot.cnt.
Signed-off-by: Ye Li ye.li@nxp.com Signed-off-by: Peng Fan peng.fan@nxp.com ---
V2: None
arch/arm/mach-imx/Makefile | 9 +- arch/arm/mach-imx/imx8/Makefile | 2 +- arch/arm/mach-imx/imx8/image.c | 246 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/imx8/image.c
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 199b2df22b..46bc2a21e2 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -169,9 +169,16 @@ u-boot.cnt: MKIMAGEOUTPUT = u-boot.cnt.log ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y) u-boot.cnt: u-boot.bin container.cfg FORCE $(call if_changed,mkimage) -endif flash.bin: spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) + @flashbin_size=`wc -c flash.bin | awk '{print $$1}'`; \ + pad_cnt=$$(((flashbin_size + 0x400 - 1) / 0x400)); \ + echo "append u-boot.cnt at $$pad_cnt KB"; \ + dd if=u-boot.cnt of=flash.bin bs=1K seek=$$pad_cnt; +else +flash.bin: spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) +endif endif
else diff --git a/arch/arm/mach-imx/imx8/Makefile b/arch/arm/mach-imx/imx8/Makefile index 97f9d22945..39e384d5c7 100644 --- a/arch/arm/mach-imx/imx8/Makefile +++ b/arch/arm/mach-imx/imx8/Makefile @@ -8,5 +8,5 @@ obj-y += cpu.o iomux.o misc.o lowlevel_init.o obj-$(CONFIG_OF_SYSTEM_SETUP) += fdt.o
ifdef CONFIG_SPL_BUILD -obj-$(CONFIG_SPL_LOAD_IMX_CONTAINER) += parse-container.o +obj-$(CONFIG_SPL_LOAD_IMX_CONTAINER) += image.o parse-container.o endif diff --git a/arch/arm/mach-imx/imx8/image.c b/arch/arm/mach-imx/imx8/image.c new file mode 100644 index 0000000000..58a29e8a03 --- /dev/null +++ b/arch/arm/mach-imx/imx8/image.c @@ -0,0 +1,246 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2019 NXP + */ + +#include <common.h> +#include <errno.h> +#include <asm/io.h> +#include <mmc.h> +#include <spi_flash.h> +#include <nand.h> +#include <asm/arch/image.h> +#include <asm/arch/sys_proto.h> +#include <asm/mach-imx/boot_mode.h> + +#define MMC_DEV 0 +#define QSPI_DEV 1 +#define NAND_DEV 2 +#define QSPI_NOR_DEV 3 + +static int __get_container_size(ulong addr) +{ + struct container_hdr *phdr; + struct boot_img_t *img_entry; + struct signature_block_hdr *sign_hdr; + u8 i = 0; + u32 max_offset = 0, img_end; + + phdr = (struct container_hdr *)addr; + if (phdr->tag != 0x87 && phdr->version != 0x0) { + debug("Wrong container header\n"); + return -EFAULT; + } + + max_offset = sizeof(struct container_hdr); + + img_entry = (struct boot_img_t *)(addr + sizeof(struct container_hdr)); + for (i = 0; i < phdr->num_images; i++) { + img_end = img_entry->offset + img_entry->size; + if (img_end > max_offset) + max_offset = img_end; + + debug("img[%u], end = 0x%x\n", i, img_end); + + img_entry++; + } + + if (phdr->sig_blk_offset != 0) { + sign_hdr = (struct signature_block_hdr *)(addr + phdr->sig_blk_offset); + u16 len = sign_hdr->length_lsb + (sign_hdr->length_msb << 8); + + if (phdr->sig_blk_offset + len > max_offset) + max_offset = phdr->sig_blk_offset + len; + + debug("sigblk, end = 0x%x\n", phdr->sig_blk_offset + len); + } + + return max_offset; +} + +static int get_container_size(void *dev, int dev_type, unsigned long offset) +{ + u8 *buf = malloc(CONTAINER_HDR_ALIGNMENT); + int ret = 0; + + if (!buf) { + printf("Malloc buffer failed\n"); + return -ENOMEM; + } + +#ifdef CONFIG_SPL_MMC_SUPPORT + if (dev_type == MMC_DEV) { + unsigned long count = 0; + struct mmc *mmc = (struct mmc *)dev; + + count = blk_dread(mmc_get_blk_desc(mmc), + offset / mmc->read_bl_len, + CONTAINER_HDR_ALIGNMENT / mmc->read_bl_len, + buf); + if (count == 0) { + printf("Read container image from MMC/SD failed\n"); + return -EIO; + } + } +#endif + +#ifdef CONFIG_SPL_SPI_LOAD + if (dev_type == QSPI_DEV) { + struct spi_flash *flash = (struct spi_flash *)dev; + + ret = spi_flash_read(flash, offset, + CONTAINER_HDR_ALIGNMENT, buf); + if (ret != 0) { + printf("Read container image from QSPI failed\n"); + return -EIO; + } + } +#endif + +#ifdef CONFIG_SPL_NAND_SUPPORT + if (dev_type == NAND_DEV) { + ret = nand_spl_load_image(offset, CONTAINER_HDR_ALIGNMENT, + buf); + if (ret != 0) { + printf("Read container image from NAND failed\n"); + return -EIO; + } + } +#endif + +#ifdef CONFIG_SPL_NOR_SUPPORT + if (dev_type == QSPI_NOR_DEV) + memcpy(buf, (const void *)offset, CONTAINER_HDR_ALIGNMENT); +#endif + + ret = __get_container_size((ulong)buf); + + free(buf); + + return ret; +} + +static unsigned long get_boot_device_offset(void *dev, int dev_type) +{ + unsigned long offset = 0; + + if (dev_type == MMC_DEV) { + struct mmc *mmc = (struct mmc *)dev; + + if (IS_SD(mmc) || mmc->part_config == MMCPART_NOAVAILABLE) { + offset = CONTAINER_HDR_MMCSD_OFFSET; + } else { + u8 part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); + + if (part == 1 || part == 2) { + if (is_imx8qxp() && is_soc_rev(CHIP_REV_B)) + offset = CONTAINER_HDR_MMCSD_OFFSET; + else + offset = CONTAINER_HDR_EMMC_OFFSET; + } else { + offset = CONTAINER_HDR_MMCSD_OFFSET; + } + } + } else if (dev_type == QSPI_DEV) { + offset = CONTAINER_HDR_QSPI_OFFSET; + } else if (dev_type == NAND_DEV) { + offset = CONTAINER_HDR_NAND_OFFSET; + } else if (dev_type == QSPI_NOR_DEV) { + offset = CONTAINER_HDR_QSPI_OFFSET + 0x08000000; + } + + return offset; +} + +static int get_imageset_end(void *dev, int dev_type) +{ + unsigned long offset1 = 0, offset2 = 0; + int value_container[2]; + + offset1 = get_boot_device_offset(dev, dev_type); + offset2 = CONTAINER_HDR_ALIGNMENT + offset1; + + value_container[0] = get_container_size(dev, dev_type, offset1); + if (value_container[0] < 0) { + printf("Parse seco container failed %d\n", value_container[0]); + return value_container[0]; + } + + debug("seco container size 0x%x\n", value_container[0]); + + value_container[1] = get_container_size(dev, dev_type, offset2); + if (value_container[1] < 0) { + debug("Parse scu container failed %d, only seco container\n", + value_container[1]); + /* return seco container total size */ + return value_container[0] + offset1; + } + + debug("scu container size 0x%x\n", value_container[1]); + + return value_container[1] + offset2; +} + +#ifdef CONFIG_SPL_SPI_LOAD +unsigned long spl_spi_get_uboot_offs(struct spi_flash *flash) +{ + int end; + + end = get_imageset_end(flash, QSPI_DEV); + end = ROUND(end, SZ_1K); + + printf("Load image from QSPI 0x%x\n", end); + + return end; +} +#endif + +#ifdef CONFIG_SPL_MMC_SUPPORT +unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc) +{ + int end; + + end = get_imageset_end(mmc, MMC_DEV); + end = ROUND(end, SZ_1K); + + printf("Load image from MMC/SD 0x%x\n", end); + + return end / mmc->read_bl_len; +} +#endif + +#ifdef CONFIG_SPL_NAND_SUPPORT +uint32_t spl_nand_get_uboot_raw_page(void) +{ + int end; + + end = get_imageset_end((void *)NULL, NAND_DEV); + end = ROUND(end, SZ_16K); + + printf("Load image from NAND 0x%x\n", end); + + return end; +} +#endif + +#ifdef CONFIG_SPL_NOR_SUPPORT +unsigned long spl_nor_get_uboot_base(void) +{ + int end; + + /* Calculate the image set end, + * if it is less than CONFIG_SYS_UBOOT_BASE(0x8281000), + * we use CONFIG_SYS_UBOOT_BASE + * Otherwise, use the calculated address + */ + end = get_imageset_end((void *)NULL, QSPI_NOR_DEV); + if (end <= CONFIG_SYS_UBOOT_BASE) + end = CONFIG_SYS_UBOOT_BASE; + else + end = ROUND(end, SZ_1K); + + printf("Load image from NOR 0x%x\n", end); + + return end; +} +#endif

From: Peng Fan peng.fan@nxp.com
After u-boot.cnt is padded to flash.bin automatically by script, no need to burn the image mannually, so drop the step.
Signed-off-by: Peng Fan peng.fan@nxp.com ---
V2: None
board/freescale/imx8qm_mek/README | 1 - board/freescale/imx8qxp_mek/README | 1 - 2 files changed, 2 deletions(-)
diff --git a/board/freescale/imx8qm_mek/README b/board/freescale/imx8qm_mek/README index ebf630c446..a187ad8a09 100644 --- a/board/freescale/imx8qm_mek/README +++ b/board/freescale/imx8qm_mek/README @@ -41,7 +41,6 @@ Build U-Boot ============ $ make imx8qm_mek_defconfig $ make flash.bin -$ dd if=u-boot.cnt of=flash.bin bs=512 seek=1984
Flash the binary into the SD card ================================= diff --git a/board/freescale/imx8qxp_mek/README b/board/freescale/imx8qxp_mek/README index 1ee0357961..e676e88664 100644 --- a/board/freescale/imx8qxp_mek/README +++ b/board/freescale/imx8qxp_mek/README @@ -41,7 +41,6 @@ Build U-Boot ============ $ make imx8qxp_mek_defconfig $ make flash.bin -$ dd if=u-boot.cnt of=flash.bin bs=512 seek=1984
Flash the binary into the SD card =================================

From: Peng Fan peng.fan@nxp.com
i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container support to let SPL could load container images.
Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: York Sun york.sun@nxp.com Cc: Marek Vasut marex@denx.de Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Philipp Tomsich philipp.tomsich@theobroma-systems.com Cc: Kever Yang kever.yang@rock-chips.com Cc: Heiko Schocher hs@denx.de Signed-off-by: Peng Fan peng.fan@nxp.com ---
V2: New
common/spl/spl_nand.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index d3185dc017..5f8a111a2f 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -68,6 +68,15 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, load.bl_len = 1; load.read = spl_nand_fit_read; return spl_load_simple_fit(spl_image, &load, offset, header); + } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { + struct spl_load_info load; + + load.dev = NULL; + load.priv = NULL; + load.filename = NULL; + load.bl_len = 1; + load.read = spl_nand_fit_read; + return spl_load_imx_container(spl_image, &load, offset); } else { err = spl_parse_image_header(spl_image, header); if (err)

From: Peng Fan peng.fan@nxp.com
i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container support to let SPL could load container images.
Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: York Sun york.sun@nxp.com Cc: Marek Vasut marex@denx.de Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Philipp Tomsich philipp.tomsich@theobroma-systems.com Cc: Kever Yang kever.yang@rock-chips.com Cc: Heiko Schocher hs@denx.de Signed-off-by: Peng Fan peng.fan@nxp.com ---
V2: New
common/spl/spl_spi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 84f20ea4ed..288dbb5fa9 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -141,6 +141,17 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, err = spl_load_simple_fit(spl_image, &load, payload_offs, header); + } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { + struct spl_load_info load; + + load.dev = flash; + load.priv = NULL; + load.filename = NULL; + load.bl_len = 1; + load.read = spl_spi_fit_read; + + err = spl_load_imx_container(spl_image, &load, + payload_offs); } else { err = spl_parse_image_header(spl_image, header); if (err)

From: Peng Fan peng.fan@nxp.com
i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container support to let SPL could load container images.
Cc: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com Cc: Tien Fong Chee tien.fong.chee@intel.com Cc: York Sun york.sun@nxp.com Cc: Marek Vasut marex@denx.de Cc: Alex Kiernan alex.kiernan@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Philipp Tomsich philipp.tomsich@theobroma-systems.com Cc: Kever Yang kever.yang@rock-chips.com Cc: Heiko Schocher hs@denx.de Signed-off-by: Peng Fan peng.fan@nxp.com ---
V2: New
common/spl/spl_nor.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 0f8afa6f92..7df708de9b 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -6,7 +6,6 @@ #include <common.h> #include <spl.h>
-#ifdef CONFIG_SPL_LOAD_FIT static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { @@ -16,7 +15,6 @@ static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector,
return count; } -#endif
unsigned long __weak spl_nor_get_uboot_base(void) { @@ -97,6 +95,13 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, return ret; } #endif + if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { + load.bl_len = 1; + load.read = spl_nor_load_read; + return spl_load_imx_container(spl_image, &load, + spl_nor_get_uboot_base()); + } + ret = spl_parse_image_header(spl_image, (const struct image_header *)spl_nor_get_uboot_base()); if (ret)
participants (1)
-
peng.fan@nxp.com