]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/i386/kernel/cpu/cpufreq/longhaul.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6-omap-h63xx.git] / arch / i386 / kernel / cpu / cpufreq / longhaul.c
index 8ea545e35b3a57ce7eda144f55eb5fc329162d22..8ef38544453c24cb8488d3202ed23750890d4566 100644 (file)
@@ -64,8 +64,6 @@ static int dont_scale_voltage;
 #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longhaul", msg)
 
 
-#define __hlt()     __asm__ __volatile__("hlt": : :"memory")
-
 /* Clock ratios multiplied by 10 */
 static int clock_ratio[32];
 static int eblcr_table[32];
@@ -120,9 +118,10 @@ static int longhaul_get_cpu_mult(void)
 static void do_powersaver(union msr_longhaul *longhaul,
                        unsigned int clock_ratio_index)
 {
-       int version;
-       unsigned long flags;
        struct pci_dev *dev;
+       unsigned long flags;
+       unsigned int tmp_mask;
+       int version;
        int i;
        u16 pci_cmd;
        u16 cmd_state[64];
@@ -163,14 +162,18 @@ static void do_powersaver(union msr_longhaul *longhaul,
                }
        } while (dev != NULL);
 
-       local_irq_enable();
+       tmp_mask=inb(0x21);     /* works on C3. save mask. */
+       outb(0xFE,0x21);        /* TMR0 only */
+       outb(0xFF,0x80);        /* delay */
 
-       __hlt();
+       safe_halt();
        wrmsrl(MSR_VIA_LONGHAUL, longhaul->val);
-       __hlt();
+       halt();
 
        local_irq_disable();
 
+       outb(tmp_mask,0x21);    /* restore mask */
+
        /* restore pci bus master state for all devices */
        dev = NULL;
        i = 0;
@@ -244,9 +247,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
                bcr2.bits.CLOCKMUL = clock_ratio_index;
                local_irq_disable();
                wrmsrl (MSR_VIA_BCR2, bcr2.val);
-               local_irq_enable();
-
-               __hlt();
+               safe_halt();
 
                /* Disable software clock multiplier */
                rdmsrl (MSR_VIA_BCR2, bcr2.val);
@@ -466,11 +467,11 @@ static void __init longhaul_setup_voltagescaling(void)
        }
 
        if (vrmrev==0) {
-               dprintk ("VRM 8.5 \n");
+               dprintk ("VRM 8.5\n");
                memcpy (voltage_table, vrm85scales, sizeof(voltage_table));
                numvscales = (voltage_table[maxvid]-voltage_table[minvid])/25;
        } else {
-               dprintk ("Mobile VRM \n");
+               dprintk ("Mobile VRM\n");
                memcpy (voltage_table, mobilevrmscales, sizeof(voltage_table));
                numvscales = (voltage_table[maxvid]-voltage_table[minvid])/5;
        }
@@ -619,7 +620,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
                longhaul_setup_voltagescaling();
 
        policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
-       policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+       policy->cpuinfo.transition_latency = 200000;    /* nsec */
        policy->cur = calc_speed(longhaul_get_cpu_mult());
 
        ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table);