xref: /rk3399_rockchip-uboot/arch/powerpc/cpu/mpc86xx/fdt.c (revision 0e00a84cdedf7a1949486746225b35984b351eca)
1a47a12beSStefan Roese /*
256551362SKumar Gala  * Copyright 2008, 2011 Freescale Semiconductor, Inc.
3a47a12beSStefan Roese  *
45b8031ccSTom Rini  * SPDX-License-Identifier:	GPL-2.0
5a47a12beSStefan Roese  */
6a47a12beSStefan Roese 
7a47a12beSStefan Roese #include <common.h>
8*0e00a84cSMasahiro Yamada #include <linux/libfdt.h>
9a47a12beSStefan Roese #include <fdt_support.h>
10a47a12beSStefan Roese #include <asm/mp.h>
11a47a12beSStefan Roese 
12a47a12beSStefan Roese DECLARE_GLOBAL_DATA_PTR;
13a47a12beSStefan Roese 
14a47a12beSStefan Roese extern void ft_fixup_num_cores(void *blob);
1556551362SKumar Gala extern void ft_srio_setup(void *blob);
16a47a12beSStefan Roese 
ft_cpu_setup(void * blob,bd_t * bd)17a47a12beSStefan Roese void ft_cpu_setup(void *blob, bd_t *bd)
18a47a12beSStefan Roese {
19a47a12beSStefan Roese #ifdef CONFIG_MP
20a47a12beSStefan Roese 	int off;
21eb539412SYork Sun 	u32 bootpg = determine_mp_bootpg(NULL);
22a47a12beSStefan Roese #endif
23a47a12beSStefan Roese 
24a47a12beSStefan Roese 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
25a47a12beSStefan Roese 			     "timebase-frequency", bd->bi_busfreq / 4, 1);
26a47a12beSStefan Roese 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
27a47a12beSStefan Roese 			     "bus-frequency", bd->bi_busfreq, 1);
28a47a12beSStefan Roese 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
29a47a12beSStefan Roese 			     "clock-frequency", bd->bi_intfreq, 1);
30a47a12beSStefan Roese 	do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
31a47a12beSStefan Roese 			     "bus-frequency", bd->bi_busfreq, 1);
32a47a12beSStefan Roese 
33a47a12beSStefan Roese 	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
34a47a12beSStefan Roese 
35a47a12beSStefan Roese #ifdef CONFIG_SYS_NS16550
36a47a12beSStefan Roese 	do_fixup_by_compat_u32(blob, "ns16550",
37a47a12beSStefan Roese 			       "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
38a47a12beSStefan Roese #endif
39a47a12beSStefan Roese 
40a47a12beSStefan Roese #ifdef CONFIG_MP
41a47a12beSStefan Roese 	/* Reserve the boot page so OSes dont use it */
42a47a12beSStefan Roese 	off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
43a47a12beSStefan Roese 	if (off < 0)
44a47a12beSStefan Roese 		printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
458f3a7fa4SKumar Gala 
46a47a12beSStefan Roese 	ft_fixup_num_cores(blob);
478f3a7fa4SKumar Gala #endif
4856551362SKumar Gala 
4956551362SKumar Gala #ifdef CONFIG_SYS_SRIO
5056551362SKumar Gala 	ft_srio_setup(blob);
5156551362SKumar Gala #endif
52a47a12beSStefan Roese }
53