diff options
author | Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | 2013-08-13 09:30:32 -0400 |
---|---|---|
committer | Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | 2013-09-26 04:47:26 -0400 |
commit | e9faebc66ec74f1ab7f267d683b45e80faa69763 (patch) | |
tree | 5c80fc2ef2db81221734db3dfa263d587ed15b4a /arch/arm/include/asm/arch_timer.h | |
parent | 28061758dc83df445a05af347b5ce55ccd968c03 (diff) |
ARM: arch_timer: add support to configure and enable event stream
This patch adds support for configuring the event stream frequency
and enabling it.
It also adds the hwcaps definitions to the user to detect this event
stream feature.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Diffstat (limited to 'arch/arm/include/asm/arch_timer.h')
-rw-r--r-- | arch/arm/include/asm/arch_timer.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h index d57e04de8e8c..0704e0cf5571 100644 --- a/arch/arm/include/asm/arch_timer.h +++ b/arch/arm/include/asm/arch_timer.h | |||
@@ -87,11 +87,21 @@ static inline u64 arch_counter_get_cntvct(void) | |||
87 | return cval; | 87 | return cval; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline void arch_counter_set_user_access(void) | 90 | static inline u32 arch_timer_get_cntkctl(void) |
91 | { | 91 | { |
92 | u32 cntkctl; | 92 | u32 cntkctl; |
93 | |||
94 | asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl)); | 93 | asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl)); |
94 | return cntkctl; | ||
95 | } | ||
96 | |||
97 | static inline void arch_timer_set_cntkctl(u32 cntkctl) | ||
98 | { | ||
99 | asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); | ||
100 | } | ||
101 | |||
102 | static inline void arch_counter_set_user_access(void) | ||
103 | { | ||
104 | u32 cntkctl = arch_timer_get_cntkctl(); | ||
95 | 105 | ||
96 | /* Disable user access to both physical/virtual counters/timers */ | 106 | /* Disable user access to both physical/virtual counters/timers */ |
97 | /* Also disable virtual event stream */ | 107 | /* Also disable virtual event stream */ |
@@ -100,9 +110,20 @@ static inline void arch_counter_set_user_access(void) | |||
100 | | ARCH_TIMER_VIRT_EVT_EN | 110 | | ARCH_TIMER_VIRT_EVT_EN |
101 | | ARCH_TIMER_USR_VCT_ACCESS_EN | 111 | | ARCH_TIMER_USR_VCT_ACCESS_EN |
102 | | ARCH_TIMER_USR_PCT_ACCESS_EN); | 112 | | ARCH_TIMER_USR_PCT_ACCESS_EN); |
113 | arch_timer_set_cntkctl(cntkctl); | ||
114 | } | ||
103 | 115 | ||
104 | asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); | 116 | static inline void arch_timer_evtstrm_enable(int divider) |
117 | { | ||
118 | u32 cntkctl = arch_timer_get_cntkctl(); | ||
119 | cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK; | ||
120 | /* Set the divider and enable virtual event stream */ | ||
121 | cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) | ||
122 | | ARCH_TIMER_VIRT_EVT_EN; | ||
123 | arch_timer_set_cntkctl(cntkctl); | ||
124 | elf_hwcap |= HWCAP_EVTSTRM; | ||
105 | } | 125 | } |
126 | |||
106 | #endif | 127 | #endif |
107 | 128 | ||
108 | #endif | 129 | #endif |