提交 08f26b1e 编写于 作者: R Russell King

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

Convert iop platforms to use the new sched_clock() infrastructure for
extending 32bit counters to full 64-bit nanoseconds.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 5c21b7ca
...@@ -992,6 +992,7 @@ config ARCH_ACORN ...@@ -992,6 +992,7 @@ config ARCH_ACORN
config PLAT_IOP config PLAT_IOP
bool bool
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select HAVE_SCHED_CLOCK
config PLAT_ORION config PLAT_ORION
bool bool
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/sched_clock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
...@@ -50,15 +51,21 @@ static struct clocksource iop_clocksource = { ...@@ -50,15 +51,21 @@ static struct clocksource iop_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
static DEFINE_CLOCK_DATA(cd);
/* /*
* IOP sched_clock() implementation via its clocksource. * IOP sched_clock() implementation via its clocksource.
*/ */
unsigned long long notrace sched_clock(void) unsigned long long notrace sched_clock(void)
{ {
cycle_t cyc = iop_clocksource_read(NULL); u32 cyc = 0xffffffffu - read_tcr1();
struct clocksource *cs = &iop_clocksource; return cyc_to_sched_clock(&cd, cyc, (u32)~0);
}
return clocksource_cyc2ns(cyc, cs->mult, cs->shift); static void notrace iop_update_sched_clock(void)
{
u32 cyc = 0xffffffffu - read_tcr1();
update_sched_clock(&cd, cyc, (u32)~0);
} }
/* /*
...@@ -144,6 +151,8 @@ void __init iop_init_time(unsigned long tick_rate) ...@@ -144,6 +151,8 @@ void __init iop_init_time(unsigned long tick_rate)
{ {
u32 timer_ctl; u32 timer_ctl;
init_sched_clock(&cd, iop_update_sched_clock, 32, tick_rate);
ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ); ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ);
iop_tick_rate = tick_rate; iop_tick_rate = tick_rate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册