blob: afcb9740685770a00cc6b30b222078fd2bd710a7 [file] [log] [blame]
Stefan Roese4f14ed62007-10-05 17:07:50 +02001/*
2 * (C) Copyright 2007
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
Stefan Roese4f14ed62007-10-05 17:07:50 +020024#include <common.h>
25#include <watchdog.h>
26#include <command.h>
27#include <asm/cache.h>
28#include <ppc4xx.h>
29
30#if defined(CONFIG_OF_LIBFDT)
31#include <libfdt.h>
32#include <libfdt_env.h>
Stefan Roese13628882007-12-13 14:52:53 +010033#include <fdt_support.h>
Stefan Roese4f14ed62007-10-05 17:07:50 +020034
Stefan Roesef10493c2007-10-23 11:31:05 +020035DECLARE_GLOBAL_DATA_PTR;
36
Stefan Roese4f14ed62007-10-05 17:07:50 +020037void ft_cpu_setup(void *blob, bd_t *bd)
38{
Stefan Roese4f14ed62007-10-05 17:07:50 +020039 sys_info_t sys_info;
Stefan Roese4f14ed62007-10-05 17:07:50 +020040
Stefan Roese13628882007-12-13 14:52:53 +010041 get_sys_info(&sys_info);
Stefan Roese4f14ed62007-10-05 17:07:50 +020042
Stefan Roese328a3402007-12-18 08:44:51 +010043 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, "timebase-frequency",
44 bd->bi_intfreq, 1);
45 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, "clock-frequency",
46 bd->bi_intfreq, 1);
Stefan Roese13628882007-12-13 14:52:53 +010047 do_fixup_by_path_u32(blob, "/plb", "clock-frequency", sys_info.freqPLB, 1);
48 do_fixup_by_path_u32(blob, "/plb/opb", "clock-frequency", sys_info.freqOPB, 1);
49 do_fixup_by_path_u32(blob, "/plb/opb/ebc", "clock-frequency",
50 sys_info.freqEBC, 1);
51 fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
Stefan Roese4f14ed62007-10-05 17:07:50 +020052
53 /*
54 * Setup all baudrates for the UARTs
55 */
Stefan Roese13628882007-12-13 14:52:53 +010056 do_fixup_by_compat_u32(blob, "ns16550", "clock-frequency", gd->uart_clk, 1);
Stefan Roese4f14ed62007-10-05 17:07:50 +020057
Stefan Roese4f14ed62007-10-05 17:07:50 +020058 /*
Stefan Roese871e6ce2007-12-14 08:41:29 +010059 * Fixup all ethernet nodes
60 * Note: aliases in the dts are required for this
Stefan Roese4f14ed62007-10-05 17:07:50 +020061 */
Stefan Roese13628882007-12-13 14:52:53 +010062 fdt_fixup_ethernet(blob, bd);
Stefan Roese4f14ed62007-10-05 17:07:50 +020063}
64#endif /* CONFIG_OF_LIBFDT */