blob: 3adfad98c6b30a5b7cf8acbeae72c780abd14971 [file] [log] [blame]
Jon Loeliger13f54332008-02-18 14:01:56 -06001/*
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>
Becky Bruce1266df82008-11-03 15:44:01 -060012#include "mp.h"
13
14DECLARE_GLOBAL_DATA_PTR;
Jon Loeliger13f54332008-02-18 14:01:56 -060015
16void ft_cpu_setup(void *blob, bd_t *bd)
17{
Becky Bruce1266df82008-11-03 15:44:01 -060018#if (CONFIG_NUM_CPUS > 1)
19 int off;
20 u32 bootpg;
21#endif
22
Jon Loeliger13f54332008-02-18 14:01:56 -060023 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 fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
33
34#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
35 || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
Kumar Galaba37aa02008-08-19 15:41:18 -050036 fdt_fixup_ethernet(blob);
Jon Loeliger13f54332008-02-18 14:01:56 -060037#endif
38
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020039#ifdef CONFIG_SYS_NS16550
Jon Loeliger13f54332008-02-18 14:01:56 -060040 do_fixup_by_compat_u32(blob, "ns16550",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020041 "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
Jon Loeliger13f54332008-02-18 14:01:56 -060042#endif
Becky Bruce1266df82008-11-03 15:44:01 -060043
44#if (CONFIG_NUM_CPUS > 1)
45 /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
46 if (gd->ram_size > 0xfffff000)
47 bootpg = 0xfff00000;
48 else
49 bootpg = gd->ram_size - (1024 * 1024);
50
51 /* Reserve the boot page so OSes dont use it */
52 off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
53 if (off < 0)
54 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
55#endif
Jon Loeliger13f54332008-02-18 14:01:56 -060056}