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.MX: esdctl: add force_split option to add_mem
Date: Thu, 31 Aug 2023 15:05:48 +0200	[thread overview]
Message-ID: <20230831130549.3357673-1-m.felsch@pengutronix.de> (raw)

Currently add_mem() tries to merge the memory banks if they are
continuous. Add a option to avoid this merge which is not always useful
e.g. for devices with memory > 4G.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/mach-imx/esdctl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 1798ad48e50a..54c62c47338e 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -183,14 +183,14 @@ static inline u64 __imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
 }
 
 static int add_mem(unsigned long base0, unsigned long size0,
-		unsigned long base1, unsigned long size1)
+		   unsigned long base1, unsigned long size1, bool force_split)
 {
 	int ret0 = 0, ret1 = 0;
 
 	debug("%s: cs0 base: 0x%08lx cs0 size: 0x%08lx\n", __func__, base0, size0);
 	debug("%s: cs1 base: 0x%08lx cs1 size: 0x%08lx\n", __func__, base1, size1);
 
-	if (base0 + size0 == base1 && size1 > 0) {
+	if (!force_split && base0 + size0 == base1 && size1 > 0) {
 		/*
 		 * concatenate both chip selects to a single bank
 		 */
@@ -229,13 +229,13 @@ static inline void imx_esdctl_v2_disable_default(void __iomem *esdctlbase)
 static int imx_esdctl_v1_add_mem(void *esdctlbase, struct imx_esdctl_data *data)
 {
 	return add_mem(data->base0, imx_v1_sdram_size(esdctlbase, 0),
-			data->base1, imx_v1_sdram_size(esdctlbase, 1));
+		       data->base1, imx_v1_sdram_size(esdctlbase, 1), false);
 }
 
 static int imx_esdctl_v2_add_mem(void *esdctlbase, struct imx_esdctl_data *data)
 {
 	return add_mem(data->base0, imx_v2_sdram_size(esdctlbase, 0),
-			data->base1, imx_v2_sdram_size(esdctlbase, 1));
+		       data->base1, imx_v2_sdram_size(esdctlbase, 1), false);
 }
 
 static int imx_esdctl_v2_bug_add_mem(void *esdctlbase, struct imx_esdctl_data *data)
@@ -243,19 +243,19 @@ static int imx_esdctl_v2_bug_add_mem(void *esdctlbase, struct imx_esdctl_data *d
 	imx_esdctl_v2_disable_default(esdctlbase);
 
 	return add_mem(data->base0, imx_v2_sdram_size(esdctlbase, 0),
-			data->base1, imx_v2_sdram_size(esdctlbase, 1));
+		       data->base1, imx_v2_sdram_size(esdctlbase, 1), false);
 }
 
 static int imx_esdctl_v3_add_mem(void *esdctlbase, struct imx_esdctl_data *data)
 {
 	return add_mem(data->base0, imx_v3_sdram_size(esdctlbase, 0),
-			data->base1, imx_v3_sdram_size(esdctlbase, 1));
+		       data->base1, imx_v3_sdram_size(esdctlbase, 1), false);
 }
 
 static int imx_esdctl_v4_add_mem(void *esdctlbase, struct imx_esdctl_data *data)
 {
 	return add_mem(data->base0, imx_v4_sdram_size(esdctlbase, 0),
-			data->base1, imx_v4_sdram_size(esdctlbase, 1));
+		       data->base1, imx_v4_sdram_size(esdctlbase, 1), false);
 }
 
 /*
-- 
2.39.2




             reply	other threads:[~2023-08-31 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 13:05 Marco Felsch [this message]
2023-08-31 13:05 ` [PATCH 2/2] ARM: i.MX8M: esdctl: split memory banks for devices with >4G Marco Felsch
2023-08-31 13:58   ` Lucas Stach
2023-08-31 14:30     ` Marco Felsch

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=20230831130549.3357673-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