]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - cpu/mpc86xx/fdt.c
383b06b5ae61e4bbea0a65d63a5aa0eaa211650e
[karo-tx-uboot.git] / cpu / mpc86xx / fdt.c
1 /*
2  * Copyright 2008 Freescale Semiconductor, Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * Version 2 as published by the Free Software Foundation.
7  */
8
9 #include <common.h>
10 #include <libfdt.h>
11 #include <fdt_support.h>
12 #include "mp.h"
13
14 DECLARE_GLOBAL_DATA_PTR;
15
16 void ft_cpu_setup(void *blob, bd_t *bd)
17 {
18 #if (CONFIG_NUM_CPUS > 1)
19         int off;
20         u32 bootpg;
21 #endif
22
23         do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
24                              "timebase-frequency", bd->bi_busfreq / 4, 1);
25         do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
26                              "bus-frequency", bd->bi_busfreq, 1);
27         do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
28                              "clock-frequency", bd->bi_intfreq, 1);
29         do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
30                              "bus-frequency", bd->bi_busfreq, 1);
31
32 #if defined(CONFIG_MPC8641)
33         do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
34                                "bus-frequency", gd->lbc_clk, 1);
35 #endif
36         do_fixup_by_compat_u32(blob, "fsl,elbc",
37                                "bus-frequency", gd->lbc_clk, 1);
38
39         fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
40
41 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
42     || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
43         fdt_fixup_ethernet(blob);
44 #endif
45
46 #ifdef CONFIG_SYS_NS16550
47         do_fixup_by_compat_u32(blob, "ns16550",
48                                "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
49 #endif
50
51 #if (CONFIG_NUM_CPUS > 1)
52         /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
53         if (gd->ram_size > 0xfffff000)
54                 bootpg = 0xfff00000;
55         else
56                 bootpg = gd->ram_size - (1024 * 1024);
57
58         /* Reserve the boot page so OSes dont use it */
59         off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
60         if (off < 0)
61                 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
62 #endif
63 }