diff options
author | Olof Johansson <olof@lixom.net> | 2014-12-05 02:32:16 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2014-12-05 02:32:16 -0500 |
commit | 6b34df9e30c8b596f9d0173ca17714076474458e (patch) | |
tree | a47b26e4ebb4d0aea10b3abbb620efa2a004ba8c /drivers/clocksource | |
parent | e58e501a9b3e0db722263b02d6c06f1656a5dee7 (diff) | |
parent | 65b5732d241b8b39e07653794eefffd0d8028cbb (diff) |
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')
-rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 43005d4d3348..6a79fc4f900c 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 (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 | ||
@@ -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. |