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>
18 #include <asm/arch-fsl-lsch3/soc.h>
20 DECLARE_GLOBAL_DATA_PTR;
24 init_final_memctl_regs();
26 #ifdef CONFIG_ENV_IS_NOWHERE
27 gd->env_addr = (ulong)&default_environment[0];
33 int board_early_init_f(void)
35 fsl_lsch3_early_init_f();
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);
58 #if defined(CONFIG_ARCH_MISC_INIT)
59 int arch_misc_init(void)
61 #ifdef CONFIG_FSL_DEBUG_SERVER
69 unsigned long get_dram_size_to_hide(void)
71 unsigned long dram_to_hide = 0;
73 /* Carve the Debug Server private DRAM block from the end of DRAM */
74 #ifdef CONFIG_FSL_DEBUG_SERVER
75 dram_to_hide += debug_server_get_dram_block_size();
78 /* Carve the MC private DRAM block from the end of DRAM */
79 #ifdef CONFIG_FSL_MC_ENET
80 dram_to_hide += mc_get_dram_block_size();
83 return roundup(dram_to_hide, CONFIG_SYS_MEM_TOP_HIDE_MIN);
86 int board_eth_init(bd_t *bis)
90 #ifdef CONFIG_SMC91111
91 error = smc91111_initialize(0, CONFIG_SMC91111_BASE);
94 #ifdef CONFIG_FSL_MC_ENET
95 error = cpu_eth_init(bis);
100 #ifdef CONFIG_FSL_MC_ENET
101 void fdt_fixup_board_enet(void *fdt)
105 offset = fdt_path_offset(fdt, "/fsl-mc");
108 * TODO: Remove this when backward compatibility
109 * with old DT node (fsl,dprc@0) is no longer needed.
112 offset = fdt_path_offset(fdt, "/fsl,dprc@0");
115 printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
120 if (get_mc_boot_status() == 0)
121 fdt_status_okay(fdt, offset);
123 fdt_status_fail(fdt, offset);
127 #ifdef CONFIG_OF_BOARD_SETUP
128 int ft_board_setup(void *blob, bd_t *bd)
130 u64 base[CONFIG_NR_DRAM_BANKS];
131 u64 size[CONFIG_NR_DRAM_BANKS];
133 ft_cpu_setup(blob, bd);
135 /* fixup DT for the two GPP DDR banks */
136 base[0] = gd->bd->bi_dram[0].start;
137 size[0] = gd->bd->bi_dram[0].size;
138 base[1] = gd->bd->bi_dram[1].start;
139 size[1] = gd->bd->bi_dram[1].size;
141 fdt_fixup_memory_banks(blob, base, size, 2);
143 #ifdef CONFIG_FSL_MC_ENET
144 fdt_fixup_board_enet(blob);
145 fsl_mc_ldpaa_exit(bd);