From: Clemens Ladisch Make sure that the RTC timer is in non-periodic mode; some stupid BIOS might have initialized it to periodic mode. Furthermore, don't set the SETVAL bit in the config register. This wouldn't have any effect unless the timer was in period mode (which it isn't), and then the actual timer frequency would be half that of the desired one because incrementing the comparator in the interrupt handler would be done after the hardware has already incremented it itself. Signed-off-by: Clemens Ladisch Acked-by: Venkatesh Pallipadi Signed-off-by: Andrew Morton --- arch/i386/kernel/time_hpet.c | 9 ++------- arch/x86_64/kernel/time.c | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff -puN arch/i386/kernel/time_hpet.c~hpet-rtc-fix-timer-config-register-accesses arch/i386/kernel/time_hpet.c --- devel/arch/i386/kernel/time_hpet.c~hpet-rtc-fix-timer-config-register-accesses 2005-10-11 00:34:50.000000000 -0700 +++ devel-akpm/arch/i386/kernel/time_hpet.c 2005-10-11 00:34:50.000000000 -0700 @@ -309,7 +309,8 @@ int hpet_rtc_timer_init(void) local_irq_restore(flags); cfg = hpet_readl(HPET_T1_CFG); - cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT; + cfg &= ~HPET_TN_PERIODIC; + cfg |= HPET_TN_ENABLE | HPET_TN_32BIT; hpet_writel(cfg, HPET_T1_CFG); return 1; @@ -335,12 +336,6 @@ static void hpet_rtc_timer_reinit(void) cnt = hpet_readl(HPET_T1_CMP); cnt += hpet_tick*HZ/hpet_rtc_int_freq; hpet_writel(cnt, HPET_T1_CMP); - - cfg = hpet_readl(HPET_T1_CFG); - cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT; - hpet_writel(cfg, HPET_T1_CFG); - - return; } /* diff -puN arch/x86_64/kernel/time.c~hpet-rtc-fix-timer-config-register-accesses arch/x86_64/kernel/time.c --- devel/arch/x86_64/kernel/time.c~hpet-rtc-fix-timer-config-register-accesses 2005-10-11 00:34:50.000000000 -0700 +++ devel-akpm/arch/x86_64/kernel/time.c 2005-10-11 00:34:50.000000000 -0700 @@ -1501,7 +1501,8 @@ int hpet_rtc_timer_init(void) local_irq_restore(flags); cfg = hpet_readl(HPET_T1_CFG); - cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT; + cfg &= ~HPET_TN_PERIODIC; + cfg |= HPET_TN_ENABLE | HPET_TN_32BIT; hpet_writel(cfg, HPET_T1_CFG); return 1; @@ -1527,12 +1528,6 @@ static void hpet_rtc_timer_reinit(void) cnt = hpet_readl(HPET_T1_CMP); cnt += hpet_tick*HZ/hpet_rtc_int_freq; hpet_writel(cnt, HPET_T1_CMP); - - cfg = hpet_readl(HPET_T1_CFG); - cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT; - hpet_writel(cfg, HPET_T1_CFG); - - return; } /* _