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.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 2133f9d59d06..095c1774592c 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -462,7 +462,10 @@ static void __init arch_counter_register(unsigned type)
462 462
463 /* Register the CP15 based counter if we have one */ 463 /* Register the CP15 based counter if we have one */
464 if (type & ARCH_CP15_TIMER) { 464 if (type & ARCH_CP15_TIMER) {
465 arch_timer_read_counter = arch_counter_get_cntvct; 465 if (IS_ENABLED(CONFIG_ARM64) || arch_timer_use_virtual)
466 arch_timer_read_counter = arch_counter_get_cntvct;
467 else
468 arch_timer_read_counter = arch_counter_get_cntpct;
466 } else { 469 } else {
467 arch_timer_read_counter = arch_counter_get_cntvct_mem; 470 arch_timer_read_counter = arch_counter_get_cntvct_mem;
468 471
@@ -660,11 +663,11 @@ static bool __init
660arch_timer_probed(int type, const struct of_device_id *matches) 663arch_timer_probed(int type, const struct of_device_id *matches)
661{ 664{
662 struct device_node *dn; 665 struct device_node *dn;
663 bool probed = false; 666 bool probed = true;
664 667
665 dn = of_find_matching_node(NULL, matches); 668 dn = of_find_matching_node(NULL, matches);
666 if (dn && of_device_is_available(dn) && (arch_timers_present & type)) 669 if (dn && of_device_is_available(dn) && !(arch_timers_present & type))
667 probed = true; 670 probed = false;
668 of_node_put(dn); 671 of_node_put(dn);
669 672
670 return probed; 673 return probed;
@@ -702,6 +705,14 @@ static void __init arch_timer_init(struct device_node *np)
702 arch_timer_detect_rate(NULL, np); 705 arch_timer_detect_rate(NULL, np);
703 706
704 /* 707 /*
708 * If we cannot rely on firmware initializing the timer registers then
709 * we should use the physical timers instead.
710 */
711 if (IS_ENABLED(CONFIG_ARM) &&
712 of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
713 arch_timer_use_virtual = false;
714
715 /*
705 * If HYP mode is available, we know that the physical timer 716 * If HYP mode is available, we know that the physical timer
706 * has been configured to be accessible from PL1. Use it, so 717 * has been configured to be accessible from PL1. Use it, so
707 * that a guest can use the virtual timer instead. 718 * that a guest can use the virtual timer instead.