diff options
Diffstat (limited to 'arch/x86/kernel/hpet.c')
-rw-r--r-- | arch/x86/kernel/hpet.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 1d86ca3c1f97..7ae1f1e8b9b7 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -231,27 +231,37 @@ static struct clock_event_device hpet_clockevent = { | |||
231 | .rating = 50, | 231 | .rating = 50, |
232 | }; | 232 | }; |
233 | 233 | ||
234 | static void hpet_start_counter(void) | 234 | static void hpet_stop_counter(void) |
235 | { | 235 | { |
236 | unsigned long cfg = hpet_readl(HPET_CFG); | 236 | unsigned long cfg = hpet_readl(HPET_CFG); |
237 | |||
238 | cfg &= ~HPET_CFG_ENABLE; | 237 | cfg &= ~HPET_CFG_ENABLE; |
239 | hpet_writel(cfg, HPET_CFG); | 238 | hpet_writel(cfg, HPET_CFG); |
240 | hpet_writel(0, HPET_COUNTER); | 239 | hpet_writel(0, HPET_COUNTER); |
241 | hpet_writel(0, HPET_COUNTER + 4); | 240 | hpet_writel(0, HPET_COUNTER + 4); |
241 | } | ||
242 | |||
243 | static void hpet_start_counter(void) | ||
244 | { | ||
245 | unsigned long cfg = hpet_readl(HPET_CFG); | ||
242 | cfg |= HPET_CFG_ENABLE; | 246 | cfg |= HPET_CFG_ENABLE; |
243 | hpet_writel(cfg, HPET_CFG); | 247 | hpet_writel(cfg, HPET_CFG); |
244 | } | 248 | } |
245 | 249 | ||
250 | static void hpet_restart_counter(void) | ||
251 | { | ||
252 | hpet_stop_counter(); | ||
253 | hpet_start_counter(); | ||
254 | } | ||
255 | |||
246 | static void hpet_resume_device(void) | 256 | static void hpet_resume_device(void) |
247 | { | 257 | { |
248 | force_hpet_resume(); | 258 | force_hpet_resume(); |
249 | } | 259 | } |
250 | 260 | ||
251 | static void hpet_restart_counter(void) | 261 | static void hpet_resume_counter(void) |
252 | { | 262 | { |
253 | hpet_resume_device(); | 263 | hpet_resume_device(); |
254 | hpet_start_counter(); | 264 | hpet_restart_counter(); |
255 | } | 265 | } |
256 | 266 | ||
257 | static void hpet_enable_legacy_int(void) | 267 | static void hpet_enable_legacy_int(void) |
@@ -738,7 +748,7 @@ static struct clocksource clocksource_hpet = { | |||
738 | .mask = HPET_MASK, | 748 | .mask = HPET_MASK, |
739 | .shift = HPET_SHIFT, | 749 | .shift = HPET_SHIFT, |
740 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 750 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
741 | .resume = hpet_restart_counter, | 751 | .resume = hpet_resume_counter, |
742 | #ifdef CONFIG_X86_64 | 752 | #ifdef CONFIG_X86_64 |
743 | .vread = vread_hpet, | 753 | .vread = vread_hpet, |
744 | #endif | 754 | #endif |
@@ -750,7 +760,7 @@ static int hpet_clocksource_register(void) | |||
750 | cycle_t t1; | 760 | cycle_t t1; |
751 | 761 | ||
752 | /* Start the counter */ | 762 | /* Start the counter */ |
753 | hpet_start_counter(); | 763 | hpet_restart_counter(); |
754 | 764 | ||
755 | /* Verify whether hpet counter works */ | 765 | /* Verify whether hpet counter works */ |
756 | t1 = read_hpet(); | 766 | t1 = read_hpet(); |