Skip to content

Commit

Permalink
xtensa: ccount based sched_clock
Browse files Browse the repository at this point in the history
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
  • Loading branch information
Baruch Siach authored and Chris Zankel committed Jul 8, 2013
1 parent 925f553 commit e3f4329
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config XTENSA
select VIRT_TO_BUS
select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES
select GENERIC_SCHED_CLOCK
select MODULES_USE_ELF_RELA
select GENERIC_PCI_IOMAP
select ARCH_WANT_IPC_PARSE_VERSION
Expand Down
8 changes: 8 additions & 0 deletions arch/xtensa/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/profile.h>
#include <linux/delay.h>
#include <linux/irqdomain.h>
#include <linux/sched_clock.h>

#include <asm/timex.h>
#include <asm/platform.h>
Expand All @@ -37,6 +38,11 @@ static cycle_t ccount_read(struct clocksource *cs)
return (cycle_t)get_ccount();
}

static u32 notrace ccount_sched_clock_read(void)
{
return get_ccount();
}

static struct clocksource ccount_clocksource = {
.name = "ccount",
.rating = 200,
Expand Down Expand Up @@ -134,6 +140,8 @@ void __init time_init(void)
0xffffffff);
setup_irq(ccount_timer.evt.irq, &timer_irqaction);
ccount_timer.irq_enabled = 1;

setup_sched_clock(ccount_sched_clock_read, 32, ccount_freq);
}

/*
Expand Down

0 comments on commit e3f4329

Please sign in to comment.