From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Andrianov Date: Mon, 15 Jun 2015 08:48:01 -0400 Subject: [U-Boot] [PATCH] keystone2: use detected ddr3a size Message-ID: <1434372481-1166-1-git-send-email-vitalya@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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 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