Skip to content

Commit

Permalink
MIPS: csrc-sb1250: Implement read_sched_clock
Browse files Browse the repository at this point in the history
Use sb1250 hpt 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/9488/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Deng-Cheng Zhu authored and Ralf Baechle committed Apr 1, 2015
1 parent 0dc886a commit 262f1c9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/mips/kernel/csrc-sb1250.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* GNU General Public License for more details.
*/
#include <linux/clocksource.h>
#include <linux/sched_clock.h>

#include <asm/addrspace.h>
#include <asm/io.h>
Expand Down Expand Up @@ -53,6 +54,11 @@ struct clocksource bcm1250_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

static u64 notrace sb1250_read_sched_clock(void)
{
return sb1250_hpt_get_cycles();
}

void __init sb1250_clocksource_init(void)
{
struct clocksource *cs = &bcm1250_clocksource;
Expand All @@ -69,4 +75,6 @@ void __init sb1250_clocksource_init(void)
R_SCD_TIMER_CFG)));

clocksource_register_hz(cs, V_SCD_TIMER_FREQ);

sched_clock_register(sb1250_read_sched_clock, 23, V_SCD_TIMER_FREQ);
}

0 comments on commit 262f1c9

Please sign in to comment.