2014-06-23 22:15:56 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Freescale Semiconductor
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
#include <common.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <netdev.h>
|
|
|
|
#include <fsl_ifc.h>
|
|
|
|
#include <fsl_ddr.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <fdt_support.h>
|
|
|
|
#include <libfdt.h>
|
2015-03-19 16:20:43 +00:00
|
|
|
#include <fsl_debug_server.h>
|
2015-01-06 21:19:02 +00:00
|
|
|
#include <fsl-mc/fsl_mc.h>
|
2014-07-14 11:45:44 +00:00
|
|
|
#include <environment.h>
|
2015-03-21 02:28:12 +00:00
|
|
|
#include <asm/arch-fsl-lsch3/soc.h>
|
2014-06-23 22:15:56 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
init_final_memctl_regs();
|
2014-07-14 11:45:44 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_ENV_IS_NOWHERE
|
|
|
|
gd->env_addr = (ulong)&default_environment[0];
|
|
|
|
#endif
|
|
|
|
|
2014-06-23 22:15:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
2015-03-21 02:28:12 +00:00
|
|
|
fsl_lsch3_early_init_f();
|
2014-06-23 22:15:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-13 17:21:05 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-23 22:15:56 +00:00
|
|
|
int dram_init(void)
|
|
|
|
{
|
|
|
|
gd->ram_size = initdram(0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-03-19 16:20:43 +00:00
|
|
|
#if defined(CONFIG_ARCH_MISC_INIT)
|
|
|
|
int arch_misc_init(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_FSL_DEBUG_SERVER
|
|
|
|
debug_server_init();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-06-23 22:15:56 +00:00
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMC91111
|
|
|
|
error = smc91111_initialize(0, CONFIG_SMC91111_BASE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_FSL_MC_ENET
|
|
|
|
error = cpu_eth_init(bis);
|
|
|
|
#endif
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_FSL_MC_ENET
|
|
|
|
void fdt_fixup_board_enet(void *fdt)
|
|
|
|
{
|
|
|
|
int offset;
|
|
|
|
|
2015-01-06 21:19:02 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-06-23 22:15:56 +00:00
|
|
|
if (get_mc_boot_status() == 0)
|
|
|
|
fdt_status_okay(fdt, offset);
|
|
|
|
else
|
|
|
|
fdt_status_fail(fdt, offset);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_OF_BOARD_SETUP
|
2014-10-24 00:58:47 +00:00
|
|
|
int ft_board_setup(void *blob, bd_t *bd)
|
2014-06-23 22:15:56 +00:00
|
|
|
{
|
|
|
|
phys_addr_t base;
|
|
|
|
phys_size_t size;
|
|
|
|
|
2014-09-08 19:20:01 +00:00
|
|
|
ft_cpu_setup(blob, bd);
|
|
|
|
|
2014-06-23 22:15:56 +00:00
|
|
|
/* limit the memory size to bank 1 until Linux can handle 40-bit PA */
|
|
|
|
base = getenv_bootm_low();
|
|
|
|
size = getenv_bootm_size();
|
|
|
|
fdt_fixup_memory(blob, (u64)base, (u64)size);
|
|
|
|
|
|
|
|
#ifdef CONFIG_FSL_MC_ENET
|
|
|
|
fdt_fixup_board_enet(blob);
|
2015-03-19 16:20:45 +00:00
|
|
|
fsl_mc_ldpaa_exit(bd);
|
2014-06-23 22:15:56 +00:00
|
|
|
#endif
|
2014-10-24 00:58:47 +00:00
|
|
|
|
|
|
|
return 0;
|
2014-06-23 22:15:56 +00:00
|
|
|
}
|
|
|
|
#endif
|