diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2009-02-20 18:10:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-22 12:01:17 -0500 |
commit | 8d6f0c8214928f7c5083dd54ecb69c5d615b516e (patch) | |
tree | dda3055efbd75e6cbf63ea5aef964d0543c77efb /arch/x86/kernel/hpet.c | |
parent | b98103a5597b87211a1c74077b06faeac554bedc (diff) |
x86: hpet: provide separate functions to stop and start the counter
By splitting up existing hpet_start_counter function.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Mark Hounschell <markh@compro.net>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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(); |