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.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 5163ec13429d..7e267e3990ab 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -616,17 +616,29 @@ static const struct of_device_id arch_timer_mem_of_match[] __initconst = {
616 {}, 616 {},
617}; 617};
618 618
619static bool __init
620arch_timer_probed(int type, const struct of_device_id *matches)
621{
622 struct device_node *dn;
623 bool probed = false;
624
625 dn = of_find_matching_node(NULL, matches);
626 if (dn && of_device_is_available(dn) && (arch_timers_present & type))
627 probed = true;
628 of_node_put(dn);
629
630 return probed;
631}
632
619static void __init arch_timer_common_init(void) 633static void __init arch_timer_common_init(void)
620{ 634{
621 unsigned mask = ARCH_CP15_TIMER | ARCH_MEM_TIMER; 635 unsigned mask = ARCH_CP15_TIMER | ARCH_MEM_TIMER;
622 636
623 /* Wait until both nodes are probed if we have two timers */ 637 /* Wait until both nodes are probed if we have two timers */
624 if ((arch_timers_present & mask) != mask) { 638 if ((arch_timers_present & mask) != mask) {
625 if (of_find_matching_node(NULL, arch_timer_mem_of_match) && 639 if (!arch_timer_probed(ARCH_MEM_TIMER, arch_timer_mem_of_match))
626 !(arch_timers_present & ARCH_MEM_TIMER))
627 return; 640 return;
628 if (of_find_matching_node(NULL, arch_timer_of_match) && 641 if (!arch_timer_probed(ARCH_CP15_TIMER, arch_timer_of_match))
629 !(arch_timers_present & ARCH_CP15_TIMER))
630 return; 642 return;
631 } 643 }
632 644