2 * Copyright 2014 Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
13 #include <fdt_support.h>
15 #include <fsl_debug_server.h>
16 #include <fsl-mc/fsl_mc.h>
17 #include <environment.h>
19 DECLARE_GLOBAL_DATA_PTR;
23 init_final_memctl_regs();
25 #ifdef CONFIG_ENV_IS_NOWHERE
26 gd->env_addr = (ulong)&default_environment[0];
32 int board_early_init_f(void)
34 init_early_memctl_regs(); /* tighten IFC timing */
39 void detail_board_ddr_info(void)
42 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
44 if (gd->bd->bi_dram[2].size) {
46 print_size(gd->bd->bi_dram[2].size, "");
47 print_ddr_info(CONFIG_DP_DDR_CTRL);
53 gd->ram_size = initdram(0);
60 u32 __iomem *cntcr = (u32 *)CONFIG_SYS_FSL_TIMER_ADDR;
61 u32 __iomem *cltbenr = (u32 *)CONFIG_SYS_FSL_PMU_CLTBENR;
63 /* Enable timebase for all clusters.
64 * It is safe to do so even some clusters are not enabled.
66 out_le32(cltbenr, 0xf);
68 /* Enable clock for timer
69 * This is a global setting.
77 * Board specific reset that is system reset.
79 void reset_cpu(ulong addr)
83 #if defined(CONFIG_ARCH_MISC_INIT)
84 int arch_misc_init(void)
86 #ifdef CONFIG_FSL_DEBUG_SERVER
94 unsigned long get_dram_size_to_hide(void)
96 unsigned long dram_to_hide = 0;
98 /* Carve the Debug Server private DRAM block from the end of DRAM */
99 #ifdef CONFIG_FSL_DEBUG_SERVER
100 dram_to_hide += debug_server_get_dram_block_size();
103 /* Carve the MC private DRAM block from the end of DRAM */
104 #ifdef CONFIG_FSL_MC_ENET
105 dram_to_hide += mc_get_dram_block_size();
111 int board_eth_init(bd_t *bis)
115 #ifdef CONFIG_SMC91111
116 error = smc91111_initialize(0, CONFIG_SMC91111_BASE);
119 #ifdef CONFIG_FSL_MC_ENET
120 error = cpu_eth_init(bis);
125 #ifdef CONFIG_FSL_MC_ENET
126 void fdt_fixup_board_enet(void *fdt)
130 offset = fdt_path_offset(fdt, "/fsl-mc");
133 * TODO: Remove this when backward compatibility
134 * with old DT node (fsl,dprc@0) is no longer needed.
137 offset = fdt_path_offset(fdt, "/fsl,dprc@0");
140 printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
145 if (get_mc_boot_status() == 0)
146 fdt_status_okay(fdt, offset);
148 fdt_status_fail(fdt, offset);
152 #ifdef CONFIG_OF_BOARD_SETUP
153 int ft_board_setup(void *blob, bd_t *bd)
158 ft_cpu_setup(blob, bd);
160 /* limit the memory size to bank 1 until Linux can handle 40-bit PA */
161 base = getenv_bootm_low();
162 size = getenv_bootm_size();
163 fdt_fixup_memory(blob, (u64)base, (u64)size);
165 #ifdef CONFIG_FSL_MC_ENET
166 fdt_fixup_board_enet(blob);