Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 225837
b: refs/heads/master
c: 7ce8301
h: refs/heads/master
i:
  225835: d8d339c
v: v3
  • Loading branch information
Russell King committed Dec 22, 2010
1 parent 0cdf34b commit 3192c4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 28bb7bc61a8cd48716d38d9c153fdc524f09870a
refs/heads/master: 7ce830188199c23aaeaf0c5ccc28b73c32b6df02
1 change: 1 addition & 0 deletions trunk/arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ config ARCH_PXA
select COMMON_CLKDEV
select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS
select HAVE_SCHED_CLOCK
select TICK_ONESHOT
select PLAT_PXA
select SPARSE_IRQ
Expand Down
29 changes: 9 additions & 20 deletions trunk/arch/arm/mach-pxa/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#include <linux/interrupt.h>
#include <linux/clockchips.h>
#include <linux/sched.h>
#include <linux/cnt32_to_63.h>

#include <asm/div64.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
#include <asm/sched_clock.h>
#include <mach/regs-ost.h>

/*
Expand All @@ -32,29 +32,18 @@
* long as there is always less than 582 seconds between successive
* calls to sched_clock() which should always be the case in practice.
*/
static DEFINE_CLOCK_DATA(cd);

#define OSCR2NS_SCALE_FACTOR 10

static unsigned long oscr2ns_scale;

static void __init set_oscr2ns_scale(unsigned long oscr_rate)
unsigned long long notrace sched_clock(void)
{
unsigned long long v = 1000000000ULL << OSCR2NS_SCALE_FACTOR;
do_div(v, oscr_rate);
oscr2ns_scale = v;
/*
* We want an even value to automatically clear the top bit
* returned by cnt32_to_63() without an additional run time
* instruction. So if the LSB is 1 then round it up.
*/
if (oscr2ns_scale & 1)
oscr2ns_scale++;
u32 cyc = OSCR;
return cyc_to_sched_clock(&cd, cyc, (u32)~0);
}

unsigned long long notrace sched_clock(void)
static void notrace pxa_update_sched_clock(void)
{
unsigned long long v = cnt32_to_63(OSCR);
return (v * oscr2ns_scale) >> OSCR2NS_SCALE_FACTOR;
u32 cyc = OSCR;
update_sched_clock(&cd, cyc, (u32)~0);
}


Expand Down Expand Up @@ -144,7 +133,7 @@ static void __init pxa_timer_init(void)
OIER = 0;
OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3;

set_oscr2ns_scale(clock_tick_rate);
init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate);

ckevt_pxa_osmr0.mult =
div_sc(clock_tick_rate, NSEC_PER_SEC, ckevt_pxa_osmr0.shift);
Expand Down

0 comments on commit 3192c4d

Please sign in to comment.