[EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset

Ye Li ye.li at nxp.com
Mon Mar 28 08:54:41 CEST 2022


Hi Marek,

On Wed, 2022-03-23 at 22:16 +0100, Marek Vasut wrote:
> Caution: EXT Email
> 
> On 3/23/22 03:42, Ye Li wrote:
> > 
> > Hi Marek,
> Hi,
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > 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.
> > > Yes, I need this change to get boot from flexspi working on
> > > i.MX8MP,
> > > without this change writing flash.bin to flexspi results in
> > > unbootable
> > > system.
> > > 
> > To support boot from flexspi, please try another two changes.
> > 1. Modify board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg, set
> >     "BOOT_FROM" to "fspi". (This change is unnecessary on 8MP after
> > switch to binman)
> I already use binman and I need to be able to boot from both SD and
> FlexSPI, with this patch I can do just that.
> 
> > 
> > 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the
> > offset
> > to 0x5f000.  The previous offset 0x58000 is for SD, calculated by
> > 0x60000 - 0x8000 (32KB image offset).
> > 
> >               uboot: blob-ext at 2 {
> >                       filename = "u-boot.itb";
> >                       offset = <0x5f000>;
> >               };
> But that breaks booting from SD card for me ?

Do you want to use one flash.bin for both SD and flexspi? 

When first introduced 8m support by imx8mimage.c, we expected the u-
boot.itb at same device offset (0x60000) on SD/emmc and flexspi. The
imx8mimage will calculate the offset inside the flash.bin automatically
according to different IVT offset. The ROMAPI driver also works
correspondingly.
After using binman, the u-boot.itb offset inside the flash.bin has to
be manually set in this DTS node. To follow the original design, this
offset should be different. That's why I asked to update this dts node
for flexspi.

If you change the ROM API driver, that will break our design. You can
try to overwrite spl_romapi_get_uboot_base for your board only.

Best regards,
Ye Li


More information about the U-Boot mailing list