[PATCH 09/17] bootwrapper: Add dt_set_cpu_clocks().

Scott Wood scottwood at freescale.com
Sat Mar 17 04:28:51 EST 2007


This adds a library function that platform files can call to
set clock-frequency, bus-frequency, and timebase-frequency in
each CPU node.

Signed-off-by: Scott Wood <scottwood at freescale.com>
---
 arch/powerpc/boot/devtree.c |   11 +++++++++++
 arch/powerpc/boot/ops.h     |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 258158e..bfb7dcb 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -230,3 +230,14 @@ void dt_set_memory(u64 start, u64 size, int ncells)
 
 	setprop(devp, "reg", mem, ncells * 8);
 }
+
+void dt_set_cpu_clocks(u32 clock, u32 bus, u32 timebase)
+{
+	void *node = NULL;
+
+	while ((node = find_node_by_devtype(node, "cpu"))) {
+		setprop(node, "clock-frequency", &clock, 4);
+		setprop(node, "bus-frequency", &bus, 4);
+		setprop(node, "timebase-frequency", &timebase, 4);
+	}
+}
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 10c8787..c739764 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -81,6 +81,7 @@ void *simple_alloc_init(char *base, u32 heap_size, u32 granularity,
 		u32 max_allocs);
 int xlate_reg(void *node, int res, unsigned long *addr, unsigned long *size);
 void dt_set_memory(u64 start, u64 len, int ncells);
+void dt_set_cpu_clocks(u32 clock, u32 bus, u32 timebase);
 
 static inline void *finddevice(const char *name)
 {
-- 
1.5.0.3




More information about the Linuxppc-dev mailing list