2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2008-02-18 20:01:56 +00:00
|
|
|
/*
|
2011-01-04 23:07:54 +00:00
|
|
|
* Copyright 2008, 2011 Freescale Semiconductor, Inc.
|
2008-02-18 20:01:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2018-03-04 16:20:11 +00:00
|
|
|
#include <linux/libfdt.h>
|
2008-02-18 20:01:56 +00:00
|
|
|
#include <fdt_support.h>
|
2009-04-01 04:02:38 +00:00
|
|
|
#include <asm/mp.h>
|
2008-11-03 21:44:01 +00:00
|
|
|
|
2020-08-12 11:16:36 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2009-09-02 14:10:36 +00:00
|
|
|
extern void ft_fixup_num_cores(void *blob);
|
2011-01-04 23:07:54 +00:00
|
|
|
extern void ft_srio_setup(void *blob);
|
2009-09-02 14:10:36 +00:00
|
|
|
|
2020-06-26 06:13:33 +00:00
|
|
|
void ft_cpu_setup(void *blob, struct bd_info *bd)
|
2008-02-18 20:01:56 +00:00
|
|
|
{
|
2009-04-01 04:02:38 +00:00
|
|
|
#ifdef CONFIG_MP
|
2008-11-03 21:44:01 +00:00
|
|
|
int off;
|
2012-10-08 07:44:25 +00:00
|
|
|
u32 bootpg = determine_mp_bootpg(NULL);
|
2008-11-03 21:44:01 +00:00
|
|
|
#endif
|
|
|
|
|
2008-02-18 20:01:56 +00: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);
|
|
|
|
|
2020-08-12 11:16:36 +00:00
|
|
|
fdt_fixup_memory(blob, (u64)gd->ram_base, (u64)gd->ram_size);
|
2008-02-18 20:01:56 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#ifdef CONFIG_SYS_NS16550
|
2008-02-18 20:01:56 +00:00
|
|
|
do_fixup_by_compat_u32(blob, "ns16550",
|
2008-10-16 13:01:15 +00:00
|
|
|
"clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
|
2008-02-18 20:01:56 +00:00
|
|
|
#endif
|
2008-11-03 21:44:01 +00:00
|
|
|
|
2009-04-01 04:02:38 +00:00
|
|
|
#ifdef CONFIG_MP
|
2008-11-03 21:44:01 +00: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-10 03:33:53 +00:00
|
|
|
|
2009-09-02 14:10:36 +00:00
|
|
|
ft_fixup_num_cores(blob);
|
2010-06-10 03:33:53 +00:00
|
|
|
#endif
|
2011-01-04 23:07:54 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SYS_SRIO
|
|
|
|
ft_srio_setup(blob);
|
|
|
|
#endif
|
2008-02-18 20:01:56 +00:00
|
|
|
}
|