Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nathan Lynch and committed by
Daniel Lezcano
e1ce5c7a 8b8dde00

+15 -25
-11
arch/arm/include/asm/arch_timer.h
··· 99 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 102 #endif 114 103 115 104 #endif
-14
arch/arm64/include/asm/arch_timer.h
··· 104 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 107 static inline u64 arch_counter_get_cntvct(void) 122 108 { 123 109 u64 cval;
+15
drivers/clocksource/arm_arch_timer.c
··· 299 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 317 static void arch_timer_configure_evtstream(void) 303 318 { 304 319 int evt_stream_div, pos;