common: Move hang() to the same header as panic()
[oweals/u-boot.git] / board / freescale / ls1012ardb / ls1012ardb.c
index 888f8500d4b09f82d134e5ae6037bd7f9c37097c..0f665c7bc68fa94445c14d7c05ab1532ddb5a22b 100644 (file)
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <fdt_support.h>
+#include <hang.h>
 #include <i2c.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
@@ -18,7 +20,7 @@
 #include <mmc.h>
 #include <scsi.h>
 #include <fsl_esdhc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <fsl_mmdc.h>
 #include <netdev.h>
 #include <fsl_sec.h>
@@ -87,8 +89,19 @@ int checkboard(void)
        return 0;
 }
 
+#ifdef CONFIG_TFABOOT
 int dram_init(void)
 {
+       gd->ram_size = tfa_get_dram_size();
+       if (!gd->ram_size)
+               gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+       return 0;
+}
+#else
+int dram_init(void)
+{
+#ifndef CONFIG_TFABOOT
        static const struct fsl_mmdc_info mparam = {
                0x05180000,     /* mdctl */
                0x00030035,     /* mdpdc */
@@ -106,6 +119,7 @@ int dram_init(void)
        };
 
        mmdc_init(&mparam);
+#endif
 
        gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
@@ -115,6 +129,7 @@ int dram_init(void)
 
        return 0;
 }
+#endif
 
 
 int board_early_init_f(void)
@@ -132,7 +147,8 @@ int board_init(void)
         * Set CCI-400 control override register to enable barrier
         * transaction
         */
-       out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
+       if (current_el() == 3)
+               out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
        erratum_a010315();