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 1/5] board: gateworks: venice: dynamically determine U-Boot raw sector
Date: Tue,  2 May 2023 17:05:53 -0700	[thread overview]
Message-ID: <20230503000557.2275982-2-tharvey@gateworks.com> (raw)
In-Reply-To: <20230503000557.2275982-1-tharvey@gateworks.com>

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR needs to adjust for
IMX8MN and IMX8MP when booting from an eMMC boot partition due
to IMX BOOTROM v2 using an SPL offset of 0 for boot partitions
and 32K for the user partition.

In order to allow the same firmware to run on both user and boot
hardware partitions adjust raw_sect dynamically at runtime.

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

diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c
index 4eb7bdfcee67..50056da3ee0f 100644
--- a/board/gateworks/venice/spl.c
+++ b/board/gateworks/venice/spl.c
@@ -327,6 +327,21 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
 	}
 }
 
+unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long raw_sect)
+{
+	if (!IS_SD(mmc)) {
+		switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) {
+		case 1:
+		case 2:
+			if (IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP))
+				raw_sect -= 32 * 2;
+			break;
+		}
+	}
+
+	return raw_sect;
+}
+
 const char *spl_board_loader_name(u32 boot_device)
 {
 	switch (boot_device) {
-- 
2.25.1


  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 ` Tim Harvey [this message]
2023-07-11 19:42   ` [PATCH 1/5] board: gateworks: venice: dynamically determine U-Boot raw sector sbabic
2023-05-03  0:05 ` [PATCH 2/5] board: gateworks: venice: dynamically determine U-Boot env partition Tim Harvey
2023-07-11 19:43   ` 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-2-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