diff options
Diffstat (limited to 'arch/x86/kernel/hpet.c')
| -rw-r--r-- | arch/x86/kernel/hpet.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 59fd3b6b1303..73deaffadd03 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -210,8 +210,8 @@ static void hpet_legacy_clockevent_register(void) | |||
| 210 | /* Calculate the min / max delta */ | 210 | /* Calculate the min / max delta */ |
| 211 | hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF, | 211 | hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF, |
| 212 | &hpet_clockevent); | 212 | &hpet_clockevent); |
| 213 | hpet_clockevent.min_delta_ns = clockevent_delta2ns(0x30, | 213 | /* 5 usec minimum reprogramming delta. */ |
| 214 | &hpet_clockevent); | 214 | hpet_clockevent.min_delta_ns = 5000; |
| 215 | 215 | ||
| 216 | /* | 216 | /* |
| 217 | * Start hpet with the boot cpu mask and make it | 217 | * Start hpet with the boot cpu mask and make it |
| @@ -270,15 +270,22 @@ static void hpet_legacy_set_mode(enum clock_event_mode mode, | |||
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | static int hpet_legacy_next_event(unsigned long delta, | 272 | static int hpet_legacy_next_event(unsigned long delta, |
| 273 | struct clock_event_device *evt) | 273 | struct clock_event_device *evt) |
| 274 | { | 274 | { |
| 275 | unsigned long cnt; | 275 | u32 cnt; |
| 276 | 276 | ||
| 277 | cnt = hpet_readl(HPET_COUNTER); | 277 | cnt = hpet_readl(HPET_COUNTER); |
| 278 | cnt += delta; | 278 | cnt += (u32) delta; |
| 279 | hpet_writel(cnt, HPET_T0_CMP); | 279 | hpet_writel(cnt, HPET_T0_CMP); |
| 280 | 280 | ||
| 281 | return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0) ? -ETIME : 0; | 281 | /* |
| 282 | * We need to read back the CMP register to make sure that | ||
| 283 | * what we wrote hit the chip before we compare it to the | ||
| 284 | * counter. | ||
| 285 | */ | ||
| 286 | WARN_ON((u32)hpet_readl(HPET_T0_CMP) != cnt); | ||
| 287 | |||
| 288 | return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; | ||
| 282 | } | 289 | } |
| 283 | 290 | ||
| 284 | /* | 291 | /* |
