blob: 61f5110b7d22d533656f146bd2c7206aa06b3e40 [file] [log] [blame]
Jon Loeliger13f54332008-02-18 14:01:56 -06001/*
Kumar Gala56551362011-01-04 17:07:54 -06002 * Copyright 2008, 2011 Freescale Semiconductor, Inc.
Jon Loeliger13f54332008-02-18 14:01:56 -06003 *
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 Gala7649a592009-03-31 23:02:38 -050012#include <asm/mp.h>
Becky Bruce1266df82008-11-03 15:44:01 -060013
14DECLARE_GLOBAL_DATA_PTR;
Jon Loeliger13f54332008-02-18 14:01:56 -060015
Poonam Aggrwalf8027f62009-09-02 19:40:36 +053016extern void ft_fixup_num_cores(void *blob);
Kumar Gala56551362011-01-04 17:07:54 -060017extern void ft_srio_setup(void *blob);
Poonam Aggrwalf8027f62009-09-02 19:40:36 +053018
Jon Loeliger13f54332008-02-18 14:01:56 -060019void ft_cpu_setup(void *blob, bd_t *bd)
20{
Kumar Gala7649a592009-03-31 23:02:38 -050021#ifdef CONFIG_MP
Becky Bruce1266df82008-11-03 15:44:01 -060022 int off;
Kumar Gala7649a592009-03-31 23:02:38 -050023 u32 bootpg = determine_mp_bootpg();
Becky Bruce1266df82008-11-03 15:44:01 -060024#endif
25
Jon Loeliger13f54332008-02-18 14:01:56 -060026 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
27 "timebase-frequency", bd->bi_busfreq / 4, 1);
28 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
29 "bus-frequency", bd->bi_busfreq, 1);
30 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
31 "clock-frequency", bd->bi_intfreq, 1);
32 do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
33 "bus-frequency", bd->bi_busfreq, 1);
34
Trent Piepho58ec4862008-12-03 15:16:38 -080035#if defined(CONFIG_MPC8641)
36 do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
37 "bus-frequency", gd->lbc_clk, 1);
38#endif
39 do_fixup_by_compat_u32(blob, "fsl,elbc",
40 "bus-frequency", gd->lbc_clk, 1);
41
Jon Loeliger13f54332008-02-18 14:01:56 -060042 fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
43
44#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
45 || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
Kumar Galaba37aa02008-08-19 15:41:18 -050046 fdt_fixup_ethernet(blob);
Jon Loeliger13f54332008-02-18 14:01:56 -060047#endif
48
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020049#ifdef CONFIG_SYS_NS16550
Jon Loeliger13f54332008-02-18 14:01:56 -060050 do_fixup_by_compat_u32(blob, "ns16550",
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020051 "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
Jon Loeliger13f54332008-02-18 14:01:56 -060052#endif
Becky Bruce1266df82008-11-03 15:44:01 -060053
Kumar Gala7649a592009-03-31 23:02:38 -050054#ifdef CONFIG_MP
Becky Bruce1266df82008-11-03 15:44:01 -060055 /* Reserve the boot page so OSes dont use it */
56 off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
57 if (off < 0)
58 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
Kumar Gala8f3a7fa2010-06-09 22:33:53 -050059
Poonam Aggrwalf8027f62009-09-02 19:40:36 +053060 ft_fixup_num_cores(blob);
Kumar Gala8f3a7fa2010-06-09 22:33:53 -050061#endif
Kumar Gala56551362011-01-04 17:07:54 -060062
63#ifdef CONFIG_SYS_SRIO
64 ft_srio_setup(blob);
65#endif
Jon Loeliger13f54332008-02-18 14:01:56 -060066}