Commit a6071af9 authored by Deng-Cheng Zhu's avatar Deng-Cheng Zhu Committed by Ralf Baechle

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: default avatarDeng-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: default avatarRalf Baechle <ralf@linux-mips.org>
parent c41cef36
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/sched_clock.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/txx9tmr.h> #include <asm/txx9tmr.h>
...@@ -46,6 +47,11 @@ static struct txx9_clocksource txx9_clocksource = { ...@@ -46,6 +47,11 @@ static struct txx9_clocksource txx9_clocksource = {
}, },
}; };
static u64 notrace txx9_read_sched_clock(void)
{
return __raw_readl(&txx9_clocksource.tmrptr->trr);
}
void __init txx9_clocksource_init(unsigned long baseaddr, void __init txx9_clocksource_init(unsigned long baseaddr,
unsigned int imbusclk) unsigned int imbusclk)
{ {
...@@ -61,6 +67,9 @@ void __init txx9_clocksource_init(unsigned long baseaddr, ...@@ -61,6 +67,9 @@ void __init txx9_clocksource_init(unsigned long baseaddr,
__raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra); __raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra);
__raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr); __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr);
txx9_clocksource.tmrptr = tmrptr; txx9_clocksource.tmrptr = tmrptr;
sched_clock_register(txx9_read_sched_clock, TXX9_CLOCKSOURCE_BITS,
TIMER_CLK(imbusclk));
} }
struct txx9_clock_event_device { struct txx9_clock_event_device {
......
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