diff options
author | Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> | 2015-03-07 13:30:30 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 11:21:30 -0400 |
commit | a6071af914caec91d97d9db42a1bb0e9d6ad6890 (patch) | |
tree | 59a5fab286287203328d6b19372e9aac7332145a /arch/mips/kernel | |
parent | c41cef36530a4b4afa79981e8f1a31f49b871a90 (diff) |
MIPS: cevt-txx9: Implement read_sched_clock
Use txx9 up-counter for sched_clock source. This implementation will give
high resolution cputime accounting.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: macro@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9484/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/cevt-txx9.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c index 2ae08462e46e..723932441ecc 100644 --- a/arch/mips/kernel/cevt-txx9.c +++ b/arch/mips/kernel/cevt-txx9.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
17 | #include <linux/sched_clock.h> | ||
17 | #include <asm/time.h> | 18 | #include <asm/time.h> |
18 | #include <asm/txx9tmr.h> | 19 | #include <asm/txx9tmr.h> |
19 | 20 | ||
@@ -46,6 +47,11 @@ static struct txx9_clocksource txx9_clocksource = { | |||
46 | }, | 47 | }, |
47 | }; | 48 | }; |
48 | 49 | ||
50 | static u64 notrace txx9_read_sched_clock(void) | ||
51 | { | ||
52 | return __raw_readl(&txx9_clocksource.tmrptr->trr); | ||
53 | } | ||
54 | |||
49 | void __init txx9_clocksource_init(unsigned long baseaddr, | 55 | void __init txx9_clocksource_init(unsigned long baseaddr, |
50 | unsigned int imbusclk) | 56 | unsigned int imbusclk) |
51 | { | 57 | { |
@@ -61,6 +67,9 @@ void __init txx9_clocksource_init(unsigned long baseaddr, | |||
61 | __raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra); | 67 | __raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra); |
62 | __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr); | 68 | __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr); |
63 | txx9_clocksource.tmrptr = tmrptr; | 69 | txx9_clocksource.tmrptr = tmrptr; |
70 | |||
71 | sched_clock_register(txx9_read_sched_clock, TXX9_CLOCKSOURCE_BITS, | ||
72 | TIMER_CLK(imbusclk)); | ||
64 | } | 73 | } |
65 | 74 | ||
66 | struct txx9_clock_event_device { | 75 | struct txx9_clock_event_device { |