aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos4/clock.c
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2011-08-24 04:25:09 -0400
committerKukjin Kim <kgene.kim@samsung.com>2011-09-16 03:39:00 -0400
commit2bc02c0daae146283ce1b20da6864a27c848812e (patch)
treee98111ad38c398f5c396513536362352d45983ff /arch/arm/mach-exynos4/clock.c
parent684653842b65b98538e5d6198998e68c879bd45e (diff)
ARM: EXYNOS4: Add support clock for EXYNOS4212
This patch splits EXYNOS4 clock code to EXYNOS4 common, EXYNOS4210 and EXYNOS4212 for supporting new EXYNOS4212 SoC with one kernel image. Of course, this patch adds some clock codes for EXYNOS4212 SoC. Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos4/clock.c')
-rw-r--r--arch/arm/mach-exynos4/clock.c127
1 files changed, 56 insertions, 71 deletions
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 79d6cd0c8e7b..eb99467d6762 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -20,26 +20,28 @@
20#include <plat/pll.h> 20#include <plat/pll.h>
21#include <plat/s5p-clock.h> 21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h> 22#include <plat/clock-clksrc.h>
23#include <plat/exynos4.h>
23 24
24#include <mach/map.h> 25#include <mach/map.h>
25#include <mach/regs-clock.h> 26#include <mach/regs-clock.h>
26#include <mach/sysmmu.h> 27#include <mach/sysmmu.h>
28#include <mach/exynos4-clock.h>
27 29
28static struct clk clk_sclk_hdmi27m = { 30struct clk clk_sclk_hdmi27m = {
29 .name = "sclk_hdmi27m", 31 .name = "sclk_hdmi27m",
30 .rate = 27000000, 32 .rate = 27000000,
31}; 33};
32 34
33static struct clk clk_sclk_hdmiphy = { 35struct clk clk_sclk_hdmiphy = {
34 .name = "sclk_hdmiphy", 36 .name = "sclk_hdmiphy",
35}; 37};
36 38
37static struct clk clk_sclk_usbphy0 = { 39struct clk clk_sclk_usbphy0 = {
38 .name = "sclk_usbphy0", 40 .name = "sclk_usbphy0",
39 .rate = 27000000, 41 .rate = 27000000,
40}; 42};
41 43
42static struct clk clk_sclk_usbphy1 = { 44struct clk clk_sclk_usbphy1 = {
43 .name = "sclk_usbphy1", 45 .name = "sclk_usbphy1",
44}; 46};
45 47
@@ -58,12 +60,7 @@ static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
58 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable); 60 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
59} 61}
60 62
61static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) 63int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
62{
63 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable);
64}
65
66static int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
67{ 64{
68 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable); 65 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
69} 66}
@@ -103,12 +100,12 @@ static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
103 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable); 100 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
104} 101}
105 102
106static int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) 103int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
107{ 104{
108 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable); 105 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
109} 106}
110 107
111static int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) 108int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
112{ 109{
113 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable); 110 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
114} 111}
@@ -133,7 +130,7 @@ static struct clksrc_clk clk_mout_apll = {
133 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, 130 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
134}; 131};
135 132
136static struct clksrc_clk clk_sclk_apll = { 133struct clksrc_clk clk_sclk_apll = {
137 .clk = { 134 .clk = {
138 .name = "sclk_apll", 135 .name = "sclk_apll",
139 .parent = &clk_mout_apll.clk, 136 .parent = &clk_mout_apll.clk,
@@ -141,7 +138,7 @@ static struct clksrc_clk clk_sclk_apll = {
141 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, 138 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
142}; 139};
143 140
144static struct clksrc_clk clk_mout_epll = { 141struct clksrc_clk clk_mout_epll = {
145 .clk = { 142 .clk = {
146 .name = "mout_epll", 143 .name = "mout_epll",
147 }, 144 },
@@ -149,12 +146,13 @@ static struct clksrc_clk clk_mout_epll = {
149 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 }, 146 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
150}; 147};
151 148
152static struct clksrc_clk clk_mout_mpll = { 149struct clksrc_clk clk_mout_mpll = {
153 .clk = { 150 .clk = {
154 .name = "mout_mpll", 151 .name = "mout_mpll",
155 }, 152 },
156 .sources = &clk_src_mpll, 153 .sources = &clk_src_mpll,
157 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 }, 154
155 /* reg_src will be added in each SoCs' clock */
158}; 156};
159 157
160static struct clk *clkset_moutcore_list[] = { 158static struct clk *clkset_moutcore_list[] = {
@@ -224,12 +222,12 @@ static struct clksrc_clk clk_periphclk = {
224 222
225/* Core list of CMU_CORE side */ 223/* Core list of CMU_CORE side */
226 224
227static struct clk *clkset_corebus_list[] = { 225struct clk *clkset_corebus_list[] = {
228 [0] = &clk_mout_mpll.clk, 226 [0] = &clk_mout_mpll.clk,
229 [1] = &clk_sclk_apll.clk, 227 [1] = &clk_sclk_apll.clk,
230}; 228};
231 229
232static struct clksrc_sources clkset_mout_corebus = { 230struct clksrc_sources clkset_mout_corebus = {
233 .sources = clkset_corebus_list, 231 .sources = clkset_corebus_list,
234 .nr_sources = ARRAY_SIZE(clkset_corebus_list), 232 .nr_sources = ARRAY_SIZE(clkset_corebus_list),
235}; 233};
@@ -284,12 +282,12 @@ static struct clksrc_clk clk_pclk_acp = {
284 282
285/* Core list of CMU_TOP side */ 283/* Core list of CMU_TOP side */
286 284
287static struct clk *clkset_aclk_top_list[] = { 285struct clk *clkset_aclk_top_list[] = {
288 [0] = &clk_mout_mpll.clk, 286 [0] = &clk_mout_mpll.clk,
289 [1] = &clk_sclk_apll.clk, 287 [1] = &clk_sclk_apll.clk,
290}; 288};
291 289
292static struct clksrc_sources clkset_aclk = { 290struct clksrc_sources clkset_aclk = {
293 .sources = clkset_aclk_top_list, 291 .sources = clkset_aclk_top_list,
294 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list), 292 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
295}; 293};
@@ -321,7 +319,7 @@ static struct clksrc_clk clk_aclk_160 = {
321 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 }, 319 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
322}; 320};
323 321
324static struct clksrc_clk clk_aclk_133 = { 322struct clksrc_clk clk_aclk_133 = {
325 .clk = { 323 .clk = {
326 .name = "aclk_133", 324 .name = "aclk_133",
327 }, 325 },
@@ -360,7 +358,7 @@ static struct clksrc_sources clkset_sclk_vpll = {
360 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list), 358 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
361}; 359};
362 360
363static struct clksrc_clk clk_sclk_vpll = { 361struct clksrc_clk clk_sclk_vpll = {
364 .clk = { 362 .clk = {
365 .name = "sclk_vpll", 363 .name = "sclk_vpll",
366 }, 364 },
@@ -410,16 +408,6 @@ static struct clk init_clocks_off[] = {
410 .enable = exynos4_clk_ip_lcd0_ctrl, 408 .enable = exynos4_clk_ip_lcd0_ctrl,
411 .ctrlbit = (1 << 0), 409 .ctrlbit = (1 << 0),
412 }, { 410 }, {
413 .name = "fimd",
414 .devname = "exynos4-fb.1",
415 .enable = exynos4_clk_ip_lcd1_ctrl,
416 .ctrlbit = (1 << 0),
417 }, {
418 .name = "sataphy",
419 .parent = &clk_aclk_133.clk,
420 .enable = exynos4_clk_ip_fsys_ctrl,
421 .ctrlbit = (1 << 3),
422 }, {
423 .name = "hsmmc", 411 .name = "hsmmc",
424 .devname = "s3c-sdhci.0", 412 .devname = "s3c-sdhci.0",
425 .parent = &clk_aclk_133.clk, 413 .parent = &clk_aclk_133.clk,
@@ -449,11 +437,6 @@ static struct clk init_clocks_off[] = {
449 .enable = exynos4_clk_ip_fsys_ctrl, 437 .enable = exynos4_clk_ip_fsys_ctrl,
450 .ctrlbit = (1 << 9), 438 .ctrlbit = (1 << 9),
451 }, { 439 }, {
452 .name = "sata",
453 .parent = &clk_aclk_133.clk,
454 .enable = exynos4_clk_ip_fsys_ctrl,
455 .ctrlbit = (1 << 10),
456 }, {
457 .name = "pdma", 440 .name = "pdma",
458 .devname = "s3c-pl330.0", 441 .devname = "s3c-pl330.0",
459 .enable = exynos4_clk_ip_fsys_ctrl, 442 .enable = exynos4_clk_ip_fsys_ctrl,
@@ -673,7 +656,7 @@ static struct clk init_clocks[] = {
673 } 656 }
674}; 657};
675 658
676static struct clk *clkset_group_list[] = { 659struct clk *clkset_group_list[] = {
677 [0] = &clk_ext_xtal_mux, 660 [0] = &clk_ext_xtal_mux,
678 [1] = &clk_xusbxti, 661 [1] = &clk_xusbxti,
679 [2] = &clk_sclk_hdmi27m, 662 [2] = &clk_sclk_hdmi27m,
@@ -685,7 +668,7 @@ static struct clk *clkset_group_list[] = {
685 [8] = &clk_sclk_vpll.clk, 668 [8] = &clk_sclk_vpll.clk,
686}; 669};
687 670
688static struct clksrc_sources clkset_group = { 671struct clksrc_sources clkset_group = {
689 .sources = clkset_group_list, 672 .sources = clkset_group_list,
690 .nr_sources = ARRAY_SIZE(clkset_group_list), 673 .nr_sources = ARRAY_SIZE(clkset_group_list),
691}; 674};
@@ -969,25 +952,6 @@ static struct clksrc_clk clksrcs[] = {
969 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 }, 952 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
970 }, { 953 }, {
971 .clk = { 954 .clk = {
972 .name = "sclk_fimd",
973 .devname = "exynos4-fb.1",
974 .enable = exynos4_clksrc_mask_lcd1_ctrl,
975 .ctrlbit = (1 << 0),
976 },
977 .sources = &clkset_group,
978 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 },
979 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 },
980 }, {
981 .clk = {
982 .name = "sclk_sata",
983 .enable = exynos4_clksrc_mask_fsys_ctrl,
984 .ctrlbit = (1 << 24),
985 },
986 .sources = &clkset_mout_corebus,
987 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 },
988 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 },
989 }, {
990 .clk = {
991 .name = "sclk_spi", 955 .name = "sclk_spi",
992 .devname = "s3c64xx-spi.0", 956 .devname = "s3c64xx-spi.0",
993 .enable = exynos4_clksrc_mask_peril1_ctrl, 957 .enable = exynos4_clksrc_mask_peril1_ctrl,
@@ -1116,7 +1080,13 @@ static int xtal_rate;
1116 1080
1117static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) 1081static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1118{ 1082{
1119 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508); 1083 if (soc_is_exynos4210())
1084 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0),
1085 pll_4508);
1086 else if (soc_is_exynos4212())
1087 return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0));
1088 else
1089 return 0;
1120} 1090}
1121 1091
1122static struct clk_ops exynos4_fout_apll_ops = { 1092static struct clk_ops exynos4_fout_apll_ops = {
@@ -1126,10 +1096,10 @@ static struct clk_ops exynos4_fout_apll_ops = {
1126void __init_or_cpufreq exynos4_setup_clocks(void) 1096void __init_or_cpufreq exynos4_setup_clocks(void)
1127{ 1097{
1128 struct clk *xtal_clk; 1098 struct clk *xtal_clk;
1129 unsigned long apll; 1099 unsigned long apll = 0;
1130 unsigned long mpll; 1100 unsigned long mpll = 0;
1131 unsigned long epll; 1101 unsigned long epll = 0;
1132 unsigned long vpll; 1102 unsigned long vpll = 0;
1133 unsigned long vpllsrc; 1103 unsigned long vpllsrc;
1134 unsigned long xtal; 1104 unsigned long xtal;
1135 unsigned long armclk; 1105 unsigned long armclk;
@@ -1153,14 +1123,29 @@ void __init_or_cpufreq exynos4_setup_clocks(void)
1153 1123
1154 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); 1124 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1155 1125
1156 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508); 1126 if (soc_is_exynos4210()) {
1157 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508); 1127 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0),
1158 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0), 1128 pll_4508);
1159 __raw_readl(S5P_EPLL_CON1), pll_4600); 1129 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0),
1160 1130 pll_4508);
1161 vpllsrc = clk_get_rate(&clk_vpllsrc.clk); 1131 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
1162 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), 1132 __raw_readl(S5P_EPLL_CON1), pll_4600);
1163 __raw_readl(S5P_VPLL_CON1), pll_4650c); 1133
1134 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1135 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1136 __raw_readl(S5P_VPLL_CON1), pll_4650c);
1137 } else if (soc_is_exynos4212()) {
1138 apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0));
1139 mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0));
1140 epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0),
1141 __raw_readl(S5P_EPLL_CON1));
1142
1143 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1144 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1145 __raw_readl(S5P_VPLL_CON1));
1146 } else {
1147 /* nothing */
1148 }
1164 1149
1165 clk_fout_apll.ops = &exynos4_fout_apll_ops; 1150 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1166 clk_fout_mpll.rate = mpll; 1151 clk_fout_mpll.rate = mpll;