Hi all,

On 3/5/24 10:36, Christopher Obbard wrote:
[You don't often get email from chris.obb...@collabora.com. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Hi Jonas & Trevor,

On Tue, 2024-03-05 at 10:31 +0100, Jonas Karlman wrote:
Hi Trevor,

On 2024-03-05 03:10, Trevor Woerner wrote:
Following the pattern of other Rockchip devices, enable the U-Boot
environment to be stored in MMC. This patch specifically assumes the
environment will be stored on the SDcard.

This board has SPI flash, so storing env in SPI flash is probably a
better default.

I agree with that.

However, preferably the env should be stored/loaded from
the same device that TPL/SPL was loaded from.

Do you know if there is some mechanism in U-Boot to do this already ?


We do this for our Theobroma boards, though we use the same device that U-Boot proper was loaded from, and not the one that TPL+SPL was loaded from but the logic could be more or less the same.

https://source.denx.de/u-boot/u-boot/-/blob/master/board/theobroma-systems/common/common.c?ref_type=heads#L92-L152

is what you need. The first function is to differentiate between SD card and eMMC, the second actually returns the **kind** of medium the environment is stored on (so MMC or SPI-flash for Theobroma boards).

Instead of https://source.denx.de/u-boot/u-boot/-/blob/master/board/theobroma-systems/common/common.c?ref_type=heads#L94-L95 you probably want to use board_spl_was_booted_from().

Note that to you need the MMC and SPI controllers to be bound in U-Boot proper **before relocation** for this to work. c.f. https://lore.kernel.org/u-boot/20240221-jaguar-v3-15-1f256a822...@theobroma-systems.com/

It could be useful to enable autodetection on many boards which can boot U-
Boot from either SPI flash / eMMC / SD card.


There's been an attempt recently:

https://lore.kernel.org/u-boot/20240226011413.435713-2-benwolsief...@gmail.com/

though only for the MMC part of the equation.

Cheers,
Quentin

Reply via email to