All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] keystone2: use detected ddr3a size
@ 2015-06-15 12:48 Vitaly Andrianov
  2015-06-15 14:17 ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Vitaly Andrianov @ 2015-06-15 12:48 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-23 14:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15 12:48 [U-Boot] [PATCH] keystone2: use detected ddr3a size Vitaly Andrianov
2015-06-15 14:17 ` 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

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.