aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-02 19:35:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-02 19:35:49 -0400
commita727eaf64ff084a50b983fc506810c7a576b7ce3 (patch)
treecb82642227ed590ebc43b12cfad285a2d7681d5d /drivers/cpufreq
parent755a9ba7bf24a45b6dbf8bb15a5a56c8ed12461a (diff)
parent45e70b7d48d53d5eb193c6b3f012b31ca135fb4c (diff)
Merge tag 'drivers-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc into next
Pull ARM SoC driver changes from Olof Johansson: "SoC-near driver changes that we're merging through our tree. Mostly because they depend on other changes we have staged, but in some cases because the driver maintainers preferred that we did it this way. This contains a largeish cleanup series of the omap_l3_noc bus driver, cpuidle rework for Exynos, some reset driver conversions and a long branch of TI EDMA fixes and cleanups, with more to come next release. The TI EDMA cleanups is a shared branch with the dmaengine tree, with a handful of Davinci-specific fixes on top. After discussion at last year's KS (and some more on the mailing lists), we are here adding a drivers/soc directory. The purpose of this is to keep per-vendor shared code that's needed by different drivers but that doesn't fit into the MFD (nor drivers/platform) model. We expect to keep merging contents for this hierarchy through arm-soc so we can keep an eye on what the vendors keep adding here and not making it a free-for-all to shove in crazy stuff" * tag 'drivers-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (101 commits) cpufreq: exynos: Fix driver compilation with ARCH_MULTIPLATFORM tty: serial: msm: Remove direct access to GSBI power: reset: keystone-reset: introduce keystone reset driver Documentation: dt: add bindings for keystone pll control controller Documentation: dt: add bindings for keystone reset driver soc: qcom: fix of_device_id table ARM: EXYNOS: Fix kernel panic when unplugging CPU1 on exynos ARM: EXYNOS: Move the driver to drivers/cpuidle directory ARM: EXYNOS: Cleanup all unneeded headers from cpuidle.c ARM: EXYNOS: Pass the AFTR callback to the platform_data ARM: EXYNOS: Move S5P_CHECK_SLEEP into pm.c ARM: EXYNOS: Move the power sequence call in the cpu_pm notifier ARM: EXYNOS: Move the AFTR state function into pm.c ARM: EXYNOS: Encapsulate the AFTR code into a function ARM: EXYNOS: Disable cpuidle for exynos5440 ARM: EXYNOS: Encapsulate boot vector code into a function for cpuidle ARM: EXYNOS: Pass wakeup mask parameter to function for cpuidle ARM: EXYNOS: Remove ifdef for scu_enable in pm ARM: EXYNOS: Move scu_enable in the cpu_pm notifier ARM: EXYNOS: Use the cpu_pm notifier for pm ...
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/Kconfig.arm6
-rw-r--r--drivers/cpufreq/exynos-cpufreq.c2
-rw-r--r--drivers/cpufreq/exynos-cpufreq.h30
-rw-r--r--drivers/cpufreq/exynos4210-cpufreq.c39
-rw-r--r--drivers/cpufreq/exynos4x12-cpufreq.c40
-rw-r--r--drivers/cpufreq/exynos5250-cpufreq.c43
6 files changed, 119 insertions, 41 deletions
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 580503513f0f..d2c7b4b8ffd5 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -30,7 +30,7 @@ config ARM_EXYNOS_CPUFREQ
30 30
31config ARM_EXYNOS4210_CPUFREQ 31config ARM_EXYNOS4210_CPUFREQ
32 bool "SAMSUNG EXYNOS4210" 32 bool "SAMSUNG EXYNOS4210"
33 depends on CPU_EXYNOS4210 && !ARCH_MULTIPLATFORM 33 depends on CPU_EXYNOS4210
34 default y 34 default y
35 select ARM_EXYNOS_CPUFREQ 35 select ARM_EXYNOS_CPUFREQ
36 help 36 help
@@ -41,7 +41,7 @@ config ARM_EXYNOS4210_CPUFREQ
41 41
42config ARM_EXYNOS4X12_CPUFREQ 42config ARM_EXYNOS4X12_CPUFREQ
43 bool "SAMSUNG EXYNOS4x12" 43 bool "SAMSUNG EXYNOS4x12"
44 depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412) && !ARCH_MULTIPLATFORM 44 depends on SOC_EXYNOS4212 || SOC_EXYNOS4412
45 default y 45 default y
46 select ARM_EXYNOS_CPUFREQ 46 select ARM_EXYNOS_CPUFREQ
47 help 47 help
@@ -52,7 +52,7 @@ config ARM_EXYNOS4X12_CPUFREQ
52 52
53config ARM_EXYNOS5250_CPUFREQ 53config ARM_EXYNOS5250_CPUFREQ
54 bool "SAMSUNG EXYNOS5250" 54 bool "SAMSUNG EXYNOS5250"
55 depends on SOC_EXYNOS5250 && !ARCH_MULTIPLATFORM 55 depends on SOC_EXYNOS5250
56 default y 56 default y
57 select ARM_EXYNOS_CPUFREQ 57 select ARM_EXYNOS_CPUFREQ
58 help 58 help
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index e8a4a7ed38c1..348c8bafe436 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -19,8 +19,6 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/of.h> 20#include <linux/of.h>
21 21
22#include <plat/cpu.h>
23
24#include "exynos-cpufreq.h" 22#include "exynos-cpufreq.h"
25 23
26static struct exynos_dvfs_info *exynos_info; 24static struct exynos_dvfs_info *exynos_info;
diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h
index f189547bb447..51af42e1b7fe 100644
--- a/drivers/cpufreq/exynos-cpufreq.h
+++ b/drivers/cpufreq/exynos-cpufreq.h
@@ -49,6 +49,7 @@ struct exynos_dvfs_info {
49 struct cpufreq_frequency_table *freq_table; 49 struct cpufreq_frequency_table *freq_table;
50 void (*set_freq)(unsigned int, unsigned int); 50 void (*set_freq)(unsigned int, unsigned int);
51 bool (*need_apll_change)(unsigned int, unsigned int); 51 bool (*need_apll_change)(unsigned int, unsigned int);
52 void __iomem *cmu_regs;
52}; 53};
53 54
54#ifdef CONFIG_ARM_EXYNOS4210_CPUFREQ 55#ifdef CONFIG_ARM_EXYNOS4210_CPUFREQ
@@ -76,24 +77,21 @@ static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
76} 77}
77#endif 78#endif
78 79
79#include <plat/cpu.h> 80#define EXYNOS4_CLKSRC_CPU 0x14200
80#include <mach/map.h> 81#define EXYNOS4_CLKMUX_STATCPU 0x14400
81 82
82#define EXYNOS4_CLKSRC_CPU (S5P_VA_CMU + 0x14200) 83#define EXYNOS4_CLKDIV_CPU 0x14500
83#define EXYNOS4_CLKMUX_STATCPU (S5P_VA_CMU + 0x14400) 84#define EXYNOS4_CLKDIV_CPU1 0x14504
84 85#define EXYNOS4_CLKDIV_STATCPU 0x14600
85#define EXYNOS4_CLKDIV_CPU (S5P_VA_CMU + 0x14500) 86#define EXYNOS4_CLKDIV_STATCPU1 0x14604
86#define EXYNOS4_CLKDIV_CPU1 (S5P_VA_CMU + 0x14504)
87#define EXYNOS4_CLKDIV_STATCPU (S5P_VA_CMU + 0x14600)
88#define EXYNOS4_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x14604)
89 87
90#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16) 88#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
91#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT) 89#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
92 90
93#define EXYNOS5_APLL_LOCK (S5P_VA_CMU + 0x00000) 91#define EXYNOS5_APLL_LOCK 0x00000
94#define EXYNOS5_APLL_CON0 (S5P_VA_CMU + 0x00100) 92#define EXYNOS5_APLL_CON0 0x00100
95#define EXYNOS5_CLKMUX_STATCPU (S5P_VA_CMU + 0x00400) 93#define EXYNOS5_CLKMUX_STATCPU 0x00400
96#define EXYNOS5_CLKDIV_CPU0 (S5P_VA_CMU + 0x00500) 94#define EXYNOS5_CLKDIV_CPU0 0x00500
97#define EXYNOS5_CLKDIV_CPU1 (S5P_VA_CMU + 0x00504) 95#define EXYNOS5_CLKDIV_CPU1 0x00504
98#define EXYNOS5_CLKDIV_STATCPU0 (S5P_VA_CMU + 0x00600) 96#define EXYNOS5_CLKDIV_STATCPU0 0x00600
99#define EXYNOS5_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x00604) 97#define EXYNOS5_CLKDIV_STATCPU1 0x00604
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c b/drivers/cpufreq/exynos4210-cpufreq.c
index 6384e5b9a347..61a54310a1b9 100644
--- a/drivers/cpufreq/exynos4210-cpufreq.c
+++ b/drivers/cpufreq/exynos4210-cpufreq.c
@@ -16,6 +16,8 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
19 21
20#include "exynos-cpufreq.h" 22#include "exynos-cpufreq.h"
21 23
@@ -23,6 +25,7 @@ static struct clk *cpu_clk;
23static struct clk *moutcore; 25static struct clk *moutcore;
24static struct clk *mout_mpll; 26static struct clk *mout_mpll;
25static struct clk *mout_apll; 27static struct clk *mout_apll;
28static struct exynos_dvfs_info *cpufreq;
26 29
27static unsigned int exynos4210_volt_table[] = { 30static unsigned int exynos4210_volt_table[] = {
28 1250000, 1150000, 1050000, 975000, 950000, 31 1250000, 1150000, 1050000, 975000, 950000,
@@ -60,20 +63,20 @@ static void exynos4210_set_clkdiv(unsigned int div_index)
60 63
61 tmp = apll_freq_4210[div_index].clk_div_cpu0; 64 tmp = apll_freq_4210[div_index].clk_div_cpu0;
62 65
63 __raw_writel(tmp, EXYNOS4_CLKDIV_CPU); 66 __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU);
64 67
65 do { 68 do {
66 tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU); 69 tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU);
67 } while (tmp & 0x1111111); 70 } while (tmp & 0x1111111);
68 71
69 /* Change Divider - CPU1 */ 72 /* Change Divider - CPU1 */
70 73
71 tmp = apll_freq_4210[div_index].clk_div_cpu1; 74 tmp = apll_freq_4210[div_index].clk_div_cpu1;
72 75
73 __raw_writel(tmp, EXYNOS4_CLKDIV_CPU1); 76 __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU1);
74 77
75 do { 78 do {
76 tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU1); 79 tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU1);
77 } while (tmp & 0x11); 80 } while (tmp & 0x11);
78} 81}
79 82
@@ -85,7 +88,7 @@ static void exynos4210_set_apll(unsigned int index)
85 clk_set_parent(moutcore, mout_mpll); 88 clk_set_parent(moutcore, mout_mpll);
86 89
87 do { 90 do {
88 tmp = (__raw_readl(EXYNOS4_CLKMUX_STATCPU) 91 tmp = (__raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU)
89 >> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT); 92 >> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT);
90 tmp &= 0x7; 93 tmp &= 0x7;
91 } while (tmp != 0x2); 94 } while (tmp != 0x2);
@@ -96,7 +99,7 @@ static void exynos4210_set_apll(unsigned int index)
96 clk_set_parent(moutcore, mout_apll); 99 clk_set_parent(moutcore, mout_apll);
97 100
98 do { 101 do {
99 tmp = __raw_readl(EXYNOS4_CLKMUX_STATCPU); 102 tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU);
100 tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK; 103 tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK;
101 } while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)); 104 } while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT));
102} 105}
@@ -115,8 +118,30 @@ static void exynos4210_set_frequency(unsigned int old_index,
115 118
116int exynos4210_cpufreq_init(struct exynos_dvfs_info *info) 119int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
117{ 120{
121 struct device_node *np;
118 unsigned long rate; 122 unsigned long rate;
119 123
124 /*
125 * HACK: This is a temporary workaround to get access to clock
126 * controller registers directly and remove static mappings and
127 * dependencies on platform headers. It is necessary to enable
128 * Exynos multi-platform support and will be removed together with
129 * this whole driver as soon as Exynos gets migrated to use
130 * cpufreq-cpu0 driver.
131 */
132 np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-clock");
133 if (!np) {
134 pr_err("%s: failed to find clock controller DT node\n",
135 __func__);
136 return -ENODEV;
137 }
138
139 info->cmu_regs = of_iomap(np, 0);
140 if (!info->cmu_regs) {
141 pr_err("%s: failed to map CMU registers\n", __func__);
142 return -EFAULT;
143 }
144
120 cpu_clk = clk_get(NULL, "armclk"); 145 cpu_clk = clk_get(NULL, "armclk");
121 if (IS_ERR(cpu_clk)) 146 if (IS_ERR(cpu_clk))
122 return PTR_ERR(cpu_clk); 147 return PTR_ERR(cpu_clk);
@@ -143,6 +168,8 @@ int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
143 info->freq_table = exynos4210_freq_table; 168 info->freq_table = exynos4210_freq_table;
144 info->set_freq = exynos4210_set_frequency; 169 info->set_freq = exynos4210_set_frequency;
145 170
171 cpufreq = info;
172
146 return 0; 173 return 0;
147 174
148err_mout_apll: 175err_mout_apll:
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c
index 63a3907ce578..351a2074cfea 100644
--- a/drivers/cpufreq/exynos4x12-cpufreq.c
+++ b/drivers/cpufreq/exynos4x12-cpufreq.c
@@ -16,6 +16,8 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
19 21
20#include "exynos-cpufreq.h" 22#include "exynos-cpufreq.h"
21 23
@@ -23,6 +25,7 @@ static struct clk *cpu_clk;
23static struct clk *moutcore; 25static struct clk *moutcore;
24static struct clk *mout_mpll; 26static struct clk *mout_mpll;
25static struct clk *mout_apll; 27static struct clk *mout_apll;
28static struct exynos_dvfs_info *cpufreq;
26 29
27static unsigned int exynos4x12_volt_table[] = { 30static unsigned int exynos4x12_volt_table[] = {
28 1350000, 1287500, 1250000, 1187500, 1137500, 1087500, 1037500, 31 1350000, 1287500, 1250000, 1187500, 1137500, 1087500, 1037500,
@@ -105,19 +108,20 @@ static void exynos4x12_set_clkdiv(unsigned int div_index)
105 108
106 tmp = apll_freq_4x12[div_index].clk_div_cpu0; 109 tmp = apll_freq_4x12[div_index].clk_div_cpu0;
107 110
108 __raw_writel(tmp, EXYNOS4_CLKDIV_CPU); 111 __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU);
109 112
110 while (__raw_readl(EXYNOS4_CLKDIV_STATCPU) & 0x11111111) 113 while (__raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU)
114 & 0x11111111)
111 cpu_relax(); 115 cpu_relax();
112 116
113 /* Change Divider - CPU1 */ 117 /* Change Divider - CPU1 */
114 tmp = apll_freq_4x12[div_index].clk_div_cpu1; 118 tmp = apll_freq_4x12[div_index].clk_div_cpu1;
115 119
116 __raw_writel(tmp, EXYNOS4_CLKDIV_CPU1); 120 __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU1);
117 121
118 do { 122 do {
119 cpu_relax(); 123 cpu_relax();
120 tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU1); 124 tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU1);
121 } while (tmp != 0x0); 125 } while (tmp != 0x0);
122} 126}
123 127
@@ -130,7 +134,7 @@ static void exynos4x12_set_apll(unsigned int index)
130 134
131 do { 135 do {
132 cpu_relax(); 136 cpu_relax();
133 tmp = (__raw_readl(EXYNOS4_CLKMUX_STATCPU) 137 tmp = (__raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU)
134 >> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT); 138 >> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT);
135 tmp &= 0x7; 139 tmp &= 0x7;
136 } while (tmp != 0x2); 140 } while (tmp != 0x2);
@@ -142,7 +146,7 @@ static void exynos4x12_set_apll(unsigned int index)
142 146
143 do { 147 do {
144 cpu_relax(); 148 cpu_relax();
145 tmp = __raw_readl(EXYNOS4_CLKMUX_STATCPU); 149 tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU);
146 tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK; 150 tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK;
147 } while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)); 151 } while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT));
148} 152}
@@ -161,8 +165,30 @@ static void exynos4x12_set_frequency(unsigned int old_index,
161 165
162int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info) 166int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
163{ 167{
168 struct device_node *np;
164 unsigned long rate; 169 unsigned long rate;
165 170
171 /*
172 * HACK: This is a temporary workaround to get access to clock
173 * controller registers directly and remove static mappings and
174 * dependencies on platform headers. It is necessary to enable
175 * Exynos multi-platform support and will be removed together with
176 * this whole driver as soon as Exynos gets migrated to use
177 * cpufreq-cpu0 driver.
178 */
179 np = of_find_compatible_node(NULL, NULL, "samsung,exynos4412-clock");
180 if (!np) {
181 pr_err("%s: failed to find clock controller DT node\n",
182 __func__);
183 return -ENODEV;
184 }
185
186 info->cmu_regs = of_iomap(np, 0);
187 if (!info->cmu_regs) {
188 pr_err("%s: failed to map CMU registers\n", __func__);
189 return -EFAULT;
190 }
191
166 cpu_clk = clk_get(NULL, "armclk"); 192 cpu_clk = clk_get(NULL, "armclk");
167 if (IS_ERR(cpu_clk)) 193 if (IS_ERR(cpu_clk))
168 return PTR_ERR(cpu_clk); 194 return PTR_ERR(cpu_clk);
@@ -194,6 +220,8 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
194 info->freq_table = exynos4x12_freq_table; 220 info->freq_table = exynos4x12_freq_table;
195 info->set_freq = exynos4x12_set_frequency; 221 info->set_freq = exynos4x12_set_frequency;
196 222
223 cpufreq = info;
224
197 return 0; 225 return 0;
198 226
199err_mout_apll: 227err_mout_apll:
diff --git a/drivers/cpufreq/exynos5250-cpufreq.c b/drivers/cpufreq/exynos5250-cpufreq.c
index 363a0b3fe1b1..c91ce69dc631 100644
--- a/drivers/cpufreq/exynos5250-cpufreq.c
+++ b/drivers/cpufreq/exynos5250-cpufreq.c
@@ -16,8 +16,8 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19 19#include <linux/of.h>
20#include <mach/map.h> 20#include <linux/of_address.h>
21 21
22#include "exynos-cpufreq.h" 22#include "exynos-cpufreq.h"
23 23
@@ -25,6 +25,7 @@ static struct clk *cpu_clk;
25static struct clk *moutcore; 25static struct clk *moutcore;
26static struct clk *mout_mpll; 26static struct clk *mout_mpll;
27static struct clk *mout_apll; 27static struct clk *mout_apll;
28static struct exynos_dvfs_info *cpufreq;
28 29
29static unsigned int exynos5250_volt_table[] = { 30static unsigned int exynos5250_volt_table[] = {
30 1300000, 1250000, 1225000, 1200000, 1150000, 31 1300000, 1250000, 1225000, 1200000, 1150000,
@@ -87,17 +88,18 @@ static void set_clkdiv(unsigned int div_index)
87 88
88 tmp = apll_freq_5250[div_index].clk_div_cpu0; 89 tmp = apll_freq_5250[div_index].clk_div_cpu0;
89 90
90 __raw_writel(tmp, EXYNOS5_CLKDIV_CPU0); 91 __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS5_CLKDIV_CPU0);
91 92
92 while (__raw_readl(EXYNOS5_CLKDIV_STATCPU0) & 0x11111111) 93 while (__raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKDIV_STATCPU0)
94 & 0x11111111)
93 cpu_relax(); 95 cpu_relax();
94 96
95 /* Change Divider - CPU1 */ 97 /* Change Divider - CPU1 */
96 tmp = apll_freq_5250[div_index].clk_div_cpu1; 98 tmp = apll_freq_5250[div_index].clk_div_cpu1;
97 99
98 __raw_writel(tmp, EXYNOS5_CLKDIV_CPU1); 100 __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS5_CLKDIV_CPU1);
99 101
100 while (__raw_readl(EXYNOS5_CLKDIV_STATCPU1) & 0x11) 102 while (__raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKDIV_STATCPU1) & 0x11)
101 cpu_relax(); 103 cpu_relax();
102} 104}
103 105
@@ -111,7 +113,8 @@ static void set_apll(unsigned int index)
111 113
112 do { 114 do {
113 cpu_relax(); 115 cpu_relax();
114 tmp = (__raw_readl(EXYNOS5_CLKMUX_STATCPU) >> 16); 116 tmp = (__raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKMUX_STATCPU)
117 >> 16);
115 tmp &= 0x7; 118 tmp &= 0x7;
116 } while (tmp != 0x2); 119 } while (tmp != 0x2);
117 120
@@ -122,7 +125,7 @@ static void set_apll(unsigned int index)
122 125
123 do { 126 do {
124 cpu_relax(); 127 cpu_relax();
125 tmp = __raw_readl(EXYNOS5_CLKMUX_STATCPU); 128 tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKMUX_STATCPU);
126 tmp &= (0x7 << 16); 129 tmp &= (0x7 << 16);
127 } while (tmp != (0x1 << 16)); 130 } while (tmp != (0x1 << 16));
128} 131}
@@ -141,8 +144,30 @@ static void exynos5250_set_frequency(unsigned int old_index,
141 144
142int exynos5250_cpufreq_init(struct exynos_dvfs_info *info) 145int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
143{ 146{
147 struct device_node *np;
144 unsigned long rate; 148 unsigned long rate;
145 149
150 /*
151 * HACK: This is a temporary workaround to get access to clock
152 * controller registers directly and remove static mappings and
153 * dependencies on platform headers. It is necessary to enable
154 * Exynos multi-platform support and will be removed together with
155 * this whole driver as soon as Exynos gets migrated to use
156 * cpufreq-cpu0 driver.
157 */
158 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5250-clock");
159 if (!np) {
160 pr_err("%s: failed to find clock controller DT node\n",
161 __func__);
162 return -ENODEV;
163 }
164
165 info->cmu_regs = of_iomap(np, 0);
166 if (!info->cmu_regs) {
167 pr_err("%s: failed to map CMU registers\n", __func__);
168 return -EFAULT;
169 }
170
146 cpu_clk = clk_get(NULL, "armclk"); 171 cpu_clk = clk_get(NULL, "armclk");
147 if (IS_ERR(cpu_clk)) 172 if (IS_ERR(cpu_clk))
148 return PTR_ERR(cpu_clk); 173 return PTR_ERR(cpu_clk);
@@ -169,6 +194,8 @@ int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
169 info->freq_table = exynos5250_freq_table; 194 info->freq_table = exynos5250_freq_table;
170 info->set_freq = exynos5250_set_frequency; 195 info->set_freq = exynos5250_set_frequency;
171 196
197 cpufreq = info;
198
172 return 0; 199 return 0;
173 200
174err_mout_apll: 201err_mout_apll: