aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/arm_arch_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/arm_arch_timer.c')
-rw-r--r--drivers/clocksource/arm_arch_timer.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 02c5cb86ca83..e38f4d4290ad 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1076,15 +1076,28 @@ static const struct of_device_id arch_timer_mem_of_match[] __initconst = {
1076 {}, 1076 {},
1077}; 1077};
1078 1078
1079static bool __init 1079static bool __init arch_timer_needs_of_probing(void)
1080arch_timer_needs_probing(int type, const struct of_device_id *matches)
1081{ 1080{
1082 struct device_node *dn; 1081 struct device_node *dn;
1083 bool needs_probing = false; 1082 bool needs_probing = false;
1083 unsigned int mask = ARCH_TIMER_TYPE_CP15 | ARCH_TIMER_TYPE_MEM;
1084 1084
1085 dn = of_find_matching_node(NULL, matches); 1085 /* We have two timers, and both device-tree nodes are probed. */
1086 if (dn && of_device_is_available(dn) && !(arch_timers_present & type)) 1086 if ((arch_timers_present & mask) == mask)
1087 return false;
1088
1089 /*
1090 * Only one type of timer is probed,
1091 * check if we have another type of timer node in device-tree.
1092 */
1093 if (arch_timers_present & ARCH_TIMER_TYPE_CP15)
1094 dn = of_find_matching_node(NULL, arch_timer_mem_of_match);
1095 else
1096 dn = of_find_matching_node(NULL, arch_timer_of_match);
1097
1098 if (dn && of_device_is_available(dn))
1087 needs_probing = true; 1099 needs_probing = true;
1100
1088 of_node_put(dn); 1101 of_node_put(dn);
1089 1102
1090 return needs_probing; 1103 return needs_probing;
@@ -1092,17 +1105,8 @@ arch_timer_needs_probing(int type, const struct of_device_id *matches)
1092 1105
1093static int __init arch_timer_common_init(void) 1106static int __init arch_timer_common_init(void)
1094{ 1107{
1095 unsigned mask = ARCH_TIMER_TYPE_CP15 | ARCH_TIMER_TYPE_MEM; 1108 if (acpi_disabled && arch_timer_needs_of_probing())
1096 1109 return 0;
1097 /* Wait until both nodes are probed if we have two timers */
1098 if ((arch_timers_present & mask) != mask) {
1099 if (arch_timer_needs_probing(ARCH_TIMER_TYPE_MEM,
1100 arch_timer_mem_of_match))
1101 return 0;
1102 if (arch_timer_needs_probing(ARCH_TIMER_TYPE_CP15,
1103 arch_timer_of_match))
1104 return 0;
1105 }
1106 1110
1107 arch_timer_banner(arch_timers_present); 1111 arch_timer_banner(arch_timers_present);
1108 arch_counter_register(arch_timers_present); 1112 arch_counter_register(arch_timers_present);