2008-02-18 14:01:56 -06:00
|
|
|
/*
|
2011-01-04 17:07:54 -06:00
|
|
|
* Copyright 2008, 2011 Freescale Semiconductor, Inc.
|
2008-02-18 14:01:56 -06:00
|
|
|
*
|
2016-01-14 22:05:13 -05:00
|
|
|
* SPDX-License-Identifier: GPL-2.0
|
2008-02-18 14:01:56 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <libfdt.h>
|
|
|
|
#include <fdt_support.h>
|
2009-03-31 23:02:38 -05:00
|
|
|
#include <asm/mp.h>
|
2008-11-03 15:44:01 -06:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
2008-02-18 14:01:56 -06:00
|
|
|
|
2009-09-02 19:40:36 +05:30
|
|
|
extern void ft_fixup_num_cores(void *blob);
|
2011-01-04 17:07:54 -06:00
|
|
|
extern void ft_srio_setup(void *blob);
|
2009-09-02 19:40:36 +05:30
|
|
|
|
2008-02-18 14:01:56 -06:00
|
|
|
void ft_cpu_setup(void *blob, bd_t *bd)
|
|
|
|
{
|
2009-03-31 23:02:38 -05:00
|
|
|
#ifdef CONFIG_MP
|
2008-11-03 15:44:01 -06:00
|
|
|
int off;
|
2012-10-08 07:44:25 +00:00
|
|
|
u32 bootpg = determine_mp_bootpg(NULL);
|
2008-11-03 15:44:01 -06:00
|
|
|
#endif
|
|
|
|
|
2008-02-18 14:01:56 -06:00
|
|
|
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
|
|
|
|
"timebase-frequency", bd->bi_busfreq / 4, 1);
|
|
|
|
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
|
|
|
|
"bus-frequency", bd->bi_busfreq, 1);
|
|
|
|
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
|
|
|
|
"clock-frequency", bd->bi_intfreq, 1);
|
|
|
|
do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
|
|
|
|
"bus-frequency", bd->bi_busfreq, 1);
|
|
|
|
|
|
|
|
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
|
|
|
|
|
|
|
|
#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
|
|
|
|
|| defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
|
2008-08-19 15:41:18 -05:00
|
|
|
fdt_fixup_ethernet(blob);
|
2008-02-18 14:01:56 -06:00
|
|
|
#endif
|
|
|
|
|
2008-10-16 15:01:15 +02:00
|
|
|
#ifdef CONFIG_SYS_NS16550
|
2008-02-18 14:01:56 -06:00
|
|
|
do_fixup_by_compat_u32(blob, "ns16550",
|
2008-10-16 15:01:15 +02:00
|
|
|
"clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
|
2008-02-18 14:01:56 -06:00
|
|
|
#endif
|
2008-11-03 15:44:01 -06:00
|
|
|
|
2009-03-31 23:02:38 -05:00
|
|
|
#ifdef CONFIG_MP
|
2008-11-03 15:44:01 -06:00
|
|
|
/* Reserve the boot page so OSes dont use it */
|
|
|
|
off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
|
|
|
|
if (off < 0)
|
|
|
|
printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
|
2010-06-09 22:33:53 -05:00
|
|
|
|
2009-09-02 19:40:36 +05:30
|
|
|
ft_fixup_num_cores(blob);
|
2010-06-09 22:33:53 -05:00
|
|
|
#endif
|
2011-01-04 17:07:54 -06:00
|
|
|
|
|
|
|
#ifdef CONFIG_SYS_SRIO
|
|
|
|
ft_srio_setup(blob);
|
|
|
|
#endif
|
2008-02-18 14:01:56 -06:00
|
|
|
}
|