diff options
author | Simon Horman <horms+renesas@verge.net.au> | 2014-05-13 02:59:18 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-05-14 01:02:21 -0400 |
commit | f492b81777c93b33afe892b424e022022b5bc297 (patch) | |
tree | 1e7596767eddec8b733f4002233dfc3f01be92cb | |
parent | 34b9fa401eeef4e388bb7563110733c73c452c80 (diff) |
ARM: shmobile: Set clock frequency in HZ from OF nodes
shmobile_init_delay() looks for OF "clock-frequency" to determine
the delay which is set by calling shmobile_setup_delay().
Unfortunately this seems to be incorrect in detail as
"clock-frequency" node values are in HZ whereas the frequency
argument to shmobile_setup_delay() is in MHz.
Provide a variant of shmobile_setup_delay() that accepts HZ to
correct this problem.
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/timer.c | 23 |
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 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
25 | 25 | ||
26 | void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz, | ||
27 | unsigned int mult, unsigned int div) | ||
28 | { | ||
29 | /* calculate a worst-case loops-per-jiffy value | ||
30 | * based on maximum cpu core hz setting and the | ||
31 | * __delay() implementation in arch/arm/lib/delay.S | ||
32 | * | ||
33 | * this will result in a longer delay than expected | ||
34 | * when the cpu core runs on lower frequencies. | ||
35 | */ | ||
36 | |||
37 | unsigned int value = HZ * div / mult; | ||
38 | |||
39 | if (!preset_lpj) | ||
40 | preset_lpj = max_cpu_core_hz / value; | ||
41 | } | ||
42 | |||
26 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, | 43 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, |
27 | unsigned int mult, unsigned int div) | 44 | unsigned int mult, unsigned int div) |
28 | { | 45 | { |
@@ -58,12 +75,12 @@ void __init shmobile_init_delay(void) | |||
58 | 75 | ||
59 | if (max_freq) { | 76 | if (max_freq) { |
60 | if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) | 77 | if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) |
61 | shmobile_setup_delay(max_freq, 1, 3); | 78 | shmobile_setup_delay_hz(max_freq, 1, 3); |
62 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) | 79 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) |
63 | shmobile_setup_delay(max_freq, 1, 3); | 80 | shmobile_setup_delay_hz(max_freq, 1, 3); |
64 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15")) | 81 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15")) |
65 | if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) | 82 | if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) |
66 | shmobile_setup_delay(max_freq, 2, 4); | 83 | shmobile_setup_delay_hz(max_freq, 2, 4); |
67 | } | 84 | } |
68 | } | 85 | } |
69 | 86 | ||