2 * Copyright 2014 Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
13 #include <fdt_support.h>
15 #include <fsl-mc/fsl_mc.h>
16 #include <environment.h>
18 DECLARE_GLOBAL_DATA_PTR;
22 init_final_memctl_regs();
24 #ifdef CONFIG_ENV_IS_NOWHERE
25 gd->env_addr = (ulong)&default_environment[0];
31 int board_early_init_f(void)
33 init_early_memctl_regs(); /* tighten IFC timing */
38 void detail_board_ddr_info(void)
41 print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
43 if (gd->bd->bi_dram[2].size) {
45 print_size(gd->bd->bi_dram[2].size, "");
46 print_ddr_info(CONFIG_DP_DDR_CTRL);
52 gd->ram_size = initdram(0);
59 u32 __iomem *cntcr = (u32 *)CONFIG_SYS_FSL_TIMER_ADDR;
60 u32 __iomem *cltbenr = (u32 *)CONFIG_SYS_FSL_PMU_CLTBENR;
62 /* Enable timebase for all clusters.
63 * It is safe to do so even some clusters are not enabled.
65 out_le32(cltbenr, 0xf);
67 /* Enable clock for timer
68 * This is a global setting.
76 * Board specific reset that is system reset.
78 void reset_cpu(ulong addr)
82 int board_eth_init(bd_t *bis)
86 #ifdef CONFIG_SMC91111
87 error = smc91111_initialize(0, CONFIG_SMC91111_BASE);
90 #ifdef CONFIG_FSL_MC_ENET
91 error = cpu_eth_init(bis);
96 #ifdef CONFIG_FSL_MC_ENET
97 void fdt_fixup_board_enet(void *fdt)
101 offset = fdt_path_offset(fdt, "/fsl-mc");
104 * TODO: Remove this when backward compatibility
105 * with old DT node (fsl,dprc@0) is no longer needed.
108 offset = fdt_path_offset(fdt, "/fsl,dprc@0");
111 printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
116 if (get_mc_boot_status() == 0)
117 fdt_status_okay(fdt, offset);
119 fdt_status_fail(fdt, offset);
123 #ifdef CONFIG_OF_BOARD_SETUP
124 int ft_board_setup(void *blob, bd_t *bd)
129 ft_cpu_setup(blob, bd);
131 /* limit the memory size to bank 1 until Linux can handle 40-bit PA */
132 base = getenv_bootm_low();
133 size = getenv_bootm_size();
134 fdt_fixup_memory(blob, (u64)base, (u64)size);
136 #ifdef CONFIG_FSL_MC_ENET
137 fdt_fixup_board_enet(blob);