aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/jz4740
diff options
context:
space:
mode:
authorDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>2015-03-07 13:30:31 -0500
committerRalf Baechle <ralf@linux-mips.org>2015-04-01 11:21:31 -0400
commit944081ac53c38f7f2b86165553bf9d4aa9fd5d97 (patch)
treec2104c040f6b30926de7792aa5e0263ad1d55c18 /arch/mips/jz4740
parenta6071af914caec91d97d9db42a1bb0e9d6ad6890 (diff)
MIPS: jz4740: Implement read_sched_clock
Use jz4740 timer 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/9485/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/jz4740')
-rw-r--r--arch/mips/jz4740/time.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index 5e430ce9ac7e..72b0cecbc17c 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -18,6 +18,7 @@
18#include <linux/time.h> 18#include <linux/time.h>
19 19
20#include <linux/clockchips.h> 20#include <linux/clockchips.h>
21#include <linux/sched_clock.h>
21 22
22#include <asm/mach-jz4740/irq.h> 23#include <asm/mach-jz4740/irq.h>
23#include <asm/mach-jz4740/timer.h> 24#include <asm/mach-jz4740/timer.h>
@@ -43,6 +44,11 @@ static struct clocksource jz4740_clocksource = {
43 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 44 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
44}; 45};
45 46
47static u64 notrace jz4740_read_sched_clock(void)
48{
49 return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
50}
51
46static irqreturn_t jz4740_clockevent_irq(int irq, void *devid) 52static irqreturn_t jz4740_clockevent_irq(int irq, void *devid)
47{ 53{
48 struct clock_event_device *cd = devid; 54 struct clock_event_device *cd = devid;
@@ -126,6 +132,8 @@ void __init plat_time_init(void)
126 if (ret) 132 if (ret)
127 printk(KERN_ERR "Failed to register clocksource: %d\n", ret); 133 printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
128 134
135 sched_clock_register(jz4740_read_sched_clock, 16, clk_rate);
136
129 setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction); 137 setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction);
130 138
131 ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT; 139 ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT;