]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: mach-shmobile: Introduce shmobile_setup_delay()
authorMagnus Damm <damm@opensource.se>
Wed, 28 Mar 2012 10:22:30 +0000 (19:22 +0900)
committerRafael J. Wysocki <rjw@sisk.pl>
Wed, 11 Apr 2012 10:11:48 +0000 (12:11 +0200)
Add the function shmobile_setup_delay() to let platforms
configure their maximum loops per jiffy delay. With this
jiffies calculation done the dependency on early timer
is removed.

In the future this allows us to assign timers
using the regular driver model via the device tree.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
arch/arm/mach-shmobile/include/mach/common.h
arch/arm/mach-shmobile/timer.c

index 83ad3fe0a75fc120676b19ebca1d896611076d5a..cc1d73514ffa189523fa3bebf7c167f405091ab7 100644 (file)
@@ -3,6 +3,8 @@
 
 extern void shmobile_earlytimer_init(void);
 extern struct sys_timer shmobile_timer;
+extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
+                                unsigned int mult, unsigned int div);
 struct twd_local_timer;
 void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
 extern void shmobile_setup_console(void);
index 2fba5f3d1c8ad705309a2e1f3287af5fbb1aee06..599e0081a5333f4d98b02aadda1916e22a489d27 100644 (file)
  *
  */
 #include <linux/platform_device.h>
+#include <linux/delay.h>
 #include <asm/mach/time.h>
 #include <asm/smp_twd.h>
 
+void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
+                                unsigned int mult, unsigned int div)
+{
+       /* calculate a worst-case loops-per-jiffy value
+        * based on maximum cpu core mhz setting and the
+        * __delay() implementation in arch/arm/lib/delay.S
+        *
+        * this will result in a longer delay than expected
+        * when the cpu core runs on lower frequencies.
+        */
+
+       unsigned int value = (1000000 * mult) / (HZ * div);
+
+       lpj_fine = max_cpu_core_mhz * value;
+}
+
 static void __init shmobile_late_time_init(void)
 {
        /*