summaryrefslogtreecommitdiffstats
path: root/arch/ppc
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-04-04 14:20:32 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-04-04 14:20:32 +0200
commitc4da77611c7b04778eeba2a153447a81fd3a4c49 (patch)
tree315fd447e2751c331e3931d3691a3b2acc128b83 /arch/ppc
parent70867916a716880b925790bd7fed308d7fd2e112 (diff)
parent90ab1ee199843abd6409be3a5fdf532ce0ff6cc4 (diff)
downloadbarebox-c4da77611c7b04778eeba2a153447a81fd3a4c49.tar.gz
barebox-c4da77611c7b04778eeba2a153447a81fd3a4c49.tar.xz
Merge branch 'for-next/oftree'
Diffstat (limited to 'arch/ppc')
-rw-r--r--arch/ppc/Kconfig1
-rw-r--r--arch/ppc/lib/ppclinux.c8
-rw-r--r--arch/ppc/mach-mpc5xxx/cpu.c26
3 files changed, 27 insertions, 8 deletions
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index d12406522e..db269dd971 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -4,6 +4,7 @@ config PPC
select HAS_KALLSYMS
select HAS_MODULES
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
+ select OFTREE
default y
choice
diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c
index 95dc83bfe5..ef69eadfb7 100644
--- a/arch/ppc/lib/ppclinux.c
+++ b/arch/ppc/lib/ppclinux.c
@@ -18,6 +18,14 @@ static int do_bootm_linux(struct image_data *data)
if (!data->os_res)
return -EINVAL;
+ data->oftree = of_get_fixed_tree(data->of_root_node);
+ if (!data->oftree) {
+ pr_err("bootm: No devicetree given.\n");
+ return -EINVAL;
+ }
+
+ fdt_add_reserve_map(data->oftree);
+
kernel = (void *)(data->os_address + data->os_entry);
/*
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index 5bbd49ab9f..99f16ebf1d 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -77,17 +77,27 @@ void __noreturn reset_cpu (unsigned long addr)
/* ------------------------------------------------------------------------- */
#ifdef CONFIG_OFTREE
-static int of_mpc5200_fixup(struct fdt_header *fdt)
+static int of_mpc5200_fixup(struct device_node *root)
{
- char *cpu_path = "/cpus/PowerPC,5200@0";
+ struct device_node *node;
+
int div = in_8((void*)CFG_MBAR + 0x204) & 0x0020 ? 8 : 4;
- do_fixup_by_path_u32(fdt, cpu_path, "timebase-frequency", get_timebase_clock(), 1);
- do_fixup_by_path_u32(fdt, cpu_path, "bus-frequency", get_bus_clock(), 1);
- do_fixup_by_path_u32(fdt, cpu_path, "clock-frequency", get_cpu_clock(), 1);
- do_fixup_by_path_u32(fdt, "/soc5200@f0000000", "bus-frequency", get_ipb_clock(), 1);
- do_fixup_by_path_u32(fdt, "/soc5200@f0000000", "system-frequency",
- get_bus_clock() * div, 1);
+ node = of_find_node_by_path(root, "/cpus/PowerPC,5200@0");
+ if (!node)
+ return -EINVAL;
+
+ of_property_write_u32(node, "timebase-frequency", get_timebase_clock());
+ of_property_write_u32(node, "bus-frequency", get_bus_clock());
+ of_property_write_u32(node, "clock-frequency", get_cpu_clock());
+
+ node = of_find_node_by_path(root, "/soc5200@f0000000");
+ if (!node)
+ return -EINVAL;
+
+ of_property_write_u32(node, "bus-frequency", get_ipb_clock());
+ of_property_write_u32(node, "system-frequency", get_bus_clock() * div);
+
return 0;
}