From: Joacim Zetterling <joacim.zetterling@westermo.com>
To: barebox@lists.infradead.org
Cc: a.fatoum@pengutronix.de
Subject: [PATCH 2/4] ARM: imx: Add imx8 support for SDRAM with two or more bank groups
Date: Fri, 25 Feb 2022 15:47:49 +0100 [thread overview]
Message-ID: <20220225144751.4160843-3-joacim.zetterling@westermo.com> (raw)
In-Reply-To: <20220225144751.4160843-1-joacim.zetterling@westermo.com>
Add bank group size to handle SDRAM with two or more bank groups
in one chip. The imx8mn DDR4 has one mem chip with ranks set to 1 and
the number of banks is 4 in 2 groups, total of 8 banks.
We need two add the DDRC_ADDRMAP8 and do a check DDRC_ADDRMAP8_BG_B0
and DDRC_ADDRMAP8_BG_B1 to get the number of bank groups in the chip.
Signed-off-by: Joacim Zetterling <joacim.zetterling@westermo.com>
---
arch/arm/mach-imx/esdctl.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 8e2d9e0c115c..0e11033b81ae 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -346,6 +346,9 @@ static int vf610_ddrmc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
#define DDRC_ADDRMAP7_ROW_B17 GENMASK(11, 8)
#define DDRC_ADDRMAP7_ROW_B16 GENMASK( 3, 0)
+#define DDRC_ADDRMAP8_BG_B1 GENMASK(13, 8)
+#define DDRC_ADDRMAP8_BG_B0 GENMASK(4, 0)
+
static unsigned int
imx_ddrc_count_bits(unsigned int bits, const u8 config[],
unsigned int config_num)
@@ -409,6 +412,13 @@ imx_ddrc_sdram_size(void __iomem *ddrc, const u32 addrmap[],
if (FIELD_GET(DDRC_ADDRMAP1_BANK_B2, addrmap[1]) != 0b11111)
banks++;
+ if (addrmap[8]) {
+ if (FIELD_GET(DDRC_ADDRMAP8_BG_B0, addrmap[8]) != 0b11111)
+ banks++;
+ if (FIELD_GET(DDRC_ADDRMAP8_BG_B1, addrmap[8]) != 0b111111)
+ banks++;
+ }
+
columns = imx_ddrc_count_bits(col_max, col_b, col_b_num);
rows = imx_ddrc_count_bits(row_max, row_b, row_b_num);
--
2.25.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2022-02-25 14:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 14:47 [PATCH 0/4] ARM: imx: Fix problem with imx8 SDRAM size calculation Joacim Zetterling
2022-02-25 14:47 ` [PATCH 1/4] ARM: imx: Add imx8 support for 18 bit SDRAM row size handle Joacim Zetterling
2022-02-25 14:47 ` Joacim Zetterling [this message]
2022-02-25 14:47 ` [PATCH 3/4] ARM: imx: Correct mem size calculation for 4/8/16/32 bit bus width Joacim Zetterling
2022-02-25 14:47 ` [PATCH 4/4] ARM: imx: Correct bit count function Joacim Zetterling
2022-02-28 9:46 ` [PATCH 0/4] ARM: imx: Fix problem with imx8 SDRAM size calculation Sascha Hauer
2022-02-28 10:06 ` 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=20220225144751.4160843-3-joacim.zetterling@westermo.com \
--to=joacim.zetterling@westermo.com \
--cc=a.fatoum@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