mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration
@ 2026-05-11 13:32 Fabian Pflug
  2026-05-11 13:32 ` [PATCH v2 1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader Fabian Pflug
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabian Pflug @ 2026-05-11 13:32 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Fabian Pflug, Ahmad Fatoum

Configure the riotboard to use the default OP-TEE implementation
provided by the generic i.MX6 OP-TEE firmware target.

Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
---
Changes in v2:
- renamed uart_setup to continue_imx6s_riotboard
- move imx6q_barebox_entry into continue_imx62_riotboard
- Add reviewed by for first patch
- Link to v1: https://lore.barebox.org/barebox/20260508-v2025-11-0-topic-riotboard-v1-0-42e6134c3de6@pengutronix.de

---
Fabian Pflug (2):
      ARM: i.MX: riotboard: add tzasc.h to flashheader
      ARM: i.MX: riotboard: switch to imx6q_barebox_entry

 .../flash-header-embest-riotboard.imxcfg           |  1 +
 arch/arm/boards/embest-riotboard/lowlevel.c        | 35 ++++++++++++++--------
 2 files changed, 23 insertions(+), 13 deletions(-)
---
base-commit: 1d386a53086d28a0c4eda138ae9408a418b97b7e
change-id: 20251216-v2025-11-0-topic-riotboard-e4d47d428af5

Best regards,
-- 
Fabian Pflug <f.pflug@pengutronix.de>




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

* [PATCH v2 1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader
  2026-05-11 13:32 [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Fabian Pflug
@ 2026-05-11 13:32 ` Fabian Pflug
  2026-05-11 13:32 ` [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry Fabian Pflug
  2026-05-12  6:23 ` [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Sascha Hauer
  2 siblings, 0 replies; 6+ messages in thread
From: Fabian Pflug @ 2026-05-11 13:32 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Fabian Pflug, Ahmad Fatoum

Even though the riotboard is a i.MX6S, the flashheader is the same for
QDLS variants. It allows to integrate OP-TEE and does not hinder in
normal operation.

Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/embest-riotboard/flash-header-embest-riotboard.imxcfg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boards/embest-riotboard/flash-header-embest-riotboard.imxcfg b/arch/arm/boards/embest-riotboard/flash-header-embest-riotboard.imxcfg
index 1f27163417..335f5033ce 100644
--- a/arch/arm/boards/embest-riotboard/flash-header-embest-riotboard.imxcfg
+++ b/arch/arm/boards/embest-riotboard/flash-header-embest-riotboard.imxcfg
@@ -67,4 +67,5 @@ wm 32 MX6_MMDC_P0_MDPDC 0x00025565
 wm 32 MX6_MMDC_P0_MAPSR 0x00011006
 wm 32 MX6_MMDC_P0_MDSCR 0x00000000
 
+#include <mach/imx/imx6q-tzasc.h>
 #include <mach/imx/habv4-imx6-gencsf.h>

-- 
2.47.3




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

* [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry
  2026-05-11 13:32 [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Fabian Pflug
  2026-05-11 13:32 ` [PATCH v2 1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader Fabian Pflug
@ 2026-05-11 13:32 ` Fabian Pflug
  2026-05-11 13:48   ` Ahmad Fatoum
  2026-05-12  6:23 ` [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Sascha Hauer
  2 siblings, 1 reply; 6+ messages in thread
From: Fabian Pflug @ 2026-05-11 13:32 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Fabian Pflug

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.
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 | 35 ++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boards/embest-riotboard/lowlevel.c b/arch/arm/boards/embest-riotboard/lowlevel.c
index f1b37c2aa0..16374d05fe 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 continue_imx6s_riotboard(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);
+	imx6q_barebox_entry(__dtb_imx6s_riotboard_start);
+}
+
+ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
+{
+	imx6_cpu_lowlevel_init();
+
+	relocate_to_current_adr();
+	setup_c();
+
+	continue_imx6s_riotboard();
 }

-- 
2.47.3




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

* Re: [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry
  2026-05-11 13:32 ` [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry Fabian Pflug
@ 2026-05-11 13:48   ` Ahmad Fatoum
  2026-05-12  6:24     ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Ahmad Fatoum @ 2026-05-11 13:48 UTC (permalink / raw)
  To: Fabian Pflug, Sascha Hauer, BAREBOX

Hi,

On 5/11/26 3:32 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.
> 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>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Minor comment below:

> -ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
> +static noinline void continue_imx6s_riotboard(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)) {

This if claude can be removed.

> -		/*
> -		 * 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));

This is useful to have independently of DEBUG_LL

> +		putc_ll('>');

This is already a no-op if !IS_ENABLED(CONFIG_DEBUG_LL)

Cheers,
Ahmad

>  	}
>  
> -	fdt = __dtb_imx6s_riotboard_start + get_runtime_offset();
> -	barebox_arm_entry(0x10000000, SZ_1G, fdt);
> +	imx6q_barebox_entry(__dtb_imx6s_riotboard_start);
> +}
> +
> +ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
> +{
> +	imx6_cpu_lowlevel_init();
> +
> +	relocate_to_current_adr();
> +	setup_c();
> +
> +	continue_imx6s_riotboard();
>  }
> 

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




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

* Re: [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration
  2026-05-11 13:32 [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Fabian Pflug
  2026-05-11 13:32 ` [PATCH v2 1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader Fabian Pflug
  2026-05-11 13:32 ` [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry Fabian Pflug
@ 2026-05-12  6:23 ` Sascha Hauer
  2 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2026-05-12  6:23 UTC (permalink / raw)
  To: BAREBOX, Fabian Pflug; +Cc: Ahmad Fatoum


On Mon, 11 May 2026 15:32:47 +0200, Fabian Pflug wrote:
> Configure the riotboard to use the default OP-TEE implementation
> provided by the generic i.MX6 OP-TEE firmware target.
> 
> 

Applied, thanks!

[1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader
      https://git.pengutronix.de/cgit/barebox/commit/?id=3761fe242bc2 (link may not be stable)
[2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry
      https://git.pengutronix.de/cgit/barebox/commit/?id=8ae77f2dcfea (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

* Re: [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry
  2026-05-11 13:48   ` Ahmad Fatoum
@ 2026-05-12  6:24     ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2026-05-12  6:24 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: BAREBOX, Fabian Pflug

On 2026-05-11 15:48, Ahmad Fatoum wrote:
> Hi,
> 
> On 5/11/26 3:32 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.
> > 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>
> 
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> Minor comment below:
> 
> > -ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
> > +static noinline void continue_imx6s_riotboard(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)) {
> 
> This if claude can be removed.

Fixed while applying.

Sascha

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



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

end of thread, other threads:[~2026-05-12  6:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-11 13:32 [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Fabian Pflug
2026-05-11 13:32 ` [PATCH v2 1/2] ARM: i.MX: riotboard: add tzasc.h to flashheader Fabian Pflug
2026-05-11 13:32 ` [PATCH v2 2/2] ARM: i.MX: riotboard: switch to imx6q_barebox_entry Fabian Pflug
2026-05-11 13:48   ` Ahmad Fatoum
2026-05-12  6:24     ` Sascha Hauer
2026-05-12  6:23 ` [PATCH v2 0/2] ARM: i.MX: riotboard: Add OP-TEE integration Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox