提交 5c21b7ca 编写于 作者: R Russell King

ARM: u300: convert sched_clock() to use new infrastructure

Convert u300 to use the new sched_clock() infrastructure for extending
32bit counters to full 64-bit nanoseconds.
Acked-by: NLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 e3f4c0ab
...@@ -790,6 +790,7 @@ config ARCH_U300 ...@@ -790,6 +790,7 @@ config ARCH_U300
bool "ST-Ericsson U300 Series" bool "ST-Ericsson U300 Series"
depends on MMU depends on MMU
select CPU_ARM926T select CPU_ARM926T
select HAVE_SCHED_CLOCK
select HAVE_TCM select HAVE_TCM
select ARM_AMBA select ARM_AMBA
select ARM_VIC select ARM_VIC
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
/* Generic stuff */ /* Generic stuff */
#include <asm/sched_clock.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
...@@ -353,12 +354,18 @@ static struct clocksource clocksource_u300_1mhz = { ...@@ -353,12 +354,18 @@ static struct clocksource clocksource_u300_1mhz = {
* this wraps around for now, since it is just a relative time * this wraps around for now, since it is just a relative time
* stamp. (Inspired by OMAP implementation.) * stamp. (Inspired by OMAP implementation.)
*/ */
static DEFINE_CLOCK_DATA(cd);
unsigned long long notrace sched_clock(void) unsigned long long notrace sched_clock(void)
{ {
return clocksource_cyc2ns(clocksource_u300_1mhz.read( u32 cyc = readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
&clocksource_u300_1mhz), return cyc_to_sched_clock(&cd, cyc, (u32)~0);
clocksource_u300_1mhz.mult, }
clocksource_u300_1mhz.shift);
static void notrace u300_update_sched_clock(void)
{
u32 cyc = readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
update_sched_clock(&cd, cyc, (u32)~0);
} }
...@@ -376,6 +383,8 @@ static void __init u300_timer_init(void) ...@@ -376,6 +383,8 @@ static void __init u300_timer_init(void)
clk_enable(clk); clk_enable(clk);
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
init_sched_clock(&cd, u300_update_sched_clock, 32, rate);
/* /*
* Disable the "OS" and "DD" timers - these are designed for Symbian! * Disable the "OS" and "DD" timers - these are designed for Symbian!
* Example usage in cnh1601578 cpu subsystem pd_timer_app.c * Example usage in cnh1601578 cpu subsystem pd_timer_app.c
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册