summaryrefslogtreecommitdiff
path: root/arch/arm/mach-shmobile/timer.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2014-05-19 23:29:46 -0700
committerOlof Johansson <olof@lixom.net>2014-05-19 23:29:46 -0700
commitbf4348e622a798eda72c59f35772db93f72f6aef (patch)
treedff000d5f5ae2e53ff565eadc962e1b4d417479c /arch/arm/mach-shmobile/timer.c
parentfd46edb9f667e0373eefb0c93745fbde0c9e8161 (diff)
parentf492b81777c93b33afe892b424e022022b5bc297 (diff)
Merge tag 'renesas-soc-cleanup-for-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/soc
Merge "Renesas ARM Based SoC soc-cleanup Updates for v3.16" from Simon Horman: r8a7791 (R-Car H2) SoC and its Koelsch board and, r8a7740 (R-Mobile A1) SoC and its Armadillo800eva board * Set CPU clock frequency from OF nodes * tag 'renesas-soc-cleanup-for-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: ARM: shmobile: Set clock frequency in HZ from OF nodes ARM: shmobile: Use shmobile_init_late() on r8a7740 ARM: shmobile: Remove unused r8a7791_init_early() ARM: shmobile: Use r8a7791 DT CPU Frequency for Koelsch ARM: shmobile: Use r8a7791 DT CPU Frequency in common case ARM: shmobile: Remove unused r8a7740_init_delay() ARM: shmobile: Use r8a7740 DT CPU Frequency for Armadillo DT Ref ARM: shmobile: Use r8a7740 DT CPU Frequency in common case ARM: shmobile: Add r8a7740 Maximum CPU Frequency to DTS Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-shmobile/timer.c')
-rw-r--r--arch/arm/mach-shmobile/timer.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index ccecde9a3362..68bc0b82226d 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -23,6 +23,23 @@
#include <linux/delay.h>
#include <linux/of_address.h>
+void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
+ unsigned int mult, unsigned int div)
+{
+ /* calculate a worst-case loops-per-jiffy value
+ * based on maximum cpu core hz 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 = HZ * div / mult;
+
+ if (!preset_lpj)
+ preset_lpj = max_cpu_core_hz / value;
+}
+
void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div)
{
@@ -58,12 +75,12 @@ void __init shmobile_init_delay(void)
if (max_freq) {
if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
- shmobile_setup_delay(max_freq, 1, 3);
+ shmobile_setup_delay_hz(max_freq, 1, 3);
else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
- shmobile_setup_delay(max_freq, 1, 3);
+ shmobile_setup_delay_hz(max_freq, 1, 3);
else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15"))
if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
- shmobile_setup_delay(max_freq, 2, 4);
+ shmobile_setup_delay_hz(max_freq, 2, 4);
}
}