mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Andrey Smirnov <andrew.smirnov@gmail.com>,
	Joacim Zetterling <joacim.zetterling@westermo.com>,
	lst@pengutronix.de, Teresa Remmet <t.remmet@phytec.de>
Subject: [PATCH v2 master 2/5] ARM: i.MX8M: esdctl: fix LPDDR4 size calculation for nano
Date: Thu, 23 Jun 2022 15:07:14 +0200	[thread overview]
Message-ID: <20220623130717.1447999-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220623130717.1447999-1-a.fatoum@pengutronix.de>

i.MX8MN has a bus width of 16-bit, not 32-bit, so adjust accordingly.
This fixes RAM size computation of i.MX8MN boards with LPDDR4 memory.

Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Fixes: 7a05a7626d7f ("ARM: i.MX: add i.MX8MN (Nano) SoC support boilerplate")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - new patch, suggested by Lucas. Replaces hacky last patch from v1
---
 arch/arm/mach-imx/esdctl.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 69f4f8df9391..35c9fa9a4248 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -510,6 +510,12 @@ static int imx8m_ddrc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
 			   imx8m_ddrc_sdram_size(mmdcbase, 32));
 }
 
+static int imx8mn_ddrc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
+{
+	return arm_add_mem_device("ram0", data->base0,
+			   imx8m_ddrc_sdram_size(mmdcbase, 16));
+}
+
 static resource_size_t imx7d_ddrc_sdram_size(void __iomem *ddrc)
 {
 	const u32 addrmap[DDRC_ADDRMAP_LENGTH] = {
@@ -645,6 +651,11 @@ static __maybe_unused struct imx_esdctl_data imx8mq_data = {
 	.add_mem = imx8m_ddrc_add_mem,
 };
 
+static __maybe_unused struct imx_esdctl_data imx8mn_data = {
+	.base0 = MX8M_DDR_CSD1_BASE_ADDR,
+	.add_mem = imx8mn_ddrc_add_mem,
+};
+
 static __maybe_unused struct imx_esdctl_data imx7d_data = {
 	.base0 = MX7_DDR_BASE_ADDR,
 	.add_mem = imx7d_ddrc_add_mem,
@@ -719,7 +730,7 @@ static __maybe_unused struct of_device_id imx_esdctl_dt_ids[] = {
 		.data = &imx8mq_data
 	}, {
 		.compatible = "fsl,imx8mn-ddrc",
-		.data = &imx8mq_data
+		.data = &imx8mn_data
 	}, {
 		.compatible = "fsl,imx8mq-ddrc",
 		.data = &imx8mq_data
@@ -931,7 +942,7 @@ void __noreturn imx8mm_barebox_entry(void *boarddata)
 
 void __noreturn imx8mn_barebox_entry(void *boarddata)
 {
-	imx8m_barebox_entry(boarddata, 32);
+	imx8m_barebox_entry(boarddata, 16);
 }
 
 void __noreturn imx8mp_barebox_entry(void *boarddata)
-- 
2.30.2




  parent reply	other threads:[~2022-06-23 13:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 13:07 [PATCH v2 master 0/5] ARM: i.MX8M: fix various miscalculation of DRAM size Ahmad Fatoum
2022-06-23 13:07 ` [PATCH v2 master 1/5] ARM: i.MX8M: refactor to prepare i.MX8MN LPDDR4 support Ahmad Fatoum
2022-06-23 13:07 ` Ahmad Fatoum [this message]
2022-06-23 13:07 ` [PATCH v2 master 3/5] ARM: i.MX8M: esdctl: ignore ADDRMAP8 for non-DDR4 Ahmad Fatoum
2022-06-23 13:07 ` [PATCH v2 master 4/5] ARM: i.MX8MQ: initialize ADDRMAP7 Ahmad Fatoum
2022-06-23 13:07 ` [PATCH v2 master 5/5] ddr: imx8m: workaround old spreadsheets not initializing ADDRMAP7 Ahmad Fatoum
2022-06-27  6:44 ` [PATCH v2 master 0/5] ARM: i.MX8M: fix various miscalculation of DRAM size 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=20220623130717.1447999-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=joacim.zetterling@westermo.com \
    --cc=lst@pengutronix.de \
    --cc=t.remmet@phytec.de \
    /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