mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/7] ARM: i.MX93: add imx93_barebox_entry()
Date: Fri, 19 Jan 2024 15:24:10 +0100	[thread overview]
Message-ID: <20240119142413.3206832-5-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240119142413.3206832-1-s.hauer@pengutronix.de>

We already have support for detecting the DDR size automatically on
i.MX93. Create imx93_barebox_entry() from it and use it instead of
the hardcoded DDR size in the tqmba9xxxca board.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/tqmba9xxxca/lowlevel.c |  4 +++-
 arch/arm/mach-imx/esdctl.c             | 15 ++++++++++++---
 include/mach/imx/esdctl.h              |  1 +
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/tqmba9xxxca/lowlevel.c b/arch/arm/boards/tqmba9xxxca/lowlevel.c
index 0a57d02451..64913b8de9 100644
--- a/arch/arm/boards/tqmba9xxxca/lowlevel.c
+++ b/arch/arm/boards/tqmba9xxxca/lowlevel.c
@@ -4,11 +4,13 @@
 #include <debug_ll.h>
 #include <mach/imx/debug_ll.h>
 #include <mach/imx/generic.h>
+#include <mach/imx/xload.h>
 #include <asm/barebox-arm.h>
 #include <soc/imx9/ddr.h>
 #include <mach/imx/atf.h>
 #include <mach/imx/xload.h>
 #include <mach/imx/romapi.h>
+#include <mach/imx/esdctl.h>
 
 extern char __dtb_z_imx93_tqma9352_mba93xxca_start[];
 extern struct dram_timing_info tqma93xxca_dram_timing;
@@ -29,7 +31,7 @@ static noinline void tqma9352_mba93xxca_continue(void)
 		imx93_load_and_start_image_via_tfa();
 	}
 
-	barebox_arm_entry(0x80000000, 0x40000000, __dtb_z_imx93_tqma9352_mba93xxca_start);
+	imx93_barebox_entry(__dtb_z_imx93_tqma9352_mba93xxca_start);
 }
 
 ENTRY_FUNCTION(start_imx93_tqma9352_mba93xxca, r0, r1, r2)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 1bd22cc6ef..2dc858c87f 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -563,7 +563,7 @@ static int imx8mn_ddrc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
 #define IMX9_DDRC_CS_COL_BITS	GENMASK(2, 0)
 #define IMX9_DDRC_CS_EN		BIT(31)
 
-static int imx9_ddrc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
+static resource_size_t imx9_ddrc_sdram_size(void __iomem *mmdcbase)
 {
 	int width = 2;
 	int banks = 8;
@@ -588,7 +588,12 @@ static int imx9_ddrc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
 		mem += memory_sdram_size(cols, rows, banks, width);
 	}
 
-	return arm_add_mem_device("ram0", data->base0, mem);
+	return mem;
+}
+
+static int imx9_ddrc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
+{
+	return arm_add_mem_device("ram0", data->base0, imx9_ddrc_sdram_size(mmdcbase));
 }
 
 static resource_size_t imx7d_ddrc_sdram_size(void __iomem *ddrc)
@@ -1039,4 +1044,8 @@ void __noreturn imx7d_barebox_entry(void *boarddata)
 			  boarddata);
 }
 
-
+void __noreturn imx93_barebox_entry(void *boarddata)
+{
+	barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR,
+			  imx9_ddrc_sdram_size(IOMEM(MX9_DDR_CTL_BASE)), boarddata);
+}
diff --git a/include/mach/imx/esdctl.h b/include/mach/imx/esdctl.h
index 01533478cc..4898a3e682 100644
--- a/include/mach/imx/esdctl.h
+++ b/include/mach/imx/esdctl.h
@@ -148,6 +148,7 @@ void __noreturn imx8mn_barebox_entry(void *boarddata);
 void __noreturn imx8mp_barebox_entry(void *boarddata);
 void __noreturn imx8mq_barebox_entry(void *boarddata);
 void __noreturn imx7d_barebox_entry(void *boarddata);
+void __noreturn imx93_barebox_entry(void *boarddata);
 #define imx6sx_barebox_entry(boarddata) imx6ul_barebox_entry(boarddata)
 void imx_esdctl_disable(void);
 resource_size_t imx8m_barebox_earlymem_size(unsigned buswidth);
-- 
2.39.2




  parent reply	other threads:[~2024-01-19 14:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 14:24 [PATCH 0/7] ARM: Add i.MX93 OP-TEE support Sascha Hauer
2024-01-19 14:24 ` [PATCH 1/7] firmware: add missing FIRMWARE_IMX8MQ_OPTEE symbol Sascha Hauer
2024-01-19 15:10   ` Marco Felsch
2024-01-19 14:24 ` [PATCH 2/7] firmware: add missing include Sascha Hauer
2024-01-19 15:11   ` Marco Felsch
2024-01-19 14:24 ` [PATCH 3/7] firmware: i.MX OP-TEE: Add some Kconfig help Sascha Hauer
2024-01-19 15:12   ` Marco Felsch
2024-01-19 14:24 ` Sascha Hauer [this message]
2024-01-19 15:21   ` [PATCH 4/7] ARM: i.MX93: add imx93_barebox_entry() Marco Felsch
2024-01-22 10:20     ` Sascha Hauer
2024-01-19 14:24 ` [PATCH 5/7] ARM: i.MX: export imx9_ddrc_sdram_size() Sascha Hauer
2024-01-19 15:21   ` Marco Felsch
2024-01-19 14:24 ` [PATCH 6/7] ARM: i.MX93: add scratch space support Sascha Hauer
2024-01-19 15:23   ` Marco Felsch
2024-01-19 14:24 ` [PATCH 7/7] ARM: i.MX93: Add OP-TEE support Sascha Hauer
2024-01-22 10:15 ` [PATCH 0/7] ARM: Add i.MX93 " 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=20240119142413.3206832-5-s.hauer@pengutronix.de \
    --to=s.hauer@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