diff options
-rw-r--r-- | drivers/cpufreq/exynos-cpufreq.c | 19 | ||||
-rw-r--r-- | drivers/cpufreq/exynos-cpufreq.h | 8 | ||||
-rw-r--r-- | drivers/cpufreq/exynos4x12-cpufreq.c | 11 |
3 files changed, 26 insertions, 12 deletions
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f99cfe24e7bc..e8a4a7ed38c1 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/regulator/consumer.h> | 17 | #include <linux/regulator/consumer.h> |
18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/of.h> | ||
20 | 21 | ||
21 | #include <plat/cpu.h> | 22 | #include <plat/cpu.h> |
22 | 23 | ||
@@ -163,14 +164,22 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
163 | if (!exynos_info) | 164 | if (!exynos_info) |
164 | return -ENOMEM; | 165 | return -ENOMEM; |
165 | 166 | ||
166 | if (soc_is_exynos4210()) | 167 | if (of_machine_is_compatible("samsung,exynos4210")) { |
168 | exynos_info->type = EXYNOS_SOC_4210; | ||
167 | ret = exynos4210_cpufreq_init(exynos_info); | 169 | ret = exynos4210_cpufreq_init(exynos_info); |
168 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | 170 | } else if (of_machine_is_compatible("samsung,exynos4212")) { |
171 | exynos_info->type = EXYNOS_SOC_4212; | ||
169 | ret = exynos4x12_cpufreq_init(exynos_info); | 172 | ret = exynos4x12_cpufreq_init(exynos_info); |
170 | else if (soc_is_exynos5250()) | 173 | } else if (of_machine_is_compatible("samsung,exynos4412")) { |
174 | exynos_info->type = EXYNOS_SOC_4412; | ||
175 | ret = exynos4x12_cpufreq_init(exynos_info); | ||
176 | } else if (of_machine_is_compatible("samsung,exynos5250")) { | ||
177 | exynos_info->type = EXYNOS_SOC_5250; | ||
171 | ret = exynos5250_cpufreq_init(exynos_info); | 178 | ret = exynos5250_cpufreq_init(exynos_info); |
172 | else | 179 | } else { |
173 | return 0; | 180 | pr_err("%s: Unknown SoC type\n", __func__); |
181 | return -ENODEV; | ||
182 | } | ||
174 | 183 | ||
175 | if (ret) | 184 | if (ret) |
176 | goto err_vdd_arm; | 185 | goto err_vdd_arm; |
diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h index 3ddade8a5125..f189547bb447 100644 --- a/drivers/cpufreq/exynos-cpufreq.h +++ b/drivers/cpufreq/exynos-cpufreq.h | |||
@@ -17,6 +17,13 @@ enum cpufreq_level_index { | |||
17 | L20, | 17 | L20, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | enum exynos_soc_type { | ||
21 | EXYNOS_SOC_4210, | ||
22 | EXYNOS_SOC_4212, | ||
23 | EXYNOS_SOC_4412, | ||
24 | EXYNOS_SOC_5250, | ||
25 | }; | ||
26 | |||
20 | #define APLL_FREQ(f, a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, m, p, s) \ | 27 | #define APLL_FREQ(f, a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, m, p, s) \ |
21 | { \ | 28 | { \ |
22 | .freq = (f) * 1000, \ | 29 | .freq = (f) * 1000, \ |
@@ -34,6 +41,7 @@ struct apll_freq { | |||
34 | }; | 41 | }; |
35 | 42 | ||
36 | struct exynos_dvfs_info { | 43 | struct exynos_dvfs_info { |
44 | enum exynos_soc_type type; | ||
37 | unsigned long mpll_freq_khz; | 45 | unsigned long mpll_freq_khz; |
38 | unsigned int pll_safe_idx; | 46 | unsigned int pll_safe_idx; |
39 | struct clk *cpu_clk; | 47 | struct clk *cpu_clk; |
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c index 466c76ad335b..63a3907ce578 100644 --- a/drivers/cpufreq/exynos4x12-cpufreq.c +++ b/drivers/cpufreq/exynos4x12-cpufreq.c | |||
@@ -100,7 +100,6 @@ static struct apll_freq apll_freq_4412[] = { | |||
100 | static void exynos4x12_set_clkdiv(unsigned int div_index) | 100 | static void exynos4x12_set_clkdiv(unsigned int div_index) |
101 | { | 101 | { |
102 | unsigned int tmp; | 102 | unsigned int tmp; |
103 | unsigned int stat_cpu1; | ||
104 | 103 | ||
105 | /* Change Divider - CPU0 */ | 104 | /* Change Divider - CPU0 */ |
106 | 105 | ||
@@ -115,13 +114,11 @@ static void exynos4x12_set_clkdiv(unsigned int div_index) | |||
115 | tmp = apll_freq_4x12[div_index].clk_div_cpu1; | 114 | tmp = apll_freq_4x12[div_index].clk_div_cpu1; |
116 | 115 | ||
117 | __raw_writel(tmp, EXYNOS4_CLKDIV_CPU1); | 116 | __raw_writel(tmp, EXYNOS4_CLKDIV_CPU1); |
118 | if (soc_is_exynos4212()) | ||
119 | stat_cpu1 = 0x11; | ||
120 | else | ||
121 | stat_cpu1 = 0x111; | ||
122 | 117 | ||
123 | while (__raw_readl(EXYNOS4_CLKDIV_STATCPU1) & stat_cpu1) | 118 | do { |
124 | cpu_relax(); | 119 | cpu_relax(); |
120 | tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU1); | ||
121 | } while (tmp != 0x0); | ||
125 | } | 122 | } |
126 | 123 | ||
127 | static void exynos4x12_set_apll(unsigned int index) | 124 | static void exynos4x12_set_apll(unsigned int index) |
@@ -184,7 +181,7 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info) | |||
184 | if (IS_ERR(mout_apll)) | 181 | if (IS_ERR(mout_apll)) |
185 | goto err_mout_apll; | 182 | goto err_mout_apll; |
186 | 183 | ||
187 | if (soc_is_exynos4212()) | 184 | if (info->type == EXYNOS_SOC_4212) |
188 | apll_freq_4x12 = apll_freq_4212; | 185 | apll_freq_4x12 = apll_freq_4212; |
189 | else | 186 | else |
190 | apll_freq_4x12 = apll_freq_4412; | 187 | apll_freq_4x12 = apll_freq_4412; |