|
@@ -294,6 +294,19 @@ static void __arch_timer_setup(unsigned type,
|
|
|
clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff);
|
|
|
}
|
|
|
|
|
|
+static void arch_timer_configure_evtstream(void)
|
|
|
+{
|
|
|
+ int evt_stream_div, pos;
|
|
|
+
|
|
|
+ /* Find the closest power of two to the divisor */
|
|
|
+ evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ;
|
|
|
+ pos = fls(evt_stream_div);
|
|
|
+ if (pos > 1 && !(evt_stream_div & (1 << (pos - 2))))
|
|
|
+ pos--;
|
|
|
+ /* enable event stream */
|
|
|
+ arch_timer_evtstrm_enable(min(pos, 15));
|
|
|
+}
|
|
|
+
|
|
|
static int arch_timer_setup(struct clock_event_device *clk)
|
|
|
{
|
|
|
__arch_timer_setup(ARCH_CP15_TIMER, clk);
|
|
@@ -307,6 +320,8 @@ static int arch_timer_setup(struct clock_event_device *clk)
|
|
|
}
|
|
|
|
|
|
arch_counter_set_user_access();
|
|
|
+ if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM))
|
|
|
+ arch_timer_configure_evtstream();
|
|
|
|
|
|
return 0;
|
|
|
}
|