diff mbox series

[2/5] board: gateworks: venice: dynamically determine U-Boot env partition

Message ID 20230503000557.2275982-3-tharvey@gateworks.com
State Accepted
Commit 2c2cc1eaabc7b4bb5af66830c59a810e97280545
Delegated to: Stefano Babic
Headers show
Series allow boot firmware to go in user/boot0/boot1 | expand

Commit Message

Tim Harvey May 3, 2023, 12:05 a.m. UTC
Determine the U-Boot env hardware partition depending on the boot
device.

This allows the same boot firmware image to be placed on user, boot0,
or boot1 without changing CONFIG_SYS_MMC_ENV_PART.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 board/gateworks/venice/venice.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Stefano Babic July 11, 2023, 7:43 p.m. UTC | #1
> Determine the U-Boot env hardware partition depending on the boot
> device.
> This allows the same boot firmware image to be placed on user, boot0,
> or boot1 without changing CONFIG_SYS_MMC_ENV_PART.
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c
index ca62f0be6d25..7aca75503846 100644
--- a/board/gateworks/venice/venice.c
+++ b/board/gateworks/venice/venice.c
@@ -7,6 +7,7 @@ 
 #include <init.h>
 #include <led.h>
 #include <miiphy.h>
+#include <mmc.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 
@@ -139,6 +140,20 @@  int board_mmc_get_env_dev(int devno)
 	return devno;
 }
 
+uint mmc_get_env_part(struct mmc *mmc)
+{
+	if (!IS_SD(mmc)) {
+		switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) {
+		case 1:
+			return 1;
+		case 2:
+			return 2;
+		}
+	}
+
+	return 0;
+}
+
 int ft_board_setup(void *fdt, struct bd_info *bd)
 {
 	const char *base_model = eeprom_get_baseboard_model();