From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Fabian Pflug <f.pflug@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/2] ARM: i.MX: riotboard: rewrite lowlevel.c
Date: Fri, 8 May 2026 17:02:54 +0200 [thread overview]
Message-ID: <5e35b08e-2230-4783-b6af-0cfd1507e404@pengutronix.de> (raw)
In-Reply-To: <20260508-v2025-11-0-topic-riotboard-v1-2-42e6134c3de6@pengutronix.de>
Hi,
On 5/8/26 4:43 PM, Fabian Pflug wrote:
> Make use of the imx6q_barebox_entry instead of calling
> barebox_arm_entry directly, which allows us to profit from optional
> OP-TEE loading in this function.
maybe change commit message title to
ARM: i.MX: riotboard: switch to imx6q_barebox_entry
?
> Always setup UART, in case OP-TEE gets integrated, which will crash if
> the UART is not configured correctly and debug is enabled.
> Since now a bit more functions are called, we use
> relocate_to_current_adr instead of get_runtime_offset.
>
> This should not change behaviour of current implementations, but makes
> way for OP-TEE implementations.
>
> Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
> ---
> arch/arm/boards/embest-riotboard/lowlevel.c | 37 ++++++++++++++++++-----------
> 1 file changed, 23 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/boards/embest-riotboard/lowlevel.c b/arch/arm/boards/embest-riotboard/lowlevel.c
> index f1b37c2aa0..e44fb3582e 100644
> --- a/arch/arm/boards/embest-riotboard/lowlevel.c
> +++ b/arch/arm/boards/embest-riotboard/lowlevel.c
> @@ -11,26 +11,35 @@
> #include <asm/cache.h>
> #include <asm/mmu.h>
> #include <mach/imx/imx6.h>
> +#include <mach/imx/iomux-mx6.h>
> +#include <mach/imx/esdctl.h>
>
> extern char __dtb_imx6s_riotboard_start[];
>
> -ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
> +static noinline void setup_riotboard_uart(void)
> {
> - void *fdt;
> + void __iomem *iomuxbase = IOMEM(MX6_IOMUXC_BASE_ADDR);
>
> - imx6_cpu_lowlevel_init();
> + writel(0x4, iomuxbase + 0x016c);
> +
> + imx6_ungate_all_peripherals();
> + // if uart ist not set-up, then OP-TEE will fail if debugging is enabled.
> + imx6_uart_setup(IOMEM(MX6_UART2_BASE_ADDR));
>
> if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> - /*
> - * CONFIG_DEBUG_IMX6Q_UART=y
> - * CONFIG_DEBUG_IMX_UART_PORT=2
> - */
> - writel(0x4, 0x020e016c);
> - imx6_ungate_all_peripherals();
> - imx6_uart_setup_ll();
> - putc_ll('a');
> + pbl_set_putc(imx_uart_putc, IOMEM(MX6_UART2_BASE_ADDR));
> + putc_ll('>');
> }
> -
> - fdt = __dtb_imx6s_riotboard_start + get_runtime_offset();
> - barebox_arm_entry(0x10000000, SZ_1G, fdt);
Move
imx6q_barebox_entry(__dtb_imx6s_riotboard_start);
here.
> +}
> +
> +ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
> +{
> + imx6_cpu_lowlevel_init();
> +
> + relocate_to_current_adr();
> + setup_c();
> +
> + setup_riotboard_uart();
Rename to continue_imx6s_riotboard() or similar.
> +
> + imx6q_barebox_entry(__dtb_imx6s_riotboard_start);
Illegal reference to global variable in function that does relocation,
move it into the noinline function above.
Cheers,
Ahmad
> }
>
--
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 |
prev parent reply other threads:[~2026-05-08 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 14:43 [PATCH 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Fabian Pflug
2026-05-08 14:43 ` [PATCH 1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader Fabian Pflug
2026-05-08 14:59 ` Ahmad Fatoum
2026-05-08 14:43 ` [PATCH 2/2] ARM: i.MX: riotboard: rewrite lowlevel.c Fabian Pflug
2026-05-08 15:02 ` Ahmad Fatoum [this message]
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=5e35b08e-2230-4783-b6af-0cfd1507e404@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=f.pflug@pengutronix.de \
--cc=s.hauer@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