diff options
Diffstat (limited to 'arch/arm/mach-sa1100/generic.c')
-rw-r--r-- | arch/arm/mach-sa1100/generic.c | 81 |
1 files changed, 19 insertions, 62 deletions
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index f25b6119e028..d4ea142c4edd 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -42,74 +42,31 @@ EXPORT_SYMBOL(reset_status); | |||
42 | /* | 42 | /* |
43 | * This table is setup for a 3.6864MHz Crystal. | 43 | * This table is setup for a 3.6864MHz Crystal. |
44 | */ | 44 | */ |
45 | static const unsigned short cclk_frequency_100khz[NR_FREQS] = { | 45 | struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = { |
46 | 590, /* 59.0 MHz */ | 46 | { .frequency = 59000, /* 59.0 MHz */}, |
47 | 737, /* 73.7 MHz */ | 47 | { .frequency = 73700, /* 73.7 MHz */}, |
48 | 885, /* 88.5 MHz */ | 48 | { .frequency = 88500, /* 88.5 MHz */}, |
49 | 1032, /* 103.2 MHz */ | 49 | { .frequency = 103200, /* 103.2 MHz */}, |
50 | 1180, /* 118.0 MHz */ | 50 | { .frequency = 118000, /* 118.0 MHz */}, |
51 | 1327, /* 132.7 MHz */ | 51 | { .frequency = 132700, /* 132.7 MHz */}, |
52 | 1475, /* 147.5 MHz */ | 52 | { .frequency = 147500, /* 147.5 MHz */}, |
53 | 1622, /* 162.2 MHz */ | 53 | { .frequency = 162200, /* 162.2 MHz */}, |
54 | 1769, /* 176.9 MHz */ | 54 | { .frequency = 176900, /* 176.9 MHz */}, |
55 | 1917, /* 191.7 MHz */ | 55 | { .frequency = 191700, /* 191.7 MHz */}, |
56 | 2064, /* 206.4 MHz */ | 56 | { .frequency = 206400, /* 206.4 MHz */}, |
57 | 2212, /* 221.2 MHz */ | 57 | { .frequency = 221200, /* 221.2 MHz */}, |
58 | 2359, /* 235.9 MHz */ | 58 | { .frequency = 235900, /* 235.9 MHz */}, |
59 | 2507, /* 250.7 MHz */ | 59 | { .frequency = 250700, /* 250.7 MHz */}, |
60 | 2654, /* 265.4 MHz */ | 60 | { .frequency = 265400, /* 265.4 MHz */}, |
61 | 2802 /* 280.2 MHz */ | 61 | { .frequency = 280200, /* 280.2 MHz */}, |
62 | { .frequency = CPUFREQ_TABLE_END, }, | ||
62 | }; | 63 | }; |
63 | 64 | ||
64 | /* rounds up(!) */ | ||
65 | unsigned int sa11x0_freq_to_ppcr(unsigned int khz) | ||
66 | { | ||
67 | int i; | ||
68 | |||
69 | khz /= 100; | ||
70 | |||
71 | for (i = 0; i < NR_FREQS; i++) | ||
72 | if (cclk_frequency_100khz[i] >= khz) | ||
73 | break; | ||
74 | |||
75 | return i; | ||
76 | } | ||
77 | |||
78 | unsigned int sa11x0_ppcr_to_freq(unsigned int idx) | ||
79 | { | ||
80 | unsigned int freq = 0; | ||
81 | if (idx < NR_FREQS) | ||
82 | freq = cclk_frequency_100khz[idx] * 100; | ||
83 | return freq; | ||
84 | } | ||
85 | |||
86 | |||
87 | /* make sure that only the "userspace" governor is run -- anything else wouldn't make sense on | ||
88 | * this platform, anyway. | ||
89 | */ | ||
90 | int sa11x0_verify_speed(struct cpufreq_policy *policy) | ||
91 | { | ||
92 | unsigned int tmp; | ||
93 | if (policy->cpu) | ||
94 | return -EINVAL; | ||
95 | |||
96 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); | ||
97 | |||
98 | /* make sure that at least one frequency is within the policy */ | ||
99 | tmp = cclk_frequency_100khz[sa11x0_freq_to_ppcr(policy->min)] * 100; | ||
100 | if (tmp > policy->max) | ||
101 | policy->max = tmp; | ||
102 | |||
103 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | unsigned int sa11x0_getspeed(unsigned int cpu) | 65 | unsigned int sa11x0_getspeed(unsigned int cpu) |
109 | { | 66 | { |
110 | if (cpu) | 67 | if (cpu) |
111 | return 0; | 68 | return 0; |
112 | return cclk_frequency_100khz[PPCR & 0xf] * 100; | 69 | return sa11x0_freq_table[PPCR & 0xf].frequency; |
113 | } | 70 | } |
114 | 71 | ||
115 | /* | 72 | /* |