Merge branch 'master' of git://www.denx.de/git/u-boot-socfpga
[oweals/u-boot.git] / board / freescale / ls2085a / ls2085a.c
index d19f692e07aa1c186b006a1b05f787f8f0d138ff..dd0acf23b23a9d42138a71d266a5ad4a9e44b169 100644 (file)
 #include <asm/io.h>
 #include <fdt_support.h>
 #include <libfdt.h>
-#include <fsl_mc.h>
+#include <fsl_debug_server.h>
+#include <fsl-mc/fsl_mc.h>
 #include <environment.h>
+#include <asm/arch-fsl-lsch3/soc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,35 +32,55 @@ int board_init(void)
 
 int board_early_init_f(void)
 {
-       init_early_memctl_regs();       /* tighten IFC timing */
-
+       fsl_lsch3_early_init_f();
        return 0;
 }
 
+void detail_board_ddr_info(void)
+{
+       puts("\nDDR    ");
+       print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
+       print_ddr_info(0);
+       if (gd->bd->bi_dram[2].size) {
+               puts("\nDP-DDR ");
+               print_size(gd->bd->bi_dram[2].size, "");
+               print_ddr_info(CONFIG_DP_DDR_CTRL);
+       }
+}
+
 int dram_init(void)
 {
-       printf("DRAM:  ");
        gd->ram_size = initdram(0);
 
        return 0;
 }
 
-int timer_init(void)
+#if defined(CONFIG_ARCH_MISC_INIT)
+int arch_misc_init(void)
 {
-       u32 __iomem *cntcr = (u32 *)CONFIG_SYS_FSL_TIMER_ADDR;
-       u32 __iomem *cltbenr = (u32 *)CONFIG_SYS_FSL_PMU_CLTBENR;
-
-       out_le32(cltbenr, 0x1);         /* enable cluster0 timebase */
-       out_le32(cntcr, 0x1);           /* enable clock for timer */
+#ifdef CONFIG_FSL_DEBUG_SERVER
+       debug_server_init();
+#endif
 
        return 0;
 }
+#endif
 
-/*
- * Board specific reset that is system reset.
- */
-void reset_cpu(ulong addr)
+unsigned long get_dram_size_to_hide(void)
 {
+       unsigned long dram_to_hide = 0;
+
+/* Carve the Debug Server private DRAM block from the end of DRAM */
+#ifdef CONFIG_FSL_DEBUG_SERVER
+       dram_to_hide += debug_server_get_dram_block_size();
+#endif
+
+/* Carve the MC private DRAM block from the end of DRAM */
+#ifdef CONFIG_FSL_MC_ENET
+       dram_to_hide += mc_get_dram_block_size();
+#endif
+
+       return dram_to_hide;
 }
 
 int board_eth_init(bd_t *bis)
@@ -80,7 +102,21 @@ void fdt_fixup_board_enet(void *fdt)
 {
        int offset;
 
-       offset = fdt_path_offset(fdt, "/fsl,dprc@0");
+       offset = fdt_path_offset(fdt, "/fsl-mc");
+
+       /*
+        * TODO: Remove this when backward compatibility
+        * with old DT node (fsl,dprc@0) is no longer needed.
+        */
+       if (offset < 0)
+               offset = fdt_path_offset(fdt, "/fsl,dprc@0");
+
+       if (offset < 0) {
+               printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
+                      __func__, offset);
+               return;
+       }
+
        if (get_mc_boot_status() == 0)
                fdt_status_okay(fdt, offset);
        else
@@ -89,11 +125,13 @@ void fdt_fixup_board_enet(void *fdt)
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
        phys_addr_t base;
        phys_size_t size;
 
+       ft_cpu_setup(blob, bd);
+
        /* limit the memory size to bank 1 until Linux can handle 40-bit PA */
        base = getenv_bootm_low();
        size = getenv_bootm_size();
@@ -101,6 +139,9 @@ void ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
        fdt_fixup_board_enet(blob);
+       fsl_mc_ldpaa_exit(bd);
 #endif
+
+       return 0;
 }
 #endif