Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132655
b: refs/heads/master
c: 6072ace
h: refs/heads/master
i:
  132653: 70b2d52
  132651: d1d2af9
  132647: de3841d
  132639: 8cd2d7a
v: v3
  • Loading branch information
Dave Jones committed Feb 25, 2009
1 parent 052afcb commit d51f876
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 14a6650f13b958aabc30ddd575b0902384b22457
refs/heads/master: 6072ace436800a011c3cb9a75ee49276bd90445a
30 changes: 17 additions & 13 deletions trunk/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@

#include <linux/delay.h>
#include <linux/cpufreq.h>
#include <linux/timex.h>
#include <linux/io.h>

#include <asm/msr.h>
#include <asm/timex.h>
#include <asm/io.h>

#define MMCR_BASE 0xfffef000 /* The default base address */
#define OFFS_CPUCTL 0x2 /* CPU Control Register */

static __u8 __iomem *cpuctl;

#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "sc520_freq", msg)
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
"sc520_freq", msg)
#define PFX "sc520_freq: "

static struct cpufreq_frequency_table sc520_freq_table[] = {
{0x01, 100000},
Expand All @@ -43,15 +45,16 @@ static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)

switch (clockspeed_reg & 0x03) {
default:
printk(KERN_ERR "sc520_freq: error: cpuctl register has unexpected value %02x\n", clockspeed_reg);
printk(KERN_ERR PFX "error: cpuctl register has unexpected "
"value %02x\n", clockspeed_reg);
case 0x01:
return 100000;
case 0x02:
return 133000;
}
}

static void sc520_freq_set_cpu_state (unsigned int state)
static void sc520_freq_set_cpu_state(unsigned int state)
{

struct cpufreq_freqs freqs;
Expand All @@ -76,18 +79,19 @@ static void sc520_freq_set_cpu_state (unsigned int state)
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
};

static int sc520_freq_verify (struct cpufreq_policy *policy)
static int sc520_freq_verify(struct cpufreq_policy *policy)
{
return cpufreq_frequency_table_verify(policy, &sc520_freq_table[0]);
}

static int sc520_freq_target (struct cpufreq_policy *policy,
static int sc520_freq_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
{
unsigned int newstate = 0;

if (cpufreq_frequency_table_target(policy, sc520_freq_table, target_freq, relation, &newstate))
if (cpufreq_frequency_table_target(policy, sc520_freq_table,
target_freq, relation, &newstate))
return -EINVAL;

sc520_freq_set_cpu_state(newstate);
Expand Down Expand Up @@ -116,7 +120,7 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy)

result = cpufreq_frequency_table_cpuinfo(policy, sc520_freq_table);
if (result)
return (result);
return result;

cpufreq_frequency_table_get_attr(sc520_freq_table, policy->cpu);

Expand All @@ -131,7 +135,7 @@ static int sc520_freq_cpu_exit(struct cpufreq_policy *policy)
}


static struct freq_attr* sc520_freq_attr[] = {
static struct freq_attr *sc520_freq_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
};
Expand All @@ -155,13 +159,13 @@ static int __init sc520_freq_init(void)
int err;

/* Test if we have the right hardware */
if(c->x86_vendor != X86_VENDOR_AMD ||
c->x86 != 4 || c->x86_model != 9) {
if (c->x86_vendor != X86_VENDOR_AMD ||
c->x86 != 4 || c->x86_model != 9) {
dprintk("no Elan SC520 processor found!\n");
return -ENODEV;
}
cpuctl = ioremap((unsigned long)(MMCR_BASE + OFFS_CPUCTL), 1);
if(!cpuctl) {
if (!cpuctl) {
printk(KERN_ERR "sc520_freq: error: failed to remap memory\n");
return -ENOMEM;
}
Expand Down

0 comments on commit d51f876

Please sign in to comment.