Merge tag 'dm-pull-21jul21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
[platform/kernel/u-boot.git] / board / freescale / ls1088a / ddr.c
index 78d573a..995c429 100644 (file)
@@ -6,8 +6,10 @@
 #include <common.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <log.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/clock.h>
+#include <asm/global_data.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -111,7 +113,17 @@ found:
                          DDR_CDR2_VREF_TRAIN_EN | DDR_CDR2_VREF_RANGE_2;
 }
 
+#ifdef CONFIG_TFABOOT
+int fsl_initdram(void)
+{
+       gd->ram_size = tfa_get_dram_size();
+
+       if (!gd->ram_size)
+               gd->ram_size = fsl_ddr_sdram_size();
 
+       return 0;
+}
+#else
 int fsl_initdram(void)
 {
        puts("Initializing DDR....using SPD\n");
@@ -123,3 +135,4 @@ int fsl_initdram(void)
 #endif
        return 0;
 }
+#endif /* CONFIG_TFABOOT */