]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86: HPET: read back compare register before reading counter
authorThomas Gleixner <tglx@linutronix.de>
Sat, 6 Sep 2008 01:06:08 +0000 (03:06 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Oct 2008 03:23:05 +0000 (20:23 -0700)
commit 72d43d9bc9210d24d09202eaf219eac09e17b339 upstream

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kernel/hpet.c

index e530acb967635b99115c38c060d09666d57536ab..0f3e379fe74482bcd061cb9881487a4355cf2f3f 100644 (file)
@@ -291,6 +291,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;
 }