[U-Boot] [PATCH] mx6: invalidate D-cache only when booting from USB

Vincent vincent.stehle at laposte.net
Tue May 26 17:16:01 CEST 2015


Stefano wrote:
> Please help me to find the use case. I searched in all i.MX6 boards in
> mainline, but none of them is setting CONFIG_SKIP_LOWLEVEL_INIT. Can you
> tell me on which board there is this issue ?

Hi Stefano,

Thank you for taking the time to look at this proposed patch.

You are right, this is a "non standard" use case. What I am trying to do
is to boot u-boot with u-boot on i.MX6Q Sabre SD :)

Here are more details on what I would like to do:

1. Boot "old" u-boot from SD card.
2. "old" u-boot loads "new" u-boot from network with 'dhcp' command.
3. "old" u-boot boots "new" u-boot with 'go' command.

This is not so easy to achieve, it seems. I learned that in this
peculiar use case it is necessary to set CONFIG_SKIP_LOWLEVEL_INIT when
building the "new" u-boot, as hinted by the README.

Also I found out that the call to invalidate_dcache_all() would prevent
the boot for the aforementioned use case. "protecting" the call (as done
in Freescale u-boot) "repairs" my use case, and I verified that it does
not alter the boot through USB.

(boot from USB detection code)
> This looks like a hack. I understand this can work in your case, but can
> we set as general case ? You check power for PHY0, but what about if a
> board is using PHY1 ?
> Anyway, is it not possible to get the boot storage from the SRC ?

You are right, the detection code is not perfect. This is the one I
borrowed from Freescale u-boot, though, so it is reasonably tested "in
the field".

About the phy0/phy1 distinction, I think we can boot only from OTG PHY0
so no worry.

About the SRC; I am not sure you can get the desired information from
there, as booting from USB is a ROM "fallback".

(adding a condition to cache invalidation)
> I cannot understand well this. The correct implementation seems correct
> to me. And if you have issues booting with USB, why are you changing the
> behavior in all other cases *except* booting from USB, where you rely on
> the current implementation invalidating the cache ?

In my case, it is NOT booting with USB rather, it is booting from
another u-boot. I discovered that invalidating the caches in this case
breaks the boot.

The current implementation invalidates the cache in all cases for i.MX6,
as it believes it is always booting from the ROM.

As the comments hint that invalidating the caches is necessary only when
booting from USB (from ROM), I tried to restrict a bit more the
invalidation to this "boot from USB" case. The detection is not perfect,
but it is enough to repair my use case, at least.

Best regards,

V.


More information about the U-Boot mailing list