i.MX8MN (ROMv2) fails to boot over USB

Adam Ford aford173 at gmail.com
Sat Jan 29 03:04:13 CET 2022


On Fri, Jan 28, 2022 at 7:50 PM Tim Harvey <tharvey at gateworks.com> wrote:
>
> On Wed, Jan 26, 2022 at 10:36 AM Adam Ford <aford173 at gmail.com> wrote:
> >
> > On Wed, Jan 26, 2022 at 12:31 PM Michael Nazzareno Trimarchi
> > <michael at amarulasolutions.com> wrote:
> > >
> > > HI Adam
> > >
> > > On Wed, Jan 26, 2022 at 7:01 PM Adam Ford <aford173 at gmail.com> wrote:
> > > >
> > > > On Wed, Jan 26, 2022 at 11:24 AM Michael Nazzareno Trimarchi
> > > > <michael at amarulasolutions.com> wrote:
> > > > >
> > > > > Hi Adam
> > > > >
> > > > > On Wed, Jan 26, 2022 at 2:26 AM Tim Harvey <tharvey at gateworks.com> wrote:
> > > > > >
> > > > > > On Tue, Jan 25, 2022 at 3:49 PM Adam Ford <aford173 at gmail.com> wrote:
> > > > > > >
> > > > > > > I have a flash.bin file that boots over MMC just fine, but when I use
> > > > > > > that same flash.bin file, it appears to hang after running ATF.  I
> > > > > > > dumped some debug info for printing the handling of the FIT file, and
> > > > > > > I noticed the fit read sizes are also not consistent between MMC and
> > > > > > > USB loads with the identical flash.bin.
> > > > > > >
> > > > > > > MMC booting is calling spl_romapi_raw_seekable_read, but the USB
> > > > > > > booting is not.  Maybe this is normal.
> > > > > > >
> > > > > > > I was hoping someone might have some pointers on how I can
> > > > > > > troubleshoot this.  It's also weird to me that the various nodes are
> > > > > > > listed twice in the USB boot, but not the MMC boot.
> > > > > > >
> > > > > > > I have poked around in the spl_imx_romapi.c file, but I am not seeing
> > > > > > > anything obvious.
> > > > > > >
> > > > > > > SPL and ATF are executing, so it's partially decoding the FIT file and
> > > > > > > executing those two pieces correctly from what I can see.
> > > > > > >
> > > > > > > USB log (no FDT)
> > > > > > > U-Boot SPL 2022.01-00753-g7f7f25ecb8-dirty (Jan 25 2022 - 15:54:57 -0600)
> > > > > > > WDT:   Started watchdog at 30280000 with servicing (60s timeout)
> > > > > > > Trying to boot from BOOTROM
> > > > > > > Find img info 0x&48027600, size 872
> > > > > > > Need continue download 1024
> > > > > > > fit read sector 48027600, sectors=872, dst=42206c40, count=872, size=0x368
> > > > > > > firmware: 'uboot'
> > > > > > > External data: dst=40200000, offset=3000, size=a4d98
> > > > > > > fdt: 'fdt'
> > > > > > > External data: dst=402a4dc0, offset=b1e60, size=af68
> > > > > > > loadables: 'atf'
> > > > > > > External data: dst=960000, offset=a7d98, size=a0c6
> > > > > > > no string for index 1
> > > > > > > Download 772040, Total size 773576
> > > > > > > fit read sector 48027600, sectors=872, dst=42206fb0, count=872, size=0x368
> > > > > > > firmware: 'uboot'
> > > > > > > External data: dst=40200000, offset=3000, size=a4d98
> > > > > > > fdt: 'fdt'
> > > > > > > External data: dst=402a4dc0, offset=b1e60, size=af68
> > > > > > > loadables: 'atf'
> > > > > > > External data: dst=960000, offset=a7d98, size=a0c6
> > > > > > > no string for index 1
> > > > > > > NOTICE:  BL31: v2.4(release):lf-5.10.72-2.2.0-0-g5782363f9
> > > > > > > NOTICE:  BL31: Built : 14:45:34, Jan 25 2022
> > > > > > >
> > > > > > > <hang>
> > > > > > >
> > > > > > > MMC Booting Log (with DTB):
> > > > > > >
> > > > > > > U-Boot SPL 2022.01-00753-g7f7f25ecb8-dirty (Jan 25 2022 - 15:54:57 -0600)
> > > > > > > WDT:   Started watchdog at 30280000 with servicing (60s timeout)
> > > > > > > Trying to boot from BOOTROM
> > > > > > > image offset 0x8000, pagesize 0x200, ivt offset 0x0
> > > > > > > ROM API load from 0x60000, size 0x400
> > > > > > > spl_romapi_raw_seekable_read 0x60000, size 0x400
> > > > > > > fit read sector 300, sectors=2, dst=42206c40, count=2, size=0x368
> > > > > > > firmware: 'uboot'
> > > > > > > ROM API load from 0x63000, size 0xa4e00
> > > > > > > spl_romapi_raw_seekable_read 0x63000, size 0xa4e00
> > > > > > > External data: dst=40200000, offset=3000, size=a4d98
> > > > > > > fdt: 'fdt'
> > > > > > > ROM API load from 0x111e00, size 0xb000
> > > > > > > spl_romapi_raw_seekable_read 0x111e00, size 0xb000
> > > > > > > External data: dst=402a4dc0, offset=b1e60, size=af68
> > > > > > > loadables: 'atf'
> > > > > > > ROM API load from 0x107c00, size 0xa400
> > > > > > > spl_romapi_raw_seekable_read 0x107c00, size 0xa400
> > > > > > > External data: dst=960000, offset=a7d98, size=a0c6
> > > > > > > no string for index 1
> > > > > > > NOTICE:  BL31: v2.4(release):lf-5.10.72-2.2.0-0-g5782363f9
> > > > > > > NOTICE:  BL31: Built : 14:45:34, Jan 25 2022
> > > > > > >
> > > > > > > <u-boot loads successfully from here>
> > > > > >
> > > > > > Adam,
> > > > > >
> > > > > > I've previously run into this as well and unfortunately have no
> > > > > > solution. Note that I had to hack in some support to the SPL for USB
> > > > > > which I assume you've done as well. If I recall trying to enable
> > > > > > DM_USB for the SPL took too much space so that hacks I had revolved
> > > > > > around getting it to work in the non-DM fashion.
> > > > >
> > > > > I was having the same problem and I found that was related to
> > > > > diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> > > > > index 863508776d..9d6dab08e6 100644
> > > > > --- a/arch/arm/mach-imx/imx8m/soc.c
> > > > > +++ b/arch/arm/mach-imx/imx8m/soc.c
> > > > > @@ -1333,6 +1333,7 @@ enum env_location env_get_location(enum
> > > > > env_operation op, int prio)
> > > > >
> > > > > You should support USB_BOOT in switch case or change your defconfig
> > > > > and add CONFIG_ENV_IS_NOWHERE=y
> > > >
> > > > Thanks for the tip.  it strikes me as odd that the system would hang
> > > > if we don't know what to do with the environment.  I would expect it
> > > > to just load the default and move on.
> > > >
> > > > I'll work on a defconfig fix.
> > > >
> > >
> > > Those nxp function should be dropped or fixed anyway
> >
> > There was an RFC to move this function to the board files [1].  I
> > think this is a good idea since some people may want environmental
> > variables stored in a specific place rather than be dependent on the
> > boot source.  I know my colleagues at Beacon want that.
> >
>
> Adam,
>
> Can you explain what you are doing here and what it means to boot from BOOTROM?
>
> I went back and looked at the issue I was running into on the IMX8MN
> as I thought it was what you were seeing but in my case I was trying
> to boot via SDP on a board with USB-OTG and an erased eMMC using uuu.
> The issue I ran into enabling SDP support was that the SPL code
> overflowed the SRAM size so I disabled SPL_DM_USB and that is where I
> had to hack in some non-dm code to get around it. That was probably
> not the right approach and I need to figure out where code can be
> trimmed down. Are you able to enable SPL_DM_USB and use USB from the
> SPL or are you doing something different here?

I don't need USB in SPL because the boot ROM can handle all that.  If
you look at the spl.c file in boards/beacon/imx8mn, you'll see that
spl_board_boot_device  only returns the boot ROM regardless of the
actual boot device.  The BootROM handles all the USB traffic in SPL
for me.  It also handles the SPL booting from MMC, and when using
NXP's custom U-Boot, it also boots from FlexSPI.   (side note, I am
going to work on FlexSPI booting upstream soon).  There is special
code in SPL to use boot ROM API which can do all the loading of ATF,
U-Boot, etc. from the fit image and SPL can coordinate what data, and
how much etc.

To make this work, I had to enable CONFIG_ENV_IS_NOWHERE [1] in my
defconfig because of some platform code for Nano and Plus and how it
handles the locations of the U-Boot environment.

This should be very similar to how the imx8mn-evk works too.

adam

[1] - https://patchwork.ozlabs.org/project/uboot/patch/20220126182523.58575-1-aford173@gmail.com/
>
> Best regards,
>
> Tim


More information about the U-Boot mailing list