Hi Marek, On Wed, 2022-03-09 at 17:09 +0100, Marek Vasut wrote: > Caution: EXT Email > > The FlexSPI NOR boot offset does not require any special handling, > the image_offset is correct in either case (0x1000 for FlexSPI NOR > and 0x8000 for SD/eMMC) and the offset of u-boot.itb from the start > of flash.bin is always 0x58000 on MX8MN/MX8MP, which matches the > CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000 in case > CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300, which is always the > case on MX8MN/MX8MP. > > The CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is really overloaded in > case of the MX8MN/MX8MP, but fixing that needs additional plumbing. > > Signed-off-by: Marek Vasut <ma...@denx.de> > Cc: Fabio Estevam <feste...@denx.de> > Cc: Peng Fan <peng....@nxp.com> > Cc: Stefano Babic <sba...@denx.de> > --- > arch/arm/mach-imx/spl_imx_romapi.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach- > imx/spl_imx_romapi.c > index d827de375a6..c47f5a6bdb4 100644 > --- a/arch/arm/mach-imx/spl_imx_romapi.c > +++ b/arch/arm/mach-imx/spl_imx_romapi.c > @@ -38,14 +38,8 @@ ulong spl_romapi_raw_seekable_read(u32 offset, u32 > size, void *buf) > > ulong __weak spl_romapi_get_uboot_base(u32 image_offset, u32 > rom_bt_dev) > { > - u32 offset; > - > - if (((rom_bt_dev >> 16) & 0xff) == BT_DEV_TYPE_FLEXSPINOR) > - offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * > 512; > - else > - offset = image_offset + > CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000; > - > - return offset; > + return image_offset + > + (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - > 0x8000); > }
The change is problematic to flexspi. Actually u-boot.itb is fixed at device offset 0x60000 (= 512 * 0x300) for flexspi/emmc/sd.The case is the image_offset for emmc/sd may vary according to the primary boot or secondary boot and the eMMC user partition or boot partition. If you changed to "image_offset + (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000", the address for flexspi becomes 0x59000 (= 0x1000 + 0x60000 - 0x8000) Best regards, Ye Li > > static int is_boot_from_stream_device(u32 boot) > -- > 2.34.1 >