diff options
author | Ye Li <ye.li@nxp.com> | 2019-02-19 00:03:04 -0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2019-02-19 00:03:04 -0800 |
commit | 7ea7a16fd892558098fb8cbea134ac275d1220d3 (patch) | |
tree | 87c1533abe607f2588b106c81095d9b1538bf786 /arch | |
parent | 7f753d1b5950015b11be58aa937e5c14b9f26d7a (diff) |
MLK-20945-4 imx8: Update container parser for RAW NOR SPL
Since FSPI is assigned to M4 partition, A core only can read it from its
memory-map address. So we have to enable SPL NOR which won't access
flexspi driver.
Update SPL container parser for the RAW NOR support.
Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/imx8/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx8/image.c | 29 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx8/parser.c | 15 |
3 files changed, 45 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/imx8/Makefile b/arch/arm/mach-imx/imx8/Makefile index 24cbbebf8e..1757275495 100644 --- a/arch/arm/mach-imx/imx8/Makefile +++ b/arch/arm/mach-imx/imx8/Makefile @@ -10,7 +10,7 @@ obj-y += lpcg.o obj-y += fsl_mu_hal.o obj-y += fuse.o obj-y += iomux.o -obj-y += image.o +obj-$(CONFIG_SPL_BUILD) += image.o obj-$(CONFIG_SPL_BUILD) += parser.o ifneq ($(CONFIG_SPL_BUILD),y) obj-y += partition.o diff --git a/arch/arm/mach-imx/imx8/image.c b/arch/arm/mach-imx/imx8/image.c index 3edf2e385f..17806583bd 100644 --- a/arch/arm/mach-imx/imx8/image.c +++ b/arch/arm/mach-imx/imx8/image.c @@ -17,6 +17,7 @@ #define MMC_DEV 0 #define QSPI_DEV 1 #define NAND_DEV 2 +#define QSPI_NOR_DEV 3 static int __get_container_size(ulong addr) { @@ -103,6 +104,12 @@ static int get_container_size(void *dev, int dev_type, unsigned long offset) } #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); @@ -134,6 +141,8 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type) 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; @@ -201,3 +210,23 @@ uint32_t spl_nand_get_uboot_raw_page(void) return end; } + +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; +} diff --git a/arch/arm/mach-imx/imx8/parser.c b/arch/arm/mach-imx/imx8/parser.c index bc0e4c33bf..9021c80357 100644 --- a/arch/arm/mach-imx/imx8/parser.c +++ b/arch/arm/mach-imx/imx8/parser.c @@ -341,3 +341,18 @@ int sdp_load_image_parse_container(struct spl_image_info *spl_image, return ret; } + +int __weak nor_load_image_parse_container(struct spl_image_info *spl_image, + unsigned long offset) +{ + int ret = 0; + + current_dev_type = RAM_DEV; + device = NULL; + + start_offset = offset; + + ret = read_auth_container(spl_image); + + return ret; +} |