aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/setup.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-09-08 07:47:42 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-09-08 07:47:42 -0400
commitcf204fa797cf968de8043491cd469ad0321d0940 (patch)
tree0faa7e866c1ce490973d61a5d1e277ee47ab3c54 /arch/sh/kernel/setup.c
parent4eb5845d6cbdb9bf03f563c22f3a54115121858f (diff)
sh: Derive calibrate_delay lpj from clk fwk.
All CPUs must have a sensible cpu_clk definition these days, which we can safely use for deriving the preset loops_per_jiffy. The only odd one out is SH-5, which hasn't been hammered in to the framework yet. Based on the ST patch. Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com> Signed-off-by: Carl Shaw <carl.shaw@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/setup.c')
-rw-r--r--arch/sh/kernel/setup.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index fc098c8af052..267b344099c0 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -27,6 +27,8 @@
27#include <linux/debugfs.h> 27#include <linux/debugfs.h>
28#include <linux/crash_dump.h> 28#include <linux/crash_dump.h>
29#include <linux/mmzone.h> 29#include <linux/mmzone.h>
30#include <linux/clk.h>
31#include <linux/delay.h>
30#include <asm/uaccess.h> 32#include <asm/uaccess.h>
31#include <asm/io.h> 33#include <asm/io.h>
32#include <asm/page.h> 34#include <asm/page.h>
@@ -180,6 +182,24 @@ static inline void __init reserve_crashkernel(void)
180{} 182{}
181#endif 183#endif
182 184
185#ifndef CONFIG_GENERIC_CALIBRATE_DELAY
186void __cpuinit calibrate_delay(void)
187{
188 struct clk *clk = clk_get(NULL, "cpu_clk");
189
190 if (IS_ERR(clk))
191 panic("Need a sane CPU clock definition!");
192
193 loops_per_jiffy = (clk_get_rate(clk) >> 1) / HZ;
194
195 printk(KERN_INFO "Calibrating delay loop (skipped)... "
196 "%lu.%02lu BogoMIPS PRESET (lpj=%lu)\n",
197 loops_per_jiffy/(500000/HZ),
198 (loops_per_jiffy/(5000/HZ)) % 100,
199 loops_per_jiffy);
200}
201#endif
202
183void __init __add_active_range(unsigned int nid, unsigned long start_pfn, 203void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
184 unsigned long end_pfn) 204 unsigned long end_pfn)
185{ 205{