mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: lst@pengutronix.de, ukl@pengutronix.de, rcz@pegutronix.de,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] ARM: i.MX8MP: bbu: use correct offset for eMMC boot partition
Date: Thu, 26 Aug 2021 18:57:18 +0200	[thread overview]
Message-ID: <20210826165718.1905-1-a.fatoum@pengutronix.de> (raw)

According to the i.MX8MP RM rev3, the bootrom expects the bootloader to
sit directly at the start of the eMMC boot partition.

The 32K offset is only valid for eMMC user partitions and SD. Reflect
this in the code. This should allow changing the update handler for
the i.MX8MP-EVK from using the eMMC user area to using the eMMC boot
partition. This isn't done here, because the change wasn't tested
on actual hardware.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Change is untested. Would be great if someone can confirm on actual HW.
(And adjust the EVK boot handler)
---
 arch/arm/mach-imx/imx-bbu-internal.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 880f8b249642..32c6f44fb4ac 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -393,6 +393,15 @@ static unsigned long imx_bbu_flash_header_offset_mmc(void)
 	return SZ_1K;
 }
 
+static unsigned long imx_bbu_flash_header_offset_mmcboot(void)
+{
+	if (cpu_is_mx8mp())
+		return 0;
+
+	/* Older i.MX use for boot partition the same offset as eMMC user/SD */
+	return imx_bbu_flash_header_offset_mmc();
+}
+
 static int imx_bbu_update(struct bbu_handler *handler, struct bbu_data *data)
 {
 	struct imx_internal_bbu_handler *imx_handler =
@@ -608,7 +617,7 @@ static int imx_bbu_internal_mmcboot_register_handler(const char *name,
 	struct imx_internal_bbu_handler *imx_handler;
 
 	imx_handler = __init_handler(name, devicefile, flags);
-	imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmc();
+	imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmcboot();
 
 	imx_handler->handler.handler = imx_bbu_internal_mmcboot_update;
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2021-08-26 16:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 16:57 Ahmad Fatoum [this message]
2021-09-05 14:00 ` Ahmad Fatoum

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=20210826165718.1905-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lst@pengutronix.de \
    --cc=rcz@pegutronix.de \
    --cc=ukl@pengutronix.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