diff options
| author | Nathan Lynch <nathan_lynch@mentor.com> | 2014-09-28 19:50:06 -0400 |
|---|---|---|
| committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2014-09-28 19:59:26 -0400 |
| commit | e1ce5c7adc735ce96a35806ca32ceb78e607a283 (patch) | |
| tree | f64460684e1eb8139a65e108f7ebc49b1163d521 | |
| parent | 8b8dde00347ef409b29abd97e5833ffdb4ed7508 (diff) | |
clocksource: arm_arch_timer: Consolidate arch_timer_evtstrm_enable
The arch_timer_evtstrm_enable hooks in arm and arm64 are substantially
similar, the only difference being a CONFIG_COMPAT-conditional section
which is relevant only for arm64. Copy the arm64 version to the
driver, removing the arch-specific hooks.
Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
| -rw-r--r-- | arch/arm/include/asm/arch_timer.h | 11 | ||||
| -rw-r--r-- | arch/arm64/include/asm/arch_timer.h | 14 | ||||
| -rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 15 |
3 files changed, 15 insertions, 25 deletions
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h index b7ae44464231..92793ba69c40 100644 --- a/arch/arm/include/asm/arch_timer.h +++ b/arch/arm/include/asm/arch_timer.h | |||
| @@ -99,17 +99,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) | |||
| 99 | asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); | 99 | asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static inline void arch_timer_evtstrm_enable(int divider) | ||
| 103 | { | ||
| 104 | u32 cntkctl = arch_timer_get_cntkctl(); | ||
| 105 | cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK; | ||
| 106 | /* Set the divider and enable virtual event stream */ | ||
| 107 | cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) | ||
| 108 | | ARCH_TIMER_VIRT_EVT_EN; | ||
| 109 | arch_timer_set_cntkctl(cntkctl); | ||
| 110 | elf_hwcap |= HWCAP_EVTSTRM; | ||
| 111 | } | ||
| 112 | |||
| 113 | #endif | 102 | #endif |
| 114 | 103 | ||
| 115 | #endif | 104 | #endif |
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h index 49e94c677e7a..f19097134b02 100644 --- a/arch/arm64/include/asm/arch_timer.h +++ b/arch/arm64/include/asm/arch_timer.h | |||
| @@ -104,20 +104,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) | |||
| 104 | asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); | 104 | asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static inline void arch_timer_evtstrm_enable(int divider) | ||
| 108 | { | ||
| 109 | u32 cntkctl = arch_timer_get_cntkctl(); | ||
| 110 | cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK; | ||
| 111 | /* Set the divider and enable virtual event stream */ | ||
| 112 | cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) | ||
| 113 | | ARCH_TIMER_VIRT_EVT_EN; | ||
| 114 | arch_timer_set_cntkctl(cntkctl); | ||
| 115 | elf_hwcap |= HWCAP_EVTSTRM; | ||
| 116 | #ifdef CONFIG_COMPAT | ||
| 117 | compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM; | ||
| 118 | #endif | ||
| 119 | } | ||
| 120 | |||
| 121 | static inline u64 arch_counter_get_cntvct(void) | 107 | static inline u64 arch_counter_get_cntvct(void) |
| 122 | { | 108 | { |
| 123 | u64 cval; | 109 | u64 cval; |
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 42bd4455daca..2133f9d59d06 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
| @@ -299,6 +299,21 @@ static void __arch_timer_setup(unsigned type, | |||
| 299 | clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff); | 299 | clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | static void arch_timer_evtstrm_enable(int divider) | ||
| 303 | { | ||
| 304 | u32 cntkctl = arch_timer_get_cntkctl(); | ||
| 305 | |||
| 306 | cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK; | ||
| 307 | /* Set the divider and enable virtual event stream */ | ||
| 308 | cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) | ||
| 309 | | ARCH_TIMER_VIRT_EVT_EN; | ||
| 310 | arch_timer_set_cntkctl(cntkctl); | ||
| 311 | elf_hwcap |= HWCAP_EVTSTRM; | ||
| 312 | #ifdef CONFIG_COMPAT | ||
| 313 | compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM; | ||
| 314 | #endif | ||
| 315 | } | ||
| 316 | |||
| 302 | static void arch_timer_configure_evtstream(void) | 317 | static void arch_timer_configure_evtstream(void) |
| 303 | { | 318 | { |
| 304 | int evt_stream_div, pos; | 319 | int evt_stream_div, pos; |
