diff options
Diffstat (limited to 'arch/arm/mach-shmobile/timer.c')
-rw-r--r-- | arch/arm/mach-shmobile/timer.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 68bc0b82226d..942efdc82a62 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c | |||
@@ -59,29 +59,37 @@ void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, | |||
59 | 59 | ||
60 | void __init shmobile_init_delay(void) | 60 | void __init shmobile_init_delay(void) |
61 | { | 61 | { |
62 | struct device_node *np, *parent; | 62 | struct device_node *np, *cpus; |
63 | u32 max_freq, freq; | 63 | bool is_a8_a9 = false; |
64 | 64 | bool is_a15 = false; | |
65 | max_freq = 0; | 65 | u32 max_freq = 0; |
66 | 66 | ||
67 | parent = of_find_node_by_path("/cpus"); | 67 | cpus = of_find_node_by_path("/cpus"); |
68 | if (parent) { | 68 | if (!cpus) |
69 | for_each_child_of_node(parent, np) { | 69 | return; |
70 | if (!of_property_read_u32(np, "clock-frequency", &freq)) | 70 | |
71 | max_freq = max(max_freq, freq); | 71 | for_each_child_of_node(cpus, np) { |
72 | } | 72 | u32 freq; |
73 | of_node_put(parent); | 73 | |
74 | } | 74 | if (!of_property_read_u32(np, "clock-frequency", &freq)) |
75 | max_freq = max(max_freq, freq); | ||
75 | 76 | ||
76 | if (max_freq) { | 77 | if (of_device_is_compatible(np, "arm,cortex-a8") || |
77 | if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) | 78 | of_device_is_compatible(np, "arm,cortex-a9")) |
78 | shmobile_setup_delay_hz(max_freq, 1, 3); | 79 | is_a8_a9 = true; |
79 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) | 80 | else if (of_device_is_compatible(np, "arm,cortex-a15")) |
80 | shmobile_setup_delay_hz(max_freq, 1, 3); | 81 | is_a15 = true; |
81 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15")) | ||
82 | if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) | ||
83 | shmobile_setup_delay_hz(max_freq, 2, 4); | ||
84 | } | 82 | } |
83 | |||
84 | of_node_put(cpus); | ||
85 | |||
86 | if (!max_freq) | ||
87 | return; | ||
88 | |||
89 | if (is_a8_a9) | ||
90 | shmobile_setup_delay_hz(max_freq, 1, 3); | ||
91 | else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) | ||
92 | shmobile_setup_delay_hz(max_freq, 2, 4); | ||
85 | } | 93 | } |
86 | 94 | ||
87 | static void __init shmobile_late_time_init(void) | 95 | static void __init shmobile_late_time_init(void) |