12 #include <linux/module.h>
13 #include <linux/kernel.h>
17 #include <linux/slab.h>
20 #include <mach/regs-clock.h>
21 #include <mach/cpufreq.h>
23 #define CPUFREQ_LEVEL_END L5
25 static int max_support_idx =
L0;
28 static struct clk *cpu_clk;
29 static struct clk *moutcore;
30 static struct clk *mout_mpll;
31 static struct clk *mout_apll;
39 1250000, 1150000, 1050000, 975000, 950000,
62 { 0, 3, 7, 3, 4, 1, 7 },
65 { 0, 3, 7, 3, 4, 1, 7 },
68 { 0, 3, 7, 3, 3, 1, 7 },
71 { 0, 3, 7, 3, 3, 1, 7 },
74 { 0, 1, 3, 1, 3, 1, 0 },
101 ((150 << 16) | (3 << 8) | 1),
104 ((250 << 16) | (6 << 8) | 1),
107 ((200 << 16) | (6 << 8) | 1),
110 ((250 << 16) | (6 << 8) | 2),
113 ((200 << 16) | (6 << 8) | 3),
116 static void exynos4210_set_clkdiv(
unsigned int div_index)
122 tmp = exynos4210_clkdiv_table[div_index].clkdiv;
128 }
while (tmp & 0x1111111);
134 tmp &= ~((0x7 << 4) | 0x7);
136 tmp |= ((clkdiv_cpu1[div_index][0] << 4) |
137 (clkdiv_cpu1[div_index][1] << 0));
143 }
while (tmp & 0x11);
146 static void exynos4210_set_apll(
unsigned int index)
157 }
while (tmp != 0x2);
164 tmp &= ~((0x3ff << 16) | (0x3f << 8) | (0x7 << 0));
165 tmp |= exynos4210_apll_pms_table[
index];
184 unsigned int old_pm = (exynos4210_apll_pms_table[old_index] >> 8);
185 unsigned int new_pm = (exynos4210_apll_pms_table[new_index] >> 8);
187 return (old_pm == new_pm) ? 0 : 1;
190 static void exynos4210_set_frequency(
unsigned int old_index,
191 unsigned int new_index)
195 if (old_index > new_index) {
198 exynos4210_set_clkdiv(new_index);
203 tmp |= (exynos4210_apll_pms_table[new_index] & 0x7);
208 exynos4210_set_clkdiv(new_index);
210 exynos4210_set_apll(new_index);
212 }
else if (old_index < new_index) {
217 tmp |= (exynos4210_apll_pms_table[new_index] & 0x7);
221 exynos4210_set_clkdiv(new_index);
225 exynos4210_set_apll(new_index);
227 exynos4210_set_clkdiv(new_index);
240 return PTR_ERR(cpu_clk);
243 if (IS_ERR(moutcore))
247 if (IS_ERR(mout_mpll))
253 if (IS_ERR(mout_apll))
275 exynos4210_clkdiv_table[
i].clkdiv =
tmp;
286 info->
set_freq = exynos4210_set_frequency;
292 if (!IS_ERR(mout_mpll))
295 if (!IS_ERR(moutcore))
298 if (!IS_ERR(cpu_clk))
301 pr_debug(
"%s: failed initialization\n", __func__);