summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@libc.org>2016-05-27 00:36:37 +0000
committerRich Felker <dalias@libc.org>2016-06-08 22:07:43 +0000
commit50e6f4d7322a9da1b02fe70456f646175e553f04 (patch)
treed6a1234036faa906025b19075543fb9e125507df
parent4a13ba493efb0e17d7fbeba7198d62745cef5dfa (diff)
downloadlinux-sh-50e6f4d7322a9da1b02fe70456f646175e553f04.tar.gz
jcore sched_clock
-rw-r--r--drivers/clocksource/jcore-pit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
index dd78fcd0f7c7..f3637b342aec 100644
--- a/drivers/clocksource/jcore-pit.c
+++ b/drivers/clocksource/jcore-pit.c
@@ -13,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/clockchips.h>
#include <linux/clocksource.h>
+#include <linux/sched_clock.h>
#include <linux/cpu.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -51,6 +52,8 @@ struct jcore_pit_nb {
struct jcore_pit __percpu *pit_percpu;
};
+static struct clocksource *jcore_cs;
+
static cycle_t jcore_clocksource_read(struct clocksource *cs)
{
__iomem void *base =
@@ -70,6 +73,11 @@ static cycle_t jcore_clocksource_read(struct clocksource *cs)
return ((u64)sechi << 32 | seclo) * NSEC_PER_SEC + nsec;
}
+static notrace u64 jcore_sched_clock_read(void)
+{
+ return jcore_clocksource_read(jcore_cs);
+}
+
static int jcore_pit_disable(struct jcore_pit *pit)
{
__raw_writel(0, pit->base + REG_PITEN);
@@ -189,6 +197,7 @@ static void __init jcore_pit_init(struct device_node *node)
pr_err("Failed to allocate memory for clocksource\n");
goto out;
}
+ jcore_cs = &cs->cs;
cs->base = pit_base;
cs->cs.name = "jcore_pit_cs";
@@ -205,6 +214,8 @@ static void __init jcore_pit_init(struct device_node *node)
goto out;
}
+ sched_clock_register(jcore_sched_clock_read, 64, NSEC_PER_SEC);
+
pit_percpu = alloc_percpu(struct jcore_pit);
if (!pit_percpu) {
pr_err("Failed to allocate memory for clock event device\n");