Thread (18 messages) 18 messages, 3 authors, 2015-06-01
STALE4052d

[PATCH v2 03/12] clocksource: sti: Provide 'use timer as sched clock' capability

From: Lee Jones <hidden>
Date: 2015-05-12 13:02:20
Also in: linux-devicetree, linux-rtc, linux-watchdog, lkml
Subsystem: arm/sti architecture, clocksource, clockevent drivers, the rest · Maintainers: Patrice Chotard, Daniel Lezcano, Thomas Gleixner, Linus Torvalds

Signed-off-by: Lee Jones <redacted>
---
 drivers/clocksource/clksrc_st_lpc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/clocksource/clksrc_st_lpc.c b/drivers/clocksource/clksrc_st_lpc.c
index 1ad1714..90f5bb8 100644
--- a/drivers/clocksource/clksrc_st_lpc.c
+++ b/drivers/clocksource/clksrc_st_lpc.c
@@ -16,6 +16,7 @@
 #include <linux/clocksource.h>
 #include <linux/init.h>
 #include <linux/of_address.h>
+#include <linux/sched_clock.h>
 #include <linux/slab.h>
 
 #include <dt-bindings/mfd/st-lpc.h>
@@ -38,6 +39,11 @@ static void st_clksrc_reset(void)
 	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)
 {
 	unsigned long rate;
@@ -47,6 +53,8 @@ static int __init st_clksrc_init(void)
 
 	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,
 				    "clksrc-st-lpc", rate, 300, 32,
 				    clocksource_mmio_readl_up);
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help