Commit ff45d8dd authored by Lee Jones's avatar Lee Jones

clocksource: sti: Provide 'use timer as sched clock' capability

Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 70bef01c
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/sched_clock.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <dt-bindings/mfd/st-lpc.h> #include <dt-bindings/mfd/st-lpc.h>
...@@ -38,6 +39,11 @@ static void __init st_clksrc_reset(void) ...@@ -38,6 +39,11 @@ static void __init st_clksrc_reset(void)
writel_relaxed(1, ddata.base + LPC_LPT_START_OFF); writel_relaxed(1, ddata.base + LPC_LPT_START_OFF);
} }
static u64 notrace st_clksrc_sched_clock_read(void)
{
return (u64)readl_relaxed(ddata.base + LPC_LPT_LSB_OFF);
}
static int __init st_clksrc_init(void) static int __init st_clksrc_init(void)
{ {
unsigned long rate; unsigned long rate;
...@@ -47,6 +53,8 @@ static int __init st_clksrc_init(void) ...@@ -47,6 +53,8 @@ static int __init st_clksrc_init(void)
rate = clk_get_rate(ddata.clk); rate = clk_get_rate(ddata.clk);
sched_clock_register(st_clksrc_sched_clock_read, 32, rate);
ret = clocksource_mmio_init(ddata.base + LPC_LPT_LSB_OFF, ret = clocksource_mmio_init(ddata.base + LPC_LPT_LSB_OFF,
"clksrc-st-lpc", rate, 300, 32, "clksrc-st-lpc", rate, 300, 32,
clocksource_mmio_readl_up); clocksource_mmio_readl_up);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment