Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243484
b: refs/heads/master
c: c124bef
h: refs/heads/master
v: v3
  • Loading branch information
Jan Weitzel authored and Sascha Hauer committed Mar 23, 2011
1 parent 542a226 commit d6b1d47
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93b20e4fdbe1ddc4bef79d968cb1ba453324a499
refs/heads/master: c124befc0d1981f5f3e438d06313fa8270a9edb6
1 change: 1 addition & 0 deletions trunk/arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ config ARCH_MXC
select GENERIC_CLOCKEVENTS
select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP
select HAVE_SCHED_CLOCK
help
Support for Freescale MXC/iMX-based family of processors

Expand Down
16 changes: 16 additions & 0 deletions trunk/arch/arm/plat-mxc/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/clk.h>

#include <mach/hardware.h>
#include <asm/sched_clock.h>
#include <asm/mach/time.h>
#include <mach/common.h>

Expand Down Expand Up @@ -128,6 +129,20 @@ static struct clocksource clocksource_mxc = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

static DEFINE_CLOCK_DATA(cd);
unsigned long long notrace sched_clock(void)
{
cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);

return cyc_to_sched_clock(&cd, cyc, (u32)~0);
}

static void notrace mxc_update_sched_clock(void)
{
cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
update_sched_clock(&cd, cyc, (u32)~0);
}

static int __init mxc_clocksource_init(struct clk *timer_clk)
{
unsigned int c = clk_get_rate(timer_clk);
Expand All @@ -137,6 +152,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
else
clocksource_mxc.read = mx1_2_get_cycles;

init_sched_clock(&cd, mxc_update_sched_clock, 32, c);
clocksource_register_hz(&clocksource_mxc, c);

return 0;
Expand Down

0 comments on commit d6b1d47

Please sign in to comment.