Commit 01ab4e18 authored by Hugo Grostabussiat's avatar Hugo Grostabussiat

librem5: Add option to load env from boot hwpart

Enable U-boot to load the environment from the eMMC hwpart the system
booted from.
- Add a board-level Kconfig knob to enable/disable this feature
- Add partition selection logic to the board code
parent d833554d
......@@ -12,4 +12,25 @@ config SYS_CONFIG_NAME
bool "Use the M4 to load the DDR training firmware"
bool "Load the environment from the MMC partition U-boot started from"
default N
Load/save the U-boot environment from/to the partition the eMMC
is set to boot from.
The boot partition selection is a persistent value set in the
eMMC EXTCSD register using the "mmc partconf" U-boot command.
When this option is enabled, U-boot will determine the MMC
partition to use depending on the value stored in the
PARTITION_CONFIG byte of the EXTCSD register.
When disabled, U-boot will use the partition specified in the
CONFIG_SYS_MMC_ENV_PART define in the board config.
For this option to have any effect, your board config file must
define CONFIG_ENV_IS_IN_MMC, and set appropriate values to
......@@ -298,6 +298,16 @@ int board_mmc_get_env_dev(int devno)
return devno;
uint board_mmc_get_env_part(struct mmc *mmc)
uint part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
if (part == 7)
part = 0;
return part;
int board_late_init(void)
struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment