Commit 5f819949 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Linus Torvalds

[PATCH] hpet-RTC: fix timer config register accesses

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: default avatarClemens Ladisch <clemens@ladisch.de>
Acked-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f00c96f3
...@@ -309,7 +309,8 @@ int hpet_rtc_timer_init(void) ...@@ -309,7 +309,8 @@ int hpet_rtc_timer_init(void)
local_irq_restore(flags); local_irq_restore(flags);
cfg = hpet_readl(HPET_T1_CFG); 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); hpet_writel(cfg, HPET_T1_CFG);
return 1; return 1;
...@@ -335,12 +336,6 @@ static void hpet_rtc_timer_reinit(void) ...@@ -335,12 +336,6 @@ static void hpet_rtc_timer_reinit(void)
cnt = hpet_readl(HPET_T1_CMP); cnt = hpet_readl(HPET_T1_CMP);
cnt += hpet_tick*HZ/hpet_rtc_int_freq; cnt += hpet_tick*HZ/hpet_rtc_int_freq;
hpet_writel(cnt, HPET_T1_CMP); 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;
} }
/* /*
......
...@@ -1128,7 +1128,8 @@ int hpet_rtc_timer_init(void) ...@@ -1128,7 +1128,8 @@ int hpet_rtc_timer_init(void)
local_irq_restore(flags); local_irq_restore(flags);
cfg = hpet_readl(HPET_T1_CFG); 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); hpet_writel(cfg, HPET_T1_CFG);
return 1; return 1;
...@@ -1154,12 +1155,6 @@ static void hpet_rtc_timer_reinit(void) ...@@ -1154,12 +1155,6 @@ static void hpet_rtc_timer_reinit(void)
cnt = hpet_readl(HPET_T1_CMP); cnt = hpet_readl(HPET_T1_CMP);
cnt += hpet_tick*HZ/hpet_rtc_int_freq; cnt += hpet_tick*HZ/hpet_rtc_int_freq;
hpet_writel(cnt, HPET_T1_CMP); 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;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment