From patchwork Tue May 12 13:09:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?S=C3=A9bastien_Szymanski?= X-Patchwork-Id: 245671 List-Id: U-Boot discussion From: sebastien.szymanski at armadeus.com (=?UTF-8?q?S=C3=A9bastien=20Szymanski?=) Date: Tue, 12 May 2020 15:09:54 +0200 Subject: [PATCH 1/1] imx: rom api: fix image offset computation Message-ID: <20200512130954.4882-1-sebastien.szymanski@armadeus.com> 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 --- 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,