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 <[email protected]>
---
 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


Reply via email to