aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/exynos4210-cpufreq.c
diff options
context:
space:
mode:
authorJaecheol Lee <jc.lee@samsung.com>2011-12-06 21:43:42 -0500
committerDave Jones <davej@redhat.com>2011-12-09 10:38:02 -0500
commitc8c430e2f65adf124b3a2b6cfffa4dfc8a6e49c2 (patch)
tree3d90a4b844cf432fda014787f5e1bec39870b5f4 /drivers/cpufreq/exynos4210-cpufreq.c
parenta6a434124457fe64bb3980ceb2170505207db6e5 (diff)
[CPUFREQ] EXYNOS4210: Remove code about bus on cpufreq
This patch removes code for bus on cpufreq because the code for bus frequency changing moves to busfreq driver. So code about bus on cpufreq is not necessary. Signed-off-by: Jaecheol Lee <jc.lee@samsung.com> Signed-off-by: Jongpill Lee <boyko.lee@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq/exynos4210-cpufreq.c')
-rw-r--r--drivers/cpufreq/exynos4210-cpufreq.c174
1 files changed, 1 insertions, 173 deletions
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c b/drivers/cpufreq/exynos4210-cpufreq.c
index ab9741fab92e..578956c5ee71 100644
--- a/drivers/cpufreq/exynos4210-cpufreq.c
+++ b/drivers/cpufreq/exynos4210-cpufreq.c
@@ -33,21 +33,13 @@ static struct clk *mout_mpll;
33static struct clk *mout_apll; 33static struct clk *mout_apll;
34 34
35static struct regulator *arm_regulator; 35static struct regulator *arm_regulator;
36static struct regulator *int_regulator;
37 36
38static struct cpufreq_freqs freqs; 37static struct cpufreq_freqs freqs;
39static unsigned int memtype;
40 38
41static unsigned int locking_frequency; 39static unsigned int locking_frequency;
42static bool frequency_locked; 40static bool frequency_locked;
43static DEFINE_MUTEX(cpufreq_lock); 41static DEFINE_MUTEX(cpufreq_lock);
44 42
45enum exynos4_memory_type {
46 DDR2 = 4,
47 LPDDR2,
48 DDR3,
49};
50
51enum cpufreq_level_index { 43enum cpufreq_level_index {
52 L0, L1, L2, L3, CPUFREQ_LEVEL_END, 44 L0, L1, L2, L3, CPUFREQ_LEVEL_END,
53}; 45};
@@ -99,87 +91,24 @@ static unsigned int clkdiv_cpu1[CPUFREQ_LEVEL_END][2] = {
99 { 3, 0 }, 91 { 3, 0 },
100}; 92};
101 93
102static unsigned int clkdiv_dmc0[CPUFREQ_LEVEL_END][8] = {
103 /*
104 * Clock divider value for following
105 * { DIVACP, DIVACP_PCLK, DIVDPHY, DIVDMC, DIVDMCD
106 * DIVDMCP, DIVCOPY2, DIVCORE_TIMERS }
107 */
108
109 /* DMC L0: 400MHz */
110 { 3, 1, 1, 1, 1, 1, 3, 1 },
111
112 /* DMC L1: 400MHz */
113 { 3, 1, 1, 1, 1, 1, 3, 1 },
114
115 /* DMC L2: 266.7MHz */
116 { 7, 1, 1, 2, 1, 1, 3, 1 },
117
118 /* DMC L3: 200MHz */
119 { 7, 1, 1, 3, 1, 1, 3, 1 },
120};
121
122static unsigned int clkdiv_top[CPUFREQ_LEVEL_END][5] = {
123 /*
124 * Clock divider value for following
125 * { DIVACLK200, DIVACLK100, DIVACLK160, DIVACLK133, DIVONENAND }
126 */
127
128 /* ACLK200 L0: 200MHz */
129 { 3, 7, 4, 5, 1 },
130
131 /* ACLK200 L1: 200MHz */
132 { 3, 7, 4, 5, 1 },
133
134 /* ACLK200 L2: 160MHz */
135 { 4, 7, 5, 7, 1 },
136
137 /* ACLK200 L3: 133.3MHz */
138 { 5, 7, 7, 7, 1 },
139};
140
141static unsigned int clkdiv_lr_bus[CPUFREQ_LEVEL_END][2] = {
142 /*
143 * Clock divider value for following
144 * { DIVGDL/R, DIVGPL/R }
145 */
146
147 /* ACLK_GDL/R L0: 200MHz */
148 { 3, 1 },
149
150 /* ACLK_GDL/R L1: 200MHz */
151 { 3, 1 },
152
153 /* ACLK_GDL/R L2: 160MHz */
154 { 4, 1 },
155
156 /* ACLK_GDL/R L3: 133.3MHz */
157 { 5, 1 },
158};
159
160struct cpufreq_voltage_table { 94struct cpufreq_voltage_table {
161 unsigned int index; /* any */ 95 unsigned int index; /* any */
162 unsigned int arm_volt; /* uV */ 96 unsigned int arm_volt; /* uV */
163 unsigned int int_volt;
164}; 97};
165 98
166static struct cpufreq_voltage_table exynos4_volt_table[CPUFREQ_LEVEL_END] = { 99static struct cpufreq_voltage_table exynos4_volt_table[CPUFREQ_LEVEL_END] = {
167 { 100 {
168 .index = L0, 101 .index = L0,
169 .arm_volt = 1200000, 102 .arm_volt = 1200000,
170 .int_volt = 1100000,
171 }, { 103 }, {
172 .index = L1, 104 .index = L1,
173 .arm_volt = 1100000, 105 .arm_volt = 1100000,
174 .int_volt = 1100000,
175 }, { 106 }, {
176 .index = L2, 107 .index = L2,
177 .arm_volt = 1000000, 108 .arm_volt = 1000000,
178 .int_volt = 1000000,
179 }, { 109 }, {
180 .index = L3, 110 .index = L3,
181 .arm_volt = 900000, 111 .arm_volt = 900000,
182 .int_volt = 1000000,
183 }, 112 },
184}; 113};
185 114
@@ -248,80 +177,6 @@ static void exynos4_set_clkdiv(unsigned int div_index)
248 do { 177 do {
249 tmp = __raw_readl(S5P_CLKDIV_STATCPU1); 178 tmp = __raw_readl(S5P_CLKDIV_STATCPU1);
250 } while (tmp & 0x11); 179 } while (tmp & 0x11);
251
252 /* Change Divider - DMC0 */
253
254 tmp = __raw_readl(S5P_CLKDIV_DMC0);
255
256 tmp &= ~(S5P_CLKDIV_DMC0_ACP_MASK | S5P_CLKDIV_DMC0_ACPPCLK_MASK |
257 S5P_CLKDIV_DMC0_DPHY_MASK | S5P_CLKDIV_DMC0_DMC_MASK |
258 S5P_CLKDIV_DMC0_DMCD_MASK | S5P_CLKDIV_DMC0_DMCP_MASK |
259 S5P_CLKDIV_DMC0_COPY2_MASK | S5P_CLKDIV_DMC0_CORETI_MASK);
260
261 tmp |= ((clkdiv_dmc0[div_index][0] << S5P_CLKDIV_DMC0_ACP_SHIFT) |
262 (clkdiv_dmc0[div_index][1] << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) |
263 (clkdiv_dmc0[div_index][2] << S5P_CLKDIV_DMC0_DPHY_SHIFT) |
264 (clkdiv_dmc0[div_index][3] << S5P_CLKDIV_DMC0_DMC_SHIFT) |
265 (clkdiv_dmc0[div_index][4] << S5P_CLKDIV_DMC0_DMCD_SHIFT) |
266 (clkdiv_dmc0[div_index][5] << S5P_CLKDIV_DMC0_DMCP_SHIFT) |
267 (clkdiv_dmc0[div_index][6] << S5P_CLKDIV_DMC0_COPY2_SHIFT) |
268 (clkdiv_dmc0[div_index][7] << S5P_CLKDIV_DMC0_CORETI_SHIFT));
269
270 __raw_writel(tmp, S5P_CLKDIV_DMC0);
271
272 do {
273 tmp = __raw_readl(S5P_CLKDIV_STAT_DMC0);
274 } while (tmp & 0x11111111);
275
276 /* Change Divider - TOP */
277
278 tmp = __raw_readl(S5P_CLKDIV_TOP);
279
280 tmp &= ~(S5P_CLKDIV_TOP_ACLK200_MASK | S5P_CLKDIV_TOP_ACLK100_MASK |
281 S5P_CLKDIV_TOP_ACLK160_MASK | S5P_CLKDIV_TOP_ACLK133_MASK |
282 S5P_CLKDIV_TOP_ONENAND_MASK);
283
284 tmp |= ((clkdiv_top[div_index][0] << S5P_CLKDIV_TOP_ACLK200_SHIFT) |
285 (clkdiv_top[div_index][1] << S5P_CLKDIV_TOP_ACLK100_SHIFT) |
286 (clkdiv_top[div_index][2] << S5P_CLKDIV_TOP_ACLK160_SHIFT) |
287 (clkdiv_top[div_index][3] << S5P_CLKDIV_TOP_ACLK133_SHIFT) |
288 (clkdiv_top[div_index][4] << S5P_CLKDIV_TOP_ONENAND_SHIFT));
289
290 __raw_writel(tmp, S5P_CLKDIV_TOP);
291
292 do {
293 tmp = __raw_readl(S5P_CLKDIV_STAT_TOP);
294 } while (tmp & 0x11111);
295
296 /* Change Divider - LEFTBUS */
297
298 tmp = __raw_readl(S5P_CLKDIV_LEFTBUS);
299
300 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK);
301
302 tmp |= ((clkdiv_lr_bus[div_index][0] << S5P_CLKDIV_BUS_GDLR_SHIFT) |
303 (clkdiv_lr_bus[div_index][1] << S5P_CLKDIV_BUS_GPLR_SHIFT));
304
305 __raw_writel(tmp, S5P_CLKDIV_LEFTBUS);
306
307 do {
308 tmp = __raw_readl(S5P_CLKDIV_STAT_LEFTBUS);
309 } while (tmp & 0x11);
310
311 /* Change Divider - RIGHTBUS */
312
313 tmp = __raw_readl(S5P_CLKDIV_RIGHTBUS);
314
315 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK);
316
317 tmp |= ((clkdiv_lr_bus[div_index][0] << S5P_CLKDIV_BUS_GDLR_SHIFT) |
318 (clkdiv_lr_bus[div_index][1] << S5P_CLKDIV_BUS_GPLR_SHIFT));
319
320 __raw_writel(tmp, S5P_CLKDIV_RIGHTBUS);
321
322 do {
323 tmp = __raw_readl(S5P_CLKDIV_STAT_RIGHTBUS);
324 } while (tmp & 0x11);
325} 180}
326 181
327static void exynos4_set_apll(unsigned int index) 182static void exynos4_set_apll(unsigned int index)
@@ -410,7 +265,7 @@ static int exynos4_target(struct cpufreq_policy *policy,
410 unsigned int relation) 265 unsigned int relation)
411{ 266{
412 unsigned int index, old_index; 267 unsigned int index, old_index;
413 unsigned int arm_volt, int_volt; 268 unsigned int arm_volt;
414 int err = -EINVAL; 269 int err = -EINVAL;
415 270
416 freqs.old = exynos4_getspeed(policy->cpu); 271 freqs.old = exynos4_getspeed(policy->cpu);
@@ -440,7 +295,6 @@ static int exynos4_target(struct cpufreq_policy *policy,
440 295
441 /* get the voltage value */ 296 /* get the voltage value */
442 arm_volt = exynos4_volt_table[index].arm_volt; 297 arm_volt = exynos4_volt_table[index].arm_volt;
443 int_volt = exynos4_volt_table[index].int_volt;
444 298
445 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 299 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
446 300
@@ -448,7 +302,6 @@ static int exynos4_target(struct cpufreq_policy *policy,
448 if (freqs.new > freqs.old) { 302 if (freqs.new > freqs.old) {
449 /* Voltage up */ 303 /* Voltage up */
450 regulator_set_voltage(arm_regulator, arm_volt, arm_volt); 304 regulator_set_voltage(arm_regulator, arm_volt, arm_volt);
451 regulator_set_voltage(int_regulator, int_volt, int_volt);
452 } 305 }
453 306
454 /* Clock Configuration Procedure */ 307 /* Clock Configuration Procedure */
@@ -458,7 +311,6 @@ static int exynos4_target(struct cpufreq_policy *policy,
458 if (freqs.new < freqs.old) { 311 if (freqs.new < freqs.old) {
459 /* Voltage down */ 312 /* Voltage down */
460 regulator_set_voltage(arm_regulator, arm_volt, arm_volt); 313 regulator_set_voltage(arm_regulator, arm_volt, arm_volt);
461 regulator_set_voltage(int_regulator, int_volt, int_volt);
462 } 314 }
463 315
464 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 316 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
@@ -636,27 +488,6 @@ static int __init exynos4_cpufreq_init(void)
636 goto out; 488 goto out;
637 } 489 }
638 490
639 int_regulator = regulator_get(NULL, "vdd_int");
640 if (IS_ERR(int_regulator)) {
641 printk(KERN_ERR "failed to get resource %s\n", "vdd_int");
642 goto out;
643 }
644
645 /*
646 * Check DRAM type.
647 * Because DVFS level is different according to DRAM type.
648 */
649 memtype = __raw_readl(S5P_VA_DMC0 + S5P_DMC0_MEMCON_OFFSET);
650 memtype = (memtype >> S5P_DMC0_MEMTYPE_SHIFT);
651 memtype &= S5P_DMC0_MEMTYPE_MASK;
652
653 if ((memtype < DDR2) && (memtype > DDR3)) {
654 printk(KERN_ERR "%s: wrong memtype= 0x%x\n", __func__, memtype);
655 goto out;
656 } else {
657 printk(KERN_DEBUG "%s: memtype= 0x%x\n", __func__, memtype);
658 }
659
660 register_pm_notifier(&exynos4_cpufreq_nb); 491 register_pm_notifier(&exynos4_cpufreq_nb);
661 492
662 return cpufreq_register_driver(&exynos4_driver); 493 return cpufreq_register_driver(&exynos4_driver);
@@ -677,9 +508,6 @@ out:
677 if (!IS_ERR(arm_regulator)) 508 if (!IS_ERR(arm_regulator))
678 regulator_put(arm_regulator); 509 regulator_put(arm_regulator);
679 510
680 if (!IS_ERR(int_regulator))
681 regulator_put(int_regulator);
682
683 printk(KERN_ERR "%s: failed initialization\n", __func__); 511 printk(KERN_ERR "%s: failed initialization\n", __func__);
684 512
685 return -EINVAL; 513 return -EINVAL;