blob: e277040bb4c45bf28d2253eaf5336c3b58b7b1d1 [file] [log] [blame]
Jon Loeliger84640c92008-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 Bruced1cb6cb2008-11-03 15:44:01 -060012#include "mp.h"
13
14DECLARE_GLOBAL_DATA_PTR;
Jon Loeliger84640c92008-02-18 14:01:56 -060015
Trent Piephobc424c92008-12-03 15:16:38 -080016DECLARE_GLOBAL_DATA_PTR;
17
Jon Loeliger84640c92008-02-18 14:01:56 -060018void ft_cpu_setup(void *blob, bd_t *bd)
19{
Becky Bruced1cb6cb2008-11-03 15:44:01 -060020#if (CONFIG_NUM_CPUS > 1)
21 int off;
22 u32 bootpg;
23#endif
24
Jon Loeliger84640c92008-02-18 14:01:56 -060025 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
26 "timebase-frequency", bd->bi_busfreq / 4, 1);
27 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
28 "bus-frequency", bd->bi_busfreq, 1);
29 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
30 "clock-frequency", bd->bi_intfreq, 1);
31 do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
32 "bus-frequency", bd->bi_busfreq, 1);
33
Trent Piephobc424c92008-12-03 15:16:38 -080034#if defined(CONFIG_MPC8641)
35 do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
36 "bus-frequency", gd->lbc_clk, 1);
37#endif
38 do_fixup_by_compat_u32(blob, "fsl,elbc",
39 "bus-frequency", gd->lbc_clk, 1);
40
Jon Loeliger84640c92008-02-18 14:01:56 -060041 fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
42
43#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
44 || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
Kumar Galafabda922008-08-19 15:41:18 -050045 fdt_fixup_ethernet(blob);
Jon Loeliger84640c92008-02-18 14:01:56 -060046#endif
47
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020048#ifdef CONFIG_SYS_NS16550
Jon Loeliger84640c92008-02-18 14:01:56 -060049 do_fixup_by_compat_u32(blob, "ns16550",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020050 "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
Jon Loeliger84640c92008-02-18 14:01:56 -060051#endif
Becky Bruced1cb6cb2008-11-03 15:44:01 -060052
53#if (CONFIG_NUM_CPUS > 1)
54 /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
55 if (gd->ram_size > 0xfffff000)
56 bootpg = 0xfff00000;
57 else
58 bootpg = gd->ram_size - (1024 * 1024);
59
60 /* Reserve the boot page so OSes dont use it */
61 off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
62 if (off < 0)
63 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
64#endif
Jon Loeliger84640c92008-02-18 14:01:56 -060065}