]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/hpet.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6] / arch / x86 / kernel / hpet.c
index ce3bcc4334d532d19467f470e7b8f4484dae12a0..53303f2e547582e282f5a941cc2311b79a821238 100644 (file)
@@ -69,12 +69,15 @@ static inline void hpet_clear_mapping(void)
  * HPET command line enable / disable
  */
 static int boot_hpet_disable;
+int hpet_force_user;
 
 static int __init hpet_setup(char* str)
 {
        if (str) {
                if (!strncmp("disable", str, 7))
                        boot_hpet_disable = 1;
+               if (!strncmp("force", str, 5))
+                       hpet_force_user = 1;
        }
        return 1;
 }
@@ -164,6 +167,7 @@ static struct clock_event_device hpet_clockevent = {
        .set_next_event = hpet_legacy_next_event,
        .shift          = 32,
        .irq            = 0,
+       .rating         = 50,
 };
 
 static void hpet_start_counter(void)
@@ -178,6 +182,17 @@ static void hpet_start_counter(void)
        hpet_writel(cfg, HPET_CFG);
 }
 
+static void hpet_resume_device(void)
+{
+       force_hpet_resume();
+}
+
+static void hpet_restart_counter(void)
+{
+       hpet_resume_device();
+       hpet_start_counter();
+}
+
 static void hpet_enable_legacy_int(void)
 {
        unsigned long cfg = hpet_readl(HPET_CFG);
@@ -299,7 +314,7 @@ static struct clocksource clocksource_hpet = {
        .mask           = HPET_MASK,
        .shift          = HPET_SHIFT,
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
-       .resume         = hpet_start_counter,
+       .resume         = hpet_restart_counter,
 #ifdef CONFIG_X86_64
        .vread          = vread_hpet,
 #endif
@@ -338,7 +353,7 @@ static int hpet_clocksource_register(void)
         *
         * hpet period is in femto seconds per cycle
         * so we need to convert this to ns/cyc units
-        * aproximated by mult/2^shift
+        * approximated by mult/2^shift
         *
         *  fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift
         *  fsec/cyc * 1ns/1000000fsec * 2^shift = mult
@@ -412,10 +427,21 @@ out_nohpet:
  */
 static __init int hpet_late_init(void)
 {
-       if (!is_hpet_capable())
+       if (boot_hpet_disable)
                return -ENODEV;
 
+       if (!hpet_address) {
+               if (!force_hpet_address)
+                       return -ENODEV;
+
+               hpet_address = force_hpet_address;
+               hpet_enable();
+               if (!hpet_virt_address)
+                       return -ENODEV;
+       }
+
        hpet_reserve_platform_timers(hpet_readl(HPET_ID));
+
        return 0;
 }
 fs_initcall(hpet_late_init);