summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/arm_arch_timer.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2014-12-04 23:32:16 -0800
committerOlof Johansson <olof@lixom.net>2014-12-04 23:32:16 -0800
commit6b34df9e30c8b596f9d0173ca17714076474458e (patch)
treea47b26e4ebb4d0aea10b3abbb620efa2a004ba8c /drivers/clocksource/arm_arch_timer.c
parente58e501a9b3e0db722263b02d6c06f1656a5dee7 (diff)
parent65b5732d241b8b39e07653794eefffd0d8028cbb (diff)
downloadop-kernel-dev-6b34df9e30c8b596f9d0173ca17714076474458e.zip
op-kernel-dev-6b34df9e30c8b596f9d0173ca17714076474458e.tar.gz
Merge branch 'clocksource/physical-timers' into next/drivers
* clocksource/physical-timers: clocksource: arch_timer: Allow the device tree to specify uninitialized timer registers clocksource: arch_timer: Fix code to use physical timers when requested
Diffstat (limited to 'drivers/clocksource/arm_arch_timer.c')
-rw-r--r--drivers/clocksource/arm_arch_timer.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 43005d4..6a79fc4 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)
/* Register the CP15 based counter if we have one */
if (type & ARCH_CP15_TIMER) {
- arch_timer_read_counter = arch_counter_get_cntvct;
+ if (arch_timer_use_virtual)
+ arch_timer_read_counter = arch_counter_get_cntvct;
+ else
+ arch_timer_read_counter = arch_counter_get_cntpct;
} else {
arch_timer_read_counter = arch_counter_get_cntvct_mem;
@@ -702,6 +705,14 @@ static void __init arch_timer_init(struct device_node *np)
arch_timer_detect_rate(NULL, np);
/*
+ * If we cannot rely on firmware initializing the timer registers then
+ * we should use the physical timers instead.
+ */
+ if (IS_ENABLED(CONFIG_ARM) &&
+ of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
+ arch_timer_use_virtual = false;
+
+ /*
* If HYP mode is available, we know that the physical timer
* has been configured to be accessible from PL1. Use it, so
* that a guest can use the virtual timer instead.
OpenPOWER on IntegriCloud