Skip to content

Commit

Permalink
x86: HPET: read back compare register before reading counter
Browse files Browse the repository at this point in the history
After fixing the u32 thinko I sill had occasional hickups on ATI chipsets
with small deltas. There seems to be a delay between writing the compare
register and the transffer to the internal register which triggers the
interrupt. Reading back the value makes sure, that it hit the internal
match register befor we compare against the counter value.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner committed Sep 6, 2008
1 parent f767625 commit 72d43d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/x86/kernel/hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ static int hpet_legacy_next_event(unsigned long delta,
cnt += (u32) delta;
hpet_writel(cnt, HPET_T0_CMP);

/*
* We need to read back the CMP register to make sure that
* what we wrote hit the chip before we compare it to the
* counter.
*/
WARN_ON((u32)hpet_readl(HPET_T0_CMP) != cnt);

return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
}

Expand Down

0 comments on commit 72d43d9

Please sign in to comment.