blob: a36ee30c3f0d1b8196378bb8d4af5af53b16923e [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>
Kumar Gala56d150e2009-03-31 23:02:38 -050012#include <asm/mp.h>
Becky Bruced1cb6cb2008-11-03 15:44:01 -060013
14DECLARE_GLOBAL_DATA_PTR;
Jon Loeliger84640c92008-02-18 14:01:56 -060015
16void ft_cpu_setup(void *blob, bd_t *bd)
17{
Kumar Gala56d150e2009-03-31 23:02:38 -050018#ifdef CONFIG_MP
Becky Bruced1cb6cb2008-11-03 15:44:01 -060019 int off;
Kumar Gala56d150e2009-03-31 23:02:38 -050020 u32 bootpg = determine_mp_bootpg();
Becky Bruced1cb6cb2008-11-03 15:44:01 -060021#endif
22
Jon Loeliger84640c92008-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
Trent Piephobc424c92008-12-03 15:16:38 -080032#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
Jon Loeliger84640c92008-02-18 14:01:56 -060039 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)
Kumar Galafabda922008-08-19 15:41:18 -050043 fdt_fixup_ethernet(blob);
Jon Loeliger84640c92008-02-18 14:01:56 -060044#endif
45
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020046#ifdef CONFIG_SYS_NS16550
Jon Loeliger84640c92008-02-18 14:01:56 -060047 do_fixup_by_compat_u32(blob, "ns16550",
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020048 "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
Jon Loeliger84640c92008-02-18 14:01:56 -060049#endif
Becky Bruced1cb6cb2008-11-03 15:44:01 -060050
Kumar Gala56d150e2009-03-31 23:02:38 -050051#ifdef CONFIG_MP
Becky Bruced1cb6cb2008-11-03 15:44:01 -060052 /* Reserve the boot page so OSes dont use it */
53 off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
54 if (off < 0)
55 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
56#endif
Jon Loeliger84640c92008-02-18 14:01:56 -060057}