diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-10-31 05:06:46 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-10-31 05:06:46 -0500 |
commit | 1f04c0a24b2f3cfe89c802a24396263623e3512d (patch) | |
tree | d7e2216b6e65b833c0c2b79b478d13ce17dbf296 /arch/i386/kernel/time_hpet.c | |
parent | 07b188ab773e183871e57b33ae37bf635c9f12ba (diff) | |
parent | e2f2e58e7968f8446b1078a20a18bf8ea12b4fbc (diff) |
Merge branch 'master' of /usr/src/ntfs-2.6/
Diffstat (limited to 'arch/i386/kernel/time_hpet.c')
-rw-r--r-- | arch/i386/kernel/time_hpet.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c index 658c0629ba6a..9caeaa315cd7 100644 --- a/arch/i386/kernel/time_hpet.c +++ b/arch/i386/kernel/time_hpet.c | |||
@@ -275,6 +275,7 @@ static unsigned long PIE_freq = DEFAULT_RTC_INT_FREQ; | |||
275 | static unsigned long PIE_count; | 275 | static unsigned long PIE_count; |
276 | 276 | ||
277 | static unsigned long hpet_rtc_int_freq; /* RTC interrupt frequency */ | 277 | static unsigned long hpet_rtc_int_freq; /* RTC interrupt frequency */ |
278 | static unsigned int hpet_t1_cmp; /* cached comparator register */ | ||
278 | 279 | ||
279 | /* | 280 | /* |
280 | * Timer 1 for RTC, we do not use periodic interrupt feature, | 281 | * Timer 1 for RTC, we do not use periodic interrupt feature, |
@@ -306,10 +307,12 @@ int hpet_rtc_timer_init(void) | |||
306 | cnt = hpet_readl(HPET_COUNTER); | 307 | cnt = hpet_readl(HPET_COUNTER); |
307 | cnt += ((hpet_tick*HZ)/hpet_rtc_int_freq); | 308 | cnt += ((hpet_tick*HZ)/hpet_rtc_int_freq); |
308 | hpet_writel(cnt, HPET_T1_CMP); | 309 | hpet_writel(cnt, HPET_T1_CMP); |
310 | hpet_t1_cmp = cnt; | ||
309 | local_irq_restore(flags); | 311 | local_irq_restore(flags); |
310 | 312 | ||
311 | cfg = hpet_readl(HPET_T1_CFG); | 313 | cfg = hpet_readl(HPET_T1_CFG); |
312 | cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT; | 314 | cfg &= ~HPET_TN_PERIODIC; |
315 | cfg |= HPET_TN_ENABLE | HPET_TN_32BIT; | ||
313 | hpet_writel(cfg, HPET_T1_CFG); | 316 | hpet_writel(cfg, HPET_T1_CFG); |
314 | 317 | ||
315 | return 1; | 318 | return 1; |
@@ -319,8 +322,12 @@ static void hpet_rtc_timer_reinit(void) | |||
319 | { | 322 | { |
320 | unsigned int cfg, cnt; | 323 | unsigned int cfg, cnt; |
321 | 324 | ||
322 | if (!(PIE_on | AIE_on | UIE_on)) | 325 | if (unlikely(!(PIE_on | AIE_on | UIE_on))) { |
326 | cfg = hpet_readl(HPET_T1_CFG); | ||
327 | cfg &= ~HPET_TN_ENABLE; | ||
328 | hpet_writel(cfg, HPET_T1_CFG); | ||
323 | return; | 329 | return; |
330 | } | ||
324 | 331 | ||
325 | if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ)) | 332 | if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ)) |
326 | hpet_rtc_int_freq = PIE_freq; | 333 | hpet_rtc_int_freq = PIE_freq; |
@@ -328,15 +335,10 @@ static void hpet_rtc_timer_reinit(void) | |||
328 | hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ; | 335 | hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ; |
329 | 336 | ||
330 | /* It is more accurate to use the comparator value than current count.*/ | 337 | /* It is more accurate to use the comparator value than current count.*/ |
331 | cnt = hpet_readl(HPET_T1_CMP); | 338 | cnt = hpet_t1_cmp; |
332 | cnt += hpet_tick*HZ/hpet_rtc_int_freq; | 339 | cnt += hpet_tick*HZ/hpet_rtc_int_freq; |
333 | hpet_writel(cnt, HPET_T1_CMP); | 340 | hpet_writel(cnt, HPET_T1_CMP); |
334 | 341 | hpet_t1_cmp = cnt; | |
335 | cfg = hpet_readl(HPET_T1_CFG); | ||
336 | cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT; | ||
337 | hpet_writel(cfg, HPET_T1_CFG); | ||
338 | |||
339 | return; | ||
340 | } | 342 | } |
341 | 343 | ||
342 | /* | 344 | /* |