aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/timer.c')
-rw-r--r--arch/arm/mach-shmobile/timer.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 942efdc82a62..87c6be1e79bd 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -23,8 +23,8 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25 25
26void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz, 26static void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
27 unsigned int mult, unsigned int div) 27 unsigned int mult, unsigned int div)
28{ 28{
29 /* calculate a worst-case loops-per-jiffy value 29 /* calculate a worst-case loops-per-jiffy value
30 * based on maximum cpu core hz setting and the 30 * based on maximum cpu core hz setting and the
@@ -40,27 +40,10 @@ void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
40 preset_lpj = max_cpu_core_hz / value; 40 preset_lpj = max_cpu_core_hz / value;
41} 41}
42 42
43void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
44 unsigned int mult, unsigned int div)
45{
46 /* calculate a worst-case loops-per-jiffy value
47 * based on maximum cpu core mhz setting and the
48 * __delay() implementation in arch/arm/lib/delay.S
49 *
50 * this will result in a longer delay than expected
51 * when the cpu core runs on lower frequencies.
52 */
53
54 unsigned int value = (1000000 * mult) / (HZ * div);
55
56 if (!preset_lpj)
57 preset_lpj = max_cpu_core_mhz * value;
58}
59
60void __init shmobile_init_delay(void) 43void __init shmobile_init_delay(void)
61{ 44{
62 struct device_node *np, *cpus; 45 struct device_node *np, *cpus;
63 bool is_a8_a9 = false; 46 bool is_a7_a8_a9 = false;
64 bool is_a15 = false; 47 bool is_a15 = false;
65 u32 max_freq = 0; 48 u32 max_freq = 0;
66 49
@@ -74,9 +57,10 @@ void __init shmobile_init_delay(void)
74 if (!of_property_read_u32(np, "clock-frequency", &freq)) 57 if (!of_property_read_u32(np, "clock-frequency", &freq))
75 max_freq = max(max_freq, freq); 58 max_freq = max(max_freq, freq);
76 59
77 if (of_device_is_compatible(np, "arm,cortex-a8") || 60 if (of_device_is_compatible(np, "arm,cortex-a7") ||
61 of_device_is_compatible(np, "arm,cortex-a8") ||
78 of_device_is_compatible(np, "arm,cortex-a9")) 62 of_device_is_compatible(np, "arm,cortex-a9"))
79 is_a8_a9 = true; 63 is_a7_a8_a9 = true;
80 else if (of_device_is_compatible(np, "arm,cortex-a15")) 64 else if (of_device_is_compatible(np, "arm,cortex-a15"))
81 is_a15 = true; 65 is_a15 = true;
82 } 66 }
@@ -86,7 +70,7 @@ void __init shmobile_init_delay(void)
86 if (!max_freq) 70 if (!max_freq)
87 return; 71 return;
88 72
89 if (is_a8_a9) 73 if (is_a7_a8_a9)
90 shmobile_setup_delay_hz(max_freq, 1, 3); 74 shmobile_setup_delay_hz(max_freq, 1, 3);
91 else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) 75 else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
92 shmobile_setup_delay_hz(max_freq, 2, 4); 76 shmobile_setup_delay_hz(max_freq, 2, 4);