]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: keystone2: use detected ddr3a size
authorVitaly Andrianov <vitalya@ti.com>
Fri, 4 Mar 2016 16:36:43 +0000 (10:36 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 14 Mar 2016 23:18:45 +0000 (19:18 -0400)
Because KS2 u-boot works in 32 bit address space the existing ram_size
global data field cannot be used. The maximum, which the get_ram_size()
can detect is 2GB only. The ft_board_setup() needs the actual ddr3 size
to fix up dtb.

This commit introduces the ddr3_get_size() which uses SPD data to
calculate the ddr3 size. This function replaces the "ddr3_size"
environment variable, which was used to get the SODIMM size.

For platforms, which don't have SODIMM with SPD and ddr3 is populated to
a board a simple ddr3_get_size function that returns ddr3 size has to be
implemented. See hardware-k2l.h

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/mach-keystone/ddr3_spd.c
arch/arm/mach-keystone/include/mach/ddr3.h
arch/arm/mach-keystone/include/mach/hardware-k2l.h
board/ti/ks2_evm/board.c

index e5018c9eb669f3049cca67203538b5714d56aa88..c541886787077cfc17e033cd2e84546b34ffd1c9 100644 (file)
@@ -426,6 +426,16 @@ static int ddr3_read_spd(ddr3_spd_eeprom_t *spd_params)
        return 0;
 }
 
+int ddr3_get_size(void)
+{
+       ddr3_spd_eeprom_t spd_params;
+
+       if (ddr3_read_spd(&spd_params))
+               return 0;
+
+       return ddr3_get_size_in_mb(&spd_params) / 1024;
+}
+
 int ddr3_get_dimm_params_from_spd(struct ddr3_spd_cb *spd_cb)
 {
        struct ddr3_sodimm spd;
index 68d3cb4245e974b7790813ecbf327a01cece1afe..5feffe825b97e6bda43510d5f526fcbfdf050ad5 100644 (file)
@@ -66,5 +66,6 @@ void ddr3_err_reset_workaround(void);
 void ddr3_enable_ecc(u32 base, int test);
 void ddr3_init_ddrphy(u32 base, struct ddr3_phy_config *phy_cfg);
 void ddr3_init_ddremif(u32 base, struct ddr3_emif_config *emif_cfg);
+int ddr3_get_size(void);
 
 #endif
index 4f1197ea923df01a8a02d0660d81912f83e8d602..a59e0713593f496c15eb5a39bbb48755af14622a 100644 (file)
 /* NETCP */
 #define KS2_NETCP_BASE                 0x26000000
 
+#ifndef __ASSEMBLY__
+static inline int ddr3_get_size(void)
+{
+       return 2;
+}
+#endif
+
 #endif /* __ASM_ARCH_HARDWARE_K2L_H */
index 7d1709c880afdc799e7c09f8ef3100c247e4ef33..ca668a7c690230ac00f877938ba12e1437b9eb86 100644 (file)
@@ -146,9 +146,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 = ddr3_get_size();
                if ((ddr3a_size != 8) && (ddr3a_size != 4))
                        ddr3a_size = 0;
        }