]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/powerpc/cpu/mpc86xx/fdt.c
Move arch/ppc to arch/powerpc
[people/ms/u-boot.git] / arch / powerpc / cpu / mpc86xx / fdt.c
CommitLineData
13f5433f
JL
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>
7649a590 12#include <asm/mp.h>
1266df88
BB
13
14DECLARE_GLOBAL_DATA_PTR;
13f5433f 15
f8027f6b
PA
16extern void ft_fixup_num_cores(void *blob);
17
13f5433f
JL
18void ft_cpu_setup(void *blob, bd_t *bd)
19{
7649a590 20#ifdef CONFIG_MP
1266df88 21 int off;
7649a590 22 u32 bootpg = determine_mp_bootpg();
1266df88
BB
23#endif
24
13f5433f
JL
25 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
58ec4866
TP
34#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
13f5433f
JL
41 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)
ba37aa03 45 fdt_fixup_ethernet(blob);
13f5433f
JL
46#endif
47
6d0f6bcf 48#ifdef CONFIG_SYS_NS16550
13f5433f 49 do_fixup_by_compat_u32(blob, "ns16550",
6d0f6bcf 50 "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
13f5433f 51#endif
1266df88 52
7649a590 53#ifdef CONFIG_MP
1266df88
BB
54 /* Reserve the boot page so OSes dont use it */
55 off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
56 if (off < 0)
57 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
58#endif
f8027f6b 59 ft_fixup_num_cores(blob);
13f5433f 60}