summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-08-30 13:51:54 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-10-05 09:00:53 +0200
commite27f7b7cb2a6ebfc9c746b5b3070da32b97d9a4e (patch)
tree052a9c769bc822d97018a87ab2c3349e178f1356 /arch
parentf0f1a095ec7d9cdd5f9e771ea74f40945724b778 (diff)
downloadbarebox-e27f7b7cb2a6ebfc9c746b5b3070da32b97d9a4e.tar.gz
barebox-e27f7b7cb2a6ebfc9c746b5b3070da32b97d9a4e.tar.xz
ARM: i.MX8MP: bbu: fix wrong flash header offset for eMMC boot partition
According to the reference manual of the i.MX8MP, 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. Tell barebox_update about this, so it can strip away the first 32K when writing to an eMMC boot partition. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Tested-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Link: https://lore.barebox.org/20210830115156.21907-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/imx-bbu-internal.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 880f8b2496..91e1785d18 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -393,6 +393,18 @@ static unsigned long imx_bbu_flash_header_offset_mmc(void)
return SZ_1K;
}
+static unsigned long imx_bbu_flash_header_offset_mmcboot(unsigned long *flags)
+{
+ /*
+ * i.MX8MP places IVT directly at start of eMMC boot partition. IVT
+ * in eMMC user partition and SD is at 32K offset.
+ */
+ if (cpu_is_mx8mp())
+ *flags |= IMX_BBU_FLAG_PARTITION_STARTS_AT_HEADER;
+
+ 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 =
@@ -606,9 +618,12 @@ static int imx_bbu_internal_mmcboot_register_handler(const char *name,
unsigned long flags)
{
struct imx_internal_bbu_handler *imx_handler;
+ unsigned long flash_header_offset;
+
+ flash_header_offset = imx_bbu_flash_header_offset_mmcboot(&flags);
imx_handler = __init_handler(name, devicefile, flags);
- imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmc();
+ imx_handler->flash_header_offset = flash_header_offset;
imx_handler->handler.handler = imx_bbu_internal_mmcboot_update;