]> git.sur5r.net Git - u-boot/blob - arch/powerpc/cpu/mpc86xx/fdt.c
fsl_ddr: Move DDR config options to driver Kconfig
[u-boot] / arch / powerpc / cpu / mpc86xx / fdt.c
1 /*
2  * Copyright 2008, 2011 Freescale Semiconductor, Inc.
3  *
4  * SPDX-License-Identifier:     GPL-2.0
5  */
6
7 #include <common.h>
8 #include <libfdt.h>
9 #include <fdt_support.h>
10 #include <asm/mp.h>
11
12 DECLARE_GLOBAL_DATA_PTR;
13
14 extern void ft_fixup_num_cores(void *blob);
15 extern void ft_srio_setup(void *blob);
16
17 void ft_cpu_setup(void *blob, bd_t *bd)
18 {
19 #ifdef CONFIG_MP
20         int off;
21         u32 bootpg = determine_mp_bootpg(NULL);
22 #endif
23
24         do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
25                              "timebase-frequency", bd->bi_busfreq / 4, 1);
26         do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
27                              "bus-frequency", bd->bi_busfreq, 1);
28         do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
29                              "clock-frequency", bd->bi_intfreq, 1);
30         do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
31                              "bus-frequency", bd->bi_busfreq, 1);
32
33         fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
34
35 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
36     || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
37         fdt_fixup_ethernet(blob);
38 #endif
39
40 #ifdef CONFIG_SYS_NS16550
41         do_fixup_by_compat_u32(blob, "ns16550",
42                                "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
43 #endif
44
45 #ifdef CONFIG_MP
46         /* Reserve the boot page so OSes dont use it */
47         off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
48         if (off < 0)
49                 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
50
51         ft_fixup_num_cores(blob);
52 #endif
53
54 #ifdef CONFIG_SYS_SRIO
55         ft_srio_setup(blob);
56 #endif
57 }