[PATCH] ARM: i.MX8MP: bbu: use correct offset for eMMC boot partition

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Aug 26 09:57:18 PDT 2021


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 at 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




More information about the barebox mailing list