Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6807
b: refs/heads/master
c: 569d2c3
h: refs/heads/master
i:
  6805: 5ba1964
  6803: dcfc543
  6799: c2cd2af
v: v3
  • Loading branch information
Nicolas Pitre authored and Russell King committed Sep 1, 2005
1 parent 3868f1a commit 51dd1f7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 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: 20e912680842504ab4633deaa644c2b855ad3d44
refs/heads/master: 569d2c34dcf259b07977835492aa8813d1168230
4 changes: 2 additions & 2 deletions trunk/arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ config NO_IDLE_HZ

Please note that dynamic tick may affect the accuracy of
timekeeping on some platforms depending on the implementation.
Currently at least OMAP and PXA2xx platforms are known to have
accurate timekeeping with dynamic tick.
Currently at least OMAP, PXA2xx and SA11x0 platforms are known
to have accurate timekeeping with dynamic tick.

config ARCH_DISCONTIGMEM_ENABLE
bool
Expand Down
51 changes: 51 additions & 0 deletions trunk/arch/arm/mach-sa1100/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,25 @@ static unsigned long sa1100_gettimeoffset (void)
return usec;
}

#ifdef CONFIG_NO_IDLE_HZ
static unsigned long initial_match;
static int match_posponed;
#endif

static irqreturn_t
sa1100_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned int next_match;

write_seqlock(&xtime_lock);

#ifdef CONFIG_NO_IDLE_HZ
if (match_posponed) {
match_posponed = 0;
OSMR0 = initial_match;
}
#endif

/*
* Loop until we get ahead of the free running timer.
* This ensures an exact clock tick count and time accuracy.
Expand Down Expand Up @@ -119,6 +131,42 @@ static void __init sa1100_timer_init(void)
OSCR = 0; /* initialize free-running timer, force first match */
}

#ifdef CONFIG_NO_IDLE_HZ
static int sa1100_dyn_tick_enable_disable(void)
{
/* nothing to do */
return 0;
}

static void sa1100_dyn_tick_reprogram(unsigned long ticks)
{
if (ticks > 1) {
initial_match = OSMR0;
OSMR0 = initial_match + ticks * LATCH;
match_posponed = 1;
}
}

static irqreturn_t
sa1100_dyn_tick_handler(int irq, void *dev_id, struct pt_regs *regs)
{
if (match_posponed) {
match_posponed = 0;
OSMR0 = initial_match;
if ((signed long)(initial_match - OSCR) <= 0)
return sa1100_timer_interrupt(irq, dev_id, regs);
}
return IRQ_NONE;
}

static struct dyn_tick_timer sa1100_dyn_tick = {
.enable = sa1100_dyn_tick_enable_disable,
.disable = sa1100_dyn_tick_enable_disable,
.reprogram = sa1100_dyn_tick_reprogram,
.handler = sa1100_dyn_tick_handler,
};
#endif

#ifdef CONFIG_PM
unsigned long osmr[4], oier;

Expand Down Expand Up @@ -155,4 +203,7 @@ struct sys_timer sa1100_timer = {
.suspend = sa1100_timer_suspend,
.resume = sa1100_timer_resume,
.offset = sa1100_gettimeoffset,
#ifdef CONFIG_NO_IDLE_HZ
.dyn_tick = &sa1100_dyn_tick,
#endif
};

0 comments on commit 51dd1f7

Please sign in to comment.