mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] ARM: i.MX8MP: Debix: refactor lowlevel setup functions
Date: Tue,  4 Jul 2023 01:01:10 +0200	[thread overview]
Message-ID: <20230703230111.2831022-1-m.felsch@pengutronix.de> (raw)

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




             reply	other threads:[~2023-07-03 23:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 23:01 Marco Felsch [this message]
2023-07-03 23:01 ` [PATCH 2/2] ARM: i.MX8MP: Add DEBIX SOM A and SOM A I/O Board support Marco Felsch
2023-07-04  7:34 ` [PATCH 1/2] ARM: i.MX8MP: Debix: refactor lowlevel setup functions Ahmad Fatoum
2023-07-04  7:52 ` Sascha Hauer

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=20230703230111.2831022-1-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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