From: Patrick Wildt Date: Tue, 12 May 2020 19:05:23 +0200 Subject: [PATCH 1/1] imx: rom api: fix image offset computation In-Reply-To: <20200512130954.4882-1-sebastien.szymanski@armadeus.com> References: <20200512130954.4882-1-sebastien.szymanski@armadeus.com> Message-ID: <20200512170523.GA44627@ryzen.blueri.se> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, May 12, 2020 at 03:09:54PM +0200, S??bastien Szymanski wrote: > 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). 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 > 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, > -- > 2.26.2 >