All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Andrianov <vitalya@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] keystone2: use detected ddr3a size
Date: Mon, 15 Jun 2015 08:48:01 -0400	[thread overview]
Message-ID: <1434372481-1166-1-git-send-email-vitalya@ti.com> (raw)

KS2 u-boot detects the ddr3a size installed to EVM. The detected size can
be used instead of environment variable. Because the ddr3 configuration is
done before relocation we cannot use a global variable to pass the
ddr3_size to ft_board_setup(). Instead we have to use the global data
structure.

Because KS2 u-boot works in 32 bit address space the existing ram_size
global data filed cannot be used. The maximum, which the get_ram_size()
can detect is 2GB only. This patch creates the ddr3_size filed in the
arch_global_data structure, which is used for that purpose.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
---
 arch/arm/include/asm/global_data.h |  3 +++
 board/ti/ks2_evm/board.c           | 10 +++-------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index bb24f33..c6c0cdf 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -51,6 +51,9 @@ struct arch_global_data {
 #ifdef CONFIG_FSL_LSCH3
 	unsigned long mem2_clk;
 #endif
+#ifdef CONFIG_ARCH_KEYSTONE
+	int	ddr3_size;
+#endif
 };
 
 #include <asm-generic/global_data.h>
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index 8892a28..a5c4b60 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -35,14 +35,12 @@ static struct aemif_config aemif_configs[] = {
 
 int dram_init(void)
 {
-	u32 ddr3_size;
-
-	ddr3_size = ddr3_init();
+	gd->arch.ddr3_size = ddr3_init();
 
 	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
 				    CONFIG_MAX_RAM_BANK_SIZE);
 	aemif_init(ARRAY_SIZE(aemif_configs), aemif_configs);
-	ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE, ddr3_size);
+	ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE, gd->arch.ddr3_size);
 	return 0;
 }
 
@@ -135,9 +133,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 	ddr3a_size = 0;
 	if (lpae) {
-		env = getenv("ddr3a_size");
-		if (env)
-			ddr3a_size = simple_strtol(env, NULL, 10);
+		ddr3a_size = gd->arch.ddr3_size;
 		if ((ddr3a_size != 8) && (ddr3a_size != 4))
 			ddr3a_size = 0;
 	}
-- 
1.9.1

             reply	other threads:[~2015-06-15 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 12:48 Vitaly Andrianov [this message]
2015-06-15 14:17 ` [U-Boot] [PATCH] keystone2: use detected ddr3a size Tom Rini
2015-06-15 16:42   ` Vitaly Andrianov
2015-06-15 16:56     ` York Sun
2015-06-17 17:11       ` Vitaly Andrianov
2015-06-18 15:57     ` Tom Rini
2015-06-23 12:24       ` Vitaly Andrianov
2015-06-23 14:08         ` Tom Rini

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=1434372481-1166-1-git-send-email-vitalya@ti.com \
    --to=vitalya@ti.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.