Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57457
b: refs/heads/master
c: 4342f4a
h: refs/heads/master
i:
  57455: 8610284
v: v3
  • Loading branch information
Greg Ungerer authored and Linus Torvalds committed Jun 9, 2007
1 parent 170fe05 commit 4587104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 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: 4a0df2ef4569ac57cb18cd97e34c0c4733e829d9
refs/heads/master: 4342f4ace2335d4fa9fe52b4cceca979413470b2
10 changes: 6 additions & 4 deletions trunk/arch/m68knommu/platform/5307/timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ void coldfire_tick(void)

/***************************************************************************/

static int ticks_per_intr;

void coldfire_timer_init(irq_handler_t handler)
{
__raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
__raw_writetrr(((MCF_BUSCLK / 16) / HZ), TA(MCFTIMER_TRR));
ticks_per_intr = (MCF_BUSCLK / 16) / HZ;
__raw_writetrr(ticks_per_intr - 1, TA(MCFTIMER_TRR));
__raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));

Expand All @@ -81,11 +84,10 @@ void coldfire_timer_init(irq_handler_t handler)

unsigned long coldfire_timer_offset(void)
{
unsigned long trr, tcn, offset;
unsigned long tcn, offset;

tcn = __raw_readw(TA(MCFTIMER_TCN));
trr = __raw_readtrr(TA(MCFTIMER_TRR));
offset = (tcn * (1000000 / HZ)) / trr;
offset = ((tcn + 1) * (1000000 / HZ)) / ticks_per_intr;

/* Check if we just wrapped the counters and maybe missed a tick */
if ((offset < (1000000 / HZ / 2)) && mcf_timerirqpending(1))
Expand Down

0 comments on commit 4587104

Please sign in to comment.