public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: sbabic@denx.de, Fabio Estevam <festevam@denx.de>
Cc: u-boot@lists.denx.de, Tim Harvey <tharvey@gateworks.com>
Subject: [PATCH 2/5] board: gateworks: venice: dynamically determine U-Boot env partition
Date: Tue,  2 May 2023 17:05:54 -0700	[thread overview]
Message-ID: <20230503000557.2275982-3-tharvey@gateworks.com> (raw)
In-Reply-To: <20230503000557.2275982-1-tharvey@gateworks.com>

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(+)

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();
-- 
2.25.1


  parent reply	other threads:[~2023-05-03  0:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03  0:05 [PATCH 0/5] allow boot firmware to go in user/boot0/boot1 Tim Harvey
2023-05-03  0:05 ` [PATCH 1/5] board: gateworks: venice: dynamically determine U-Boot raw sector Tim Harvey
2023-07-11 19:42   ` sbabic
2023-05-03  0:05 ` Tim Harvey [this message]
2023-07-11 19:43   ` [PATCH 2/5] board: gateworks: venice: dynamically determine U-Boot env partition sbabic
2023-05-03  0:05 ` [PATCH 3/5] board: gateworks: venice: dynamically update the update_firmware script Tim Harvey
2023-07-11 19:46   ` sbabic
2023-05-03  0:05 ` [PATCH 4/5] board: gateworks: venice: move env location Tim Harvey
2023-07-11 19:46   ` sbabic
2023-05-03  0:05 ` [PATCH 5/5] board: gateworks: venice: update board doc to show other emmc parts Tim Harvey
2023-07-11 19:47   ` sbabic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230503000557.2275982-3-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --cc=festevam@denx.de \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox