imx: rom api: fix image offset computation
Subsystems (3)
PATCH 1/1 imx: rom api: fix image offset computation
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).
--- arch/arm/mach-imx/spl_imx_romapi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-imx/spl_imx_romapi.c +4 -2
@@ -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,
Signature · 1 line
2.26.2
PATCH 1/1 imx: rom api: fix image offset computation
Quoted 9 lines · S??bastien Szymanski
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
Quoted 3 lines
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).
Likely, but not really. I have a product where it's on the eMMC but not in a boot partition. If this gets committed, should I sent a diff to revert it? :-) I'm not (yet?) using that code, but shouldn't there be a way to see if we are on a boot partition or not?
Best regards,
Patrick
Quoted 27 lines
Signed-off-by S??bastien Szymanski <[email protected]>--- arch/arm/mach-imx/spl_imx_romapi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/arm/mach-imx/spl_imx_romapi.c +4
-2@@ -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,Signature · 1 line
2.26.2