Hi Marek, On Mon, 2022-03-21 at 15:59 +0100, Marek Vasut wrote: > Caution: EXT Email > > On 3/21/22 04:35, 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) 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@2 { filename = "u-boot.itb"; offset = <0x5f000>; }; Best regards, Ye Li > > > > 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) > This is how I populate the FlexSPI on MX8MP: > > dhcp ${loadaddr} 192.168.1.1:flash.bin ; \ > \ > setexpr sfaddr ${loadaddr} - 0x1000 ; \ > \ > base ${sfaddr} ; \ > mw 0 0 0x400 ; \ > mw 0x400 0x42464346 ; \ > mw 0x404 0x56010000 ; \ > mw 0x40c 00030300 ; \ > mw 0x444 0x00020101 ; \ > mw 0x450 0x10000000 ; \ > mw 0x480 0x0818040b ; \ > mw 0x484 0x24043008 ; \ > mw 0x5c0 0x100 ; \ > mw 0x5c4 0x10000 ; \ > base 0 ; \ > \ > setexpr filesize ${filesize} + 0x1000 ; \ > \ > sf probe && sf update ${sfaddr} 0 ${filesize}