[PATCH 1/1] imx: rom api: fix image offset computation

Sébastien Szymanski sebastien.szymanski at armadeus.com
Tue May 12 15:09:54 CEST 2020


According to the table 6-25 "Primary image offset and IVT offset
details", in the IMX8MNRM, the ROM expects the following image offset:

SD: 32KB
eMMC: 0 if image is in boot partion and 32KB if it is on user partition
NAND: 0
FlexSPI: 4KB
SPI: 0

On eMMC, it is more likely that U-Boot is on the boot partion, so rework
the offset computation by handling the two specific cases (SD and
FlexSPI).

Signed-off-by: Sébastien Szymanski <sebastien.szymanski at armadeus.com>
---
 arch/arm/mach-imx/spl_imx_romapi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c
index 5dc0f7174e..1e9d7bd9ab 100644
--- a/arch/arm/mach-imx/spl_imx_romapi.c
+++ b/arch/arm/mach-imx/spl_imx_romapi.c
@@ -84,10 +84,12 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
 	       image_offset, pagesize, offset);
 
 	if (((rom_bt_dev >> 16) & 0xff) ==  BT_DEV_TYPE_FLEXSPINOR)
-		offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512;
+		offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x1000;
+	else if (((rom_bt_dev >> 16) & 0xff) ==  BT_DEV_TYPE_SD)
+		offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000;
 	else
 		offset = image_offset +
-			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000;
+			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512;
 
 	size = ALIGN(sizeof(struct image_header), pagesize);
 	ret = g_rom_api->download_image((u8 *)header, offset, size,
-- 
2.26.2



More information about the U-Boot mailing list