[PATCH 1/2] ARM: i.MX8MP: Debix: refactor lowlevel setup functions

Marco Felsch m.felsch at pengutronix.de
Mon Jul 3 16:01:10 PDT 2023


Pass the dram timing info and devicetree data as parameter instead of
hardcode them into the function. The required information is passed by
the ENTRY_FUNCTION after the relocation and the setup_c is done. This
prepares the lowlevel code for adding new boards with minimal effort.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 arch/arm/boards/polyhex-debix/lowlevel.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boards/polyhex-debix/lowlevel.c b/arch/arm/boards/polyhex-debix/lowlevel.c
index 1c8be39559..bb4d6f53a0 100644
--- a/arch/arm/boards/polyhex-debix/lowlevel.c
+++ b/arch/arm/boards/polyhex-debix/lowlevel.c
@@ -83,7 +83,7 @@ static void power_init_board(void)
 
 extern struct dram_timing_info imx8mp_debix_dram_timing;
 
-static void start_atf(void)
+static void start_atf(struct dram_timing_info *dram_timing)
 {
 	/*
 	 * If we are in EL3 we are running for the first time and need to
@@ -95,7 +95,7 @@ static void start_atf(void)
 
 	power_init_board();
 
-	imx8mp_ddr_init(&imx8mp_debix_dram_timing, DRAM_TYPE_LPDDR4);
+	imx8mp_ddr_init(dram_timing, DRAM_TYPE_LPDDR4);
 
 	imx8mp_load_and_start_image_via_tfa();
 }
@@ -116,16 +116,17 @@ static void start_atf(void)
  *
  * 4. Standard barebox boot flow continues
  */
-static __noreturn noinline void imx8mp_debix_model_a_start(void)
+static __noreturn noinline void
+imx8mp_debix_start(struct dram_timing_info *dram_timing, void *dtb)
 {
 	setup_uart();
 
-	start_atf();
+	start_atf(dram_timing);
 
 	/*
 	 * Standard entry we hit once we initialized both DDR and ATF
 	 */
-	imx8mp_barebox_entry(__dtb_z_imx8mp_debix_model_a_start);
+	imx8mp_barebox_entry(dtb);
 }
 
 ENTRY_FUNCTION(start_polyhex_debix, r0, r1, r2)
@@ -135,5 +136,6 @@ ENTRY_FUNCTION(start_polyhex_debix, r0, r1, r2)
 	relocate_to_current_adr();
 	setup_c();
 
-	imx8mp_debix_model_a_start();
+	imx8mp_debix_start(&imx8mp_debix_dram_timing,
+			   __dtb_z_imx8mp_debix_model_a_start);
 }
-- 
2.39.2




More information about the barebox mailing list