diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2016-04-14 04:33:16 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2016-04-19 18:55:09 -0400 |
commit | a4b8c18c40704c28be62af4606cc6758c9ff3dba (patch) | |
tree | 0856029a18d4db84db5a280e3dc1983e74169285 | |
parent | c531fb27e9699eaee478ee5686a3cca5dee73602 (diff) |
ARM: shmobile: timer: Drop support for Cortex A8
Commit edf4100906044225 ("ARM: shmobile: sh7372 dtsi: Remove Legacy
file") removed the DTS for the last shmobile SoC with a Cortex A8 CPU
core (sh7372 aka SH-Mobile AP4), hence drop support for it in the
loops-per-jiffy preset code.
As "div" is always 1 for supported contemporary ARM processors, we can
simplify the code:
- Absorb shmobile_setup_delay_hz(), which was always called with
mult = div = 1,
- Return earlier if the Cortex A7/A15 arch timer exists and support is
enabled.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/timer.c | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 67d79f9c6bad..6196a6380385 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c | |||
@@ -20,28 +20,9 @@ | |||
20 | 20 | ||
21 | #include "common.h" | 21 | #include "common.h" |
22 | 22 | ||
23 | static void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz, | ||
24 | unsigned int mult, unsigned int div) | ||
25 | { | ||
26 | /* calculate a worst-case loops-per-jiffy value | ||
27 | * based on maximum cpu core hz setting and the | ||
28 | * __delay() implementation in arch/arm/lib/delay.S | ||
29 | * | ||
30 | * this will result in a longer delay than expected | ||
31 | * when the cpu core runs on lower frequencies. | ||
32 | */ | ||
33 | |||
34 | unsigned int value = HZ * div / mult; | ||
35 | |||
36 | if (!preset_lpj) | ||
37 | preset_lpj = max_cpu_core_hz / value; | ||
38 | } | ||
39 | |||
40 | void __init shmobile_init_delay(void) | 23 | void __init shmobile_init_delay(void) |
41 | { | 24 | { |
42 | struct device_node *np, *cpus; | 25 | struct device_node *np, *cpus; |
43 | unsigned int div = 0; | ||
44 | bool has_arch_timer = false; | ||
45 | u32 max_freq = 0; | 26 | u32 max_freq = 0; |
46 | 27 | ||
47 | cpus = of_find_node_by_path("/cpus"); | 28 | cpus = of_find_node_by_path("/cpus"); |
@@ -51,25 +32,32 @@ void __init shmobile_init_delay(void) | |||
51 | for_each_child_of_node(cpus, np) { | 32 | for_each_child_of_node(cpus, np) { |
52 | u32 freq; | 33 | u32 freq; |
53 | 34 | ||
35 | if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER) && | ||
36 | (of_device_is_compatible(np, "arm,cortex-a7") || | ||
37 | of_device_is_compatible(np, "arm,cortex-a15"))) { | ||
38 | of_node_put(np); | ||
39 | of_node_put(cpus); | ||
40 | return; | ||
41 | } | ||
42 | |||
54 | if (!of_property_read_u32(np, "clock-frequency", &freq)) | 43 | if (!of_property_read_u32(np, "clock-frequency", &freq)) |
55 | max_freq = max(max_freq, freq); | 44 | max_freq = max(max_freq, freq); |
56 | |||
57 | if (of_device_is_compatible(np, "arm,cortex-a8")) { | ||
58 | div = 2; | ||
59 | } else if (of_device_is_compatible(np, "arm,cortex-a9")) { | ||
60 | div = 1; | ||
61 | } else if (of_device_is_compatible(np, "arm,cortex-a7") || | ||
62 | of_device_is_compatible(np, "arm,cortex-a15")) { | ||
63 | div = 1; | ||
64 | has_arch_timer = true; | ||
65 | } | ||
66 | } | 45 | } |
67 | 46 | ||
68 | of_node_put(cpus); | 47 | of_node_put(cpus); |
69 | 48 | ||
70 | if (!max_freq || !div) | 49 | if (!max_freq) |
71 | return; | 50 | return; |
72 | 51 | ||
73 | if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) | 52 | /* |
74 | shmobile_setup_delay_hz(max_freq, 1, div); | 53 | * Calculate a worst-case loops-per-jiffy value |
54 | * based on maximum cpu core hz setting and the | ||
55 | * __delay() implementation in arch/arm/lib/delay.S. | ||
56 | * | ||
57 | * This will result in a longer delay than expected | ||
58 | * when the cpu core runs on lower frequencies. | ||
59 | */ | ||
60 | |||
61 | if (!preset_lpj) | ||
62 | preset_lpj = max_freq / HZ; | ||
75 | } | 63 | } |