mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX8MP: bbu: use correct offset for eMMC boot partition
@ 2021-08-26 16:57 Ahmad Fatoum
  2021-09-05 14:00 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-08-26 16:57 UTC (permalink / raw)
  To: barebox; +Cc: lst, ukl, rcz, Ahmad Fatoum

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: i.MX8MP: bbu: use correct offset for eMMC boot partition
  2021-08-26 16:57 [PATCH] ARM: i.MX8MP: bbu: use correct offset for eMMC boot partition Ahmad Fatoum
@ 2021-09-05 14:00 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2021-09-05 14:00 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hello Sascha,

On 26.08.21 18:57, Ahmad Fatoum wrote:
> 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)

please dismiss.
This is superseded by
https://lore.barebox.org/barebox/c4653e6641f43249c0a511b211e0ea08be56afb3.camel@pengutronix.de/T/#t

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


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-05 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 16:57 [PATCH] ARM: i.MX8MP: bbu: use correct offset for eMMC boot partition Ahmad Fatoum
2021-09-05 14:00 ` Ahmad Fatoum

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git