mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: i.MX8MM EVK: refactor early startup
@ 2025-12-11  8:39 Sascha Hauer
  2025-12-11  8:39 ` [PATCH 2/2] ARM: i.MX8MN " Sascha Hauer
  2025-12-15  9:31 ` [PATCH 1/2] ARM: i.MX8MM " Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-12-11  8:39 UTC (permalink / raw)
  To: Barebox List; +Cc: Marco Felsch

refactor startup a bit to make it more clear:
- Do not call start_atf() when not in EL3 rather than immediately
  returning from the function
- rename start_atf() to nxp_imx8mm_evk_init_early() and call
  nxp_imx8mm_evk_init_early() from nxp_imx8mm_evk_start() directly

This is done in preparation for a series which changes
nxp_imx8mm_evk_init_early() to take a device tree pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mm-evk/lowlevel.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c b/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c
index 881d8285b6..a09caa4904 100644
--- a/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c
+++ b/arch/arm/boards/nxp-imx8mm-evk/lowlevel.c
@@ -95,21 +95,11 @@ static void power_init_board(void)
 
 extern struct dram_timing_info imx8mm_evk_dram_timing;
 
-static void start_atf(void)
+static void nxp_imx8mm_evk_init_early(void)
 {
-	/*
-	 * If we are in EL3 we are running for the first time and need to
-	 * initialize the DRAM and run TF-A (BL31). The TF-A will then jump
-	 * to DRAM in EL2.
-	 */
-	if (current_el() != 3)
-		return;
-
 	imx8mm_early_clock_init();
 	power_init_board();
 	imx8mm_ddr_init(&imx8mm_evk_dram_timing, DRAM_TYPE_LPDDR4);
-
-	imx8mm_load_and_start_image_via_tfa();
 }
 
 /*
@@ -136,7 +126,15 @@ static __noreturn noinline void nxp_imx8mm_evk_start(void)
 
 	setup_uart();
 
-	start_atf();
+	/*
+	 * If we are in EL3 we are running for the first time and need to
+	 * initialize the DRAM and run TF-A (BL31). The TF-A will then jump
+	 * to DRAM in EL2.
+	 */
+	if (current_el() == 3) {
+		nxp_imx8mm_evk_init_early();
+		imx8mm_load_and_start_image_via_tfa();
+	}
 
 	/*
 	 * Standard entry we hit once we initialized both DDR and ATF. I2C pad
-- 
2.47.3




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

* [PATCH 2/2] ARM: i.MX8MN EVK: refactor early startup
  2025-12-11  8:39 [PATCH 1/2] ARM: i.MX8MM EVK: refactor early startup Sascha Hauer
@ 2025-12-11  8:39 ` Sascha Hauer
  2025-12-15  9:31 ` [PATCH 1/2] ARM: i.MX8MM " Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-12-11  8:39 UTC (permalink / raw)
  To: Barebox List; +Cc: Marco Felsch

refactor startup a bit to make it more clear:
- Do not call start_atf() when not in EL3 rather than immediately
  returning from the function
- rename start_atf() to nxp_imx8mn_evk_init_early() and call
  nxp_imx8mn_evk_init_early() from nxp_imx8mn_evk_start() directly

This is done in preparation for a series which changes
nxp_imx8mn_evk_init_early() to take a device tree pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mn-evk/lowlevel.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c b/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c
index a1a501b1d9..93e3ce7a09 100644
--- a/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c
+++ b/arch/arm/boards/nxp-imx8mn-evk/lowlevel.c
@@ -80,18 +80,10 @@ static struct pmic_config bd71837_cfg[] = {
 
 extern struct dram_timing_info imx8mn_evk_ddr4_timing, imx8mn_evk_lpddr4_timing;
 
-static void start_atf(void)
+static void nxp_imx8mn_evk_init_early(void)
 {
 	struct pbl_i2c *i2c;
 
-	/*
-	 * If we are in EL3 we are running for the first time and need to
-	 * initialize the DRAM and run TF-A (BL31). The TF-A will then jump
-	 * to DRAM in EL2.
-	 */
-	if (current_el() != 3)
-		return;
-
 	imx8mn_early_clock_init();
 
 	imx8mn_setup_pad(IMX8MN_PAD_I2C1_SCL__I2C1_SCL);
@@ -108,8 +100,6 @@ static void start_atf(void)
 		pmic_configure(i2c, 0x4b, bd71837_cfg, ARRAY_SIZE(bd71837_cfg));
 		imx8mn_ddr_init(&imx8mn_evk_ddr4_timing, DRAM_TYPE_DDR4);
 	}
-
-	imx8mn_load_and_start_image_via_tfa();
 }
 
 /*
@@ -135,7 +125,15 @@ static __noreturn noinline void nxp_imx8mn_evk_start(void)
 
 	setup_uart();
 
-	start_atf();
+	/*
+	 * If we are in EL3 we are running for the first time and need to
+	 * initialize the DRAM and run TF-A (BL31). The TF-A will then jump
+	 * to DRAM in EL2.
+	 */
+	if (current_el() == 3) {
+		nxp_imx8mn_evk_init_early();
+		imx8mn_load_and_start_image_via_tfa();
+	}
 
 	/* Check if we configured DDR4 in EL3 */
 	if (readl(MX8M_DDRC_CTL_BASE_ADDR) & BIT(4))
-- 
2.47.3




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

* Re: [PATCH 1/2] ARM: i.MX8MM EVK: refactor early startup
  2025-12-11  8:39 [PATCH 1/2] ARM: i.MX8MM EVK: refactor early startup Sascha Hauer
  2025-12-11  8:39 ` [PATCH 2/2] ARM: i.MX8MN " Sascha Hauer
@ 2025-12-15  9:31 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-12-15  9:31 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer; +Cc: Marco Felsch


On Thu, 11 Dec 2025 09:39:24 +0100, Sascha Hauer wrote:
> refactor startup a bit to make it more clear:
> - Do not call start_atf() when not in EL3 rather than immediately
>   returning from the function
> - rename start_atf() to nxp_imx8mm_evk_init_early() and call
>   nxp_imx8mm_evk_init_early() from nxp_imx8mm_evk_start() directly
> 
> This is done in preparation for a series which changes
> nxp_imx8mm_evk_init_early() to take a device tree pointer.
> 
> [...]

Applied, thanks!

[1/2] ARM: i.MX8MM EVK: refactor early startup
      https://git.pengutronix.de/cgit/barebox/commit/?id=7862713c314f (link may not be stable)
[2/2] ARM: i.MX8MN EVK: refactor early startup
      https://git.pengutronix.de/cgit/barebox/commit/?id=ec8cd03194a8 (link may not be stable)

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




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

end of thread, other threads:[~2025-12-15  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-11  8:39 [PATCH 1/2] ARM: i.MX8MM EVK: refactor early startup Sascha Hauer
2025-12-11  8:39 ` [PATCH 2/2] ARM: i.MX8MN " Sascha Hauer
2025-12-15  9:31 ` [PATCH 1/2] ARM: i.MX8MM " Sascha Hauer

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