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>
This commit is contained in:
parent
8b8dde0034
commit
e1ce5c7adc
|
@ -99,17 +99,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)
|
||||||
asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
|
asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void arch_timer_evtstrm_enable(int divider)
|
|
||||||
{
|
|
||||||
u32 cntkctl = arch_timer_get_cntkctl();
|
|
||||||
cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
|
|
||||||
/* Set the divider and enable virtual event stream */
|
|
||||||
cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
|
|
||||||
| ARCH_TIMER_VIRT_EVT_EN;
|
|
||||||
arch_timer_set_cntkctl(cntkctl);
|
|
||||||
elf_hwcap |= HWCAP_EVTSTRM;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,20 +104,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)
|
||||||
asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
|
asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void arch_timer_evtstrm_enable(int divider)
|
|
||||||
{
|
|
||||||
u32 cntkctl = arch_timer_get_cntkctl();
|
|
||||||
cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
|
|
||||||
/* Set the divider and enable virtual event stream */
|
|
||||||
cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
|
|
||||||
| ARCH_TIMER_VIRT_EVT_EN;
|
|
||||||
arch_timer_set_cntkctl(cntkctl);
|
|
||||||
elf_hwcap |= HWCAP_EVTSTRM;
|
|
||||||
#ifdef CONFIG_COMPAT
|
|
||||||
compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline u64 arch_counter_get_cntvct(void)
|
static inline u64 arch_counter_get_cntvct(void)
|
||||||
{
|
{
|
||||||
u64 cval;
|
u64 cval;
|
||||||
|
|
|
@ -299,6 +299,21 @@ static void __arch_timer_setup(unsigned type,
|
||||||
clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff);
|
clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void arch_timer_evtstrm_enable(int divider)
|
||||||
|
{
|
||||||
|
u32 cntkctl = arch_timer_get_cntkctl();
|
||||||
|
|
||||||
|
cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
|
||||||
|
/* Set the divider and enable virtual event stream */
|
||||||
|
cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
|
||||||
|
| ARCH_TIMER_VIRT_EVT_EN;
|
||||||
|
arch_timer_set_cntkctl(cntkctl);
|
||||||
|
elf_hwcap |= HWCAP_EVTSTRM;
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void arch_timer_configure_evtstream(void)
|
static void arch_timer_configure_evtstream(void)
|
||||||
{
|
{
|
||||||
int evt_stream_div, pos;
|
int evt_stream_div, pos;
|
||||||
|
|
Loading…
Reference in New Issue