Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+22 -1
+2 -1
arch/sh/Kconfig
··· 25 25 26 26 config SUPERH64 27 27 def_bool y if CPU_SH5 28 + select GENERIC_CALIBRATE_DELAY 28 29 29 30 config ARCH_DEFCONFIG 30 31 string ··· 58 57 def_bool y 59 58 60 59 config GENERIC_CALIBRATE_DELAY 61 - def_bool y 60 + bool 62 61 63 62 config GENERIC_IOMAP 64 63 bool
+20
arch/sh/kernel/setup.c
··· 27 27 #include <linux/debugfs.h> 28 28 #include <linux/crash_dump.h> 29 29 #include <linux/mmzone.h> 30 + #include <linux/clk.h> 31 + #include <linux/delay.h> 30 32 #include <asm/uaccess.h> 31 33 #include <asm/io.h> 32 34 #include <asm/page.h> ··· 180 178 #else 181 179 static inline void __init reserve_crashkernel(void) 182 180 {} 181 + #endif 182 + 183 + #ifndef CONFIG_GENERIC_CALIBRATE_DELAY 184 + void __cpuinit calibrate_delay(void) 185 + { 186 + struct clk *clk = clk_get(NULL, "cpu_clk"); 187 + 188 + if (IS_ERR(clk)) 189 + panic("Need a sane CPU clock definition!"); 190 + 191 + loops_per_jiffy = (clk_get_rate(clk) >> 1) / HZ; 192 + 193 + printk(KERN_INFO "Calibrating delay loop (skipped)... " 194 + "%lu.%02lu BogoMIPS PRESET (lpj=%lu)\n", 195 + loops_per_jiffy/(500000/HZ), 196 + (loops_per_jiffy/(5000/HZ)) % 100, 197 + loops_per_jiffy); 198 + } 183 199 #endif 184 200 185 201 void __init __add_active_range(unsigned int nid, unsigned long start_pfn,