Commit 9d19aa36 authored by Dave Jones's avatar Dave Jones

Merge delerium.codemonkey.org.uk:/mnt/nfs/sepia/bar/src/kernel/2.6/trees/bk-linus

into delerium.codemonkey.org.uk:/mnt/nfs/sepia/bar/src/kernel/2.6/trees/cpufreq
parents af3ad153 690c11be
...@@ -28,30 +28,34 @@ ...@@ -28,30 +28,34 @@
* with 'Suspend Modulation OFF Count Register' * with 'Suspend Modulation OFF Count Register'
* and 'Suspend Modulation ON Count Register'. * and 'Suspend Modulation ON Count Register'.
* These registers are 8bit counters that represent the number of * These registers are 8bit counters that represent the number of
* 32us intervals which the SUSP# pin is asserted/de-asserted to the * 32us intervals which the SUSP# pin is asserted(ON)/de-asserted(OFF)
* processor. * to the processor.
* *
* These counters define a ratio which is the effective frequency * These counters define a ratio which is the effective frequency
* of operation of the system. * of operation of the system.
* *
* On Count * OFF Count
* F_eff = Fgx * ---------------------- * F_eff = Fgx * ----------------------
* On Count + Off Count * OFF Count + ON Count
* *
* 0 <= On Count, Off Count <= 255 * 0 <= On Count, Off Count <= 255
* *
* From these limits, we can get register values * From these limits, we can get register values
* *
* on_duration + off_duration <= MAX_DURATION * off_duration + on_duration <= MAX_DURATION
* off_duration = on_duration * (stock_freq - freq) / freq * on_duration = off_duration * (stock_freq - freq) / freq
* *
* on_duration = (freq * DURATION) / stock_freq * off_duration = (freq * DURATION) / stock_freq
* off_duration = DURATION - on_duration * on_duration = DURATION - off_duration
* *
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* *
* ChangeLog: * ChangeLog:
* Dec. 12, 2003 Hiroshi Miura <miura@da-cha.org>
* - fix on/off register mistake
* - fix cpu_khz calc when it stops cpu modulation.
*
* Dec. 11, 2002 Hiroshi Miura <miura@da-cha.org> * Dec. 11, 2002 Hiroshi Miura <miura@da-cha.org>
* - rewrite for Cyrix MediaGX Cx5510/5520 and * - rewrite for Cyrix MediaGX Cx5510/5520 and
* NatSemi Geode Cs5530(A). * NatSemi Geode Cs5530(A).
...@@ -233,13 +237,13 @@ static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, u8 *off ...@@ -233,13 +237,13 @@ static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, u8 *off
int old_tmp_freq = stock_freq; int old_tmp_freq = stock_freq;
int tmp_freq; int tmp_freq;
*on_duration=1; *off_duration=1;
*off_duration=0; *on_duration=0;
for (i=max_duration; i>0; i--) { for (i=max_duration; i>0; i--) {
tmp_on = ((khz * i) / stock_freq) & 0xff; tmp_off = ((khz * i) / stock_freq) & 0xff;
tmp_off = i - tmp_on; tmp_on = i - tmp_off;
tmp_freq = (stock_freq * tmp_on) / i; tmp_freq = (stock_freq * tmp_off) / i;
/* if this relation is closer to khz, use this. If it's equal, /* if this relation is closer to khz, use this. If it's equal,
* prefer it, too - lower latency */ * prefer it, too - lower latency */
if (abs(tmp_freq - khz) <= abs(old_tmp_freq - khz)) { if (abs(tmp_freq - khz) <= abs(old_tmp_freq - khz)) {
...@@ -273,20 +277,10 @@ static void gx_set_cpuspeed(unsigned int khz) ...@@ -273,20 +277,10 @@ static void gx_set_cpuspeed(unsigned int khz)
freqs.new = new_khz; freqs.new = new_khz;
if (new_khz == stock_freq) { /* if new khz == 100% of CPU speed, it is special case */
local_irq_save(flags);
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
pci_write_config_byte(gx_params->cs55x0, PCI_SUSCFG, (gx_params->pci_suscfg & ~(SUSMOD)));
pci_read_config_byte(gx_params->cs55x0, PCI_SUSCFG, &(gx_params->pci_suscfg));
local_irq_restore(flags);
dprintk("suspend modulation disabled: cpu runs 100 percent speed.\n");
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
return;
}
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
local_irq_save(flags); local_irq_save(flags);
if (new_khz != stock_freq) { /* if new khz == 100% of CPU speed, it is special case */
switch (gx_params->cs55x0->device) { switch (gx_params->cs55x0->device) {
case PCI_DEVICE_ID_CYRIX_5530_LEGACY: case PCI_DEVICE_ID_CYRIX_5530_LEGACY:
pmer1 = gx_params->pci_pmer1 | IRQ_SPDUP | VID_SPDUP; pmer1 = gx_params->pci_pmer1 | IRQ_SPDUP | VID_SPDUP;
...@@ -304,12 +298,17 @@ static void gx_set_cpuspeed(unsigned int khz) ...@@ -304,12 +298,17 @@ static void gx_set_cpuspeed(unsigned int khz)
case PCI_DEVICE_ID_CYRIX_5520: case PCI_DEVICE_ID_CYRIX_5520:
case PCI_DEVICE_ID_CYRIX_5510: case PCI_DEVICE_ID_CYRIX_5510:
suscfg = gx_params->pci_suscfg | SUSMOD; suscfg = gx_params->pci_suscfg | SUSMOD;
break;
default: default:
local_irq_restore(flags); local_irq_restore(flags);
dprintk("fatal: try to set unknown chipset.\n"); dprintk("fatal: try to set unknown chipset.\n");
return; return;
} }
} else {
suscfg = gx_params->pci_suscfg & ~(SUSMOD);
gx_params->off_duration = 0;
gx_params->on_duration = 0;
dprintk("suspend modulation disabled: cpu runs 100 percent speed.\n");
}
pci_write_config_byte(gx_params->cs55x0, PCI_MODOFF, gx_params->off_duration); pci_write_config_byte(gx_params->cs55x0, PCI_MODOFF, gx_params->off_duration);
pci_write_config_byte(gx_params->cs55x0, PCI_MODON, gx_params->on_duration); pci_write_config_byte(gx_params->cs55x0, PCI_MODON, gx_params->on_duration);
......
...@@ -91,18 +91,13 @@ static int check_powernow(void) ...@@ -91,18 +91,13 @@ static int check_powernow(void)
struct cpuinfo_x86 *c = cpu_data; struct cpuinfo_x86 *c = cpu_data;
unsigned int maxei, eax, ebx, ecx, edx; unsigned int maxei, eax, ebx, ecx, edx;
if (c->x86_vendor != X86_VENDOR_AMD) { if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) {
printk (KERN_INFO PFX "AMD processor not detected.\n"); #ifdef MODULE
return 0;
}
if (c->x86 !=6) {
printk (KERN_INFO PFX "This module only works with AMD K7 CPUs\n"); printk (KERN_INFO PFX "This module only works with AMD K7 CPUs\n");
#endif
return 0; return 0;
} }
printk (KERN_INFO PFX "AMD K7 CPU detected.\n");
if ((c->x86_model == 6) && (c->x86_mask == 0)) { if ((c->x86_model == 6) && (c->x86_mask == 0)) {
printk (KERN_INFO PFX "K7 660[A0] core detected, enabling errata workarounds\n"); printk (KERN_INFO PFX "K7 660[A0] core detected, enabling errata workarounds\n");
have_a0 = 1; have_a0 = 1;
......
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