diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-09-08 07:47:42 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-09-08 07:47:42 -0400 |
commit | cf204fa797cf968de8043491cd469ad0321d0940 (patch) | |
tree | 0faa7e866c1ce490973d61a5d1e277ee47ab3c54 | |
parent | 4eb5845d6cbdb9bf03f563c22f3a54115121858f (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>
-rw-r--r-- | arch/sh/Kconfig | 3 | ||||
-rw-r--r-- | arch/sh/kernel/setup.c | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index c5b08eb3770e..bbdcd6418ef5 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -25,6 +25,7 @@ config SUPERH32 | |||
25 | 25 | ||
26 | config SUPERH64 | 26 | config SUPERH64 |
27 | def_bool y if CPU_SH5 | 27 | def_bool y if CPU_SH5 |
28 | select GENERIC_CALIBRATE_DELAY | ||
28 | 29 | ||
29 | config ARCH_DEFCONFIG | 30 | config ARCH_DEFCONFIG |
30 | string | 31 | string |
@@ -57,7 +58,7 @@ config GENERIC_IRQ_PROBE | |||
57 | def_bool y | 58 | def_bool y |
58 | 59 | ||
59 | config GENERIC_CALIBRATE_DELAY | 60 | config GENERIC_CALIBRATE_DELAY |
60 | def_bool y | 61 | bool |
61 | 62 | ||
62 | config GENERIC_IOMAP | 63 | config GENERIC_IOMAP |
63 | bool | 64 | bool |
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 | ||
186 | void __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 | |||
183 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, | 203 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, |
184 | unsigned long end_pfn) | 204 | unsigned long end_pfn) |
185 | { | 205 | { |