pmaports/temp/u-boot-pinephone/0021-sunxi-Select-environment-MMC-based-on-boot-device.patch
Bobby The Builder 63e2807916
temp/u-boot-pinephone: upgrade to 2021.07 (MR 2315)
- switch sources to official repo https://source.denx.de/u-boot
- use tag v2021.07
- extract patches from pine64-org
- enable DMA transfers from eMMC and mSD (u-boot from Megi)

[ci:skip-build] already built successfully in CI
2021-08-13 23:19:29 -07:00

63 lines
1.9 KiB
Diff

From 7342a9cb423ef2f58566387d7cfb9325fce92293 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 17 Apr 2021 14:08:31 -0500
Subject: [PATCH 21/29] sunxi: Select environment MMC based on boot device
Currently, the environment is always stored in eMMC if eMMC is enabled
in the config. This means images written to SD and eMMC will cross-
contaminate their environments unless the configuration is changed.
By dropping the device number from the environment location string and
implementing mmc_get_env_dev, we will always use the environment from
the boot device when booting from SD/eMMC.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
board/sunxi/board.c | 14 ++++++++++++++
env/Kconfig | 3 +--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 21651a1bfc..b97ca578f7 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -623,6 +623,20 @@ int board_mmc_init(struct bd_info *bis)
return 0;
}
+
+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
+int mmc_get_env_dev(void)
+{
+ switch (sunxi_get_boot_device()) {
+ case BOOT_DEVICE_MMC1:
+ return 0;
+ case BOOT_DEVICE_MMC2:
+ return 1;
+ default:
+ return CONFIG_SYS_MMC_ENV_DEV;
+ }
+}
+#endif
#endif
#ifdef CONFIG_SPL_BUILD
diff --git a/env/Kconfig b/env/Kconfig
index 1411f9e815..cccde2d855 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -444,10 +444,9 @@ config ENV_FAT_INTERFACE
config ENV_FAT_DEVICE_AND_PART
string "Device and partition for where to store the environemt in FAT"
depends on ENV_IS_IN_FAT
+ default ":auto" if ARCH_SUNXI
default "0:1" if TI_COMMON_CMD_OPTIONS
default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL
- default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
- default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
default "0" if ARCH_AT91
help
Define this to a string to specify the partition of the device. It can
--
2.31.1