diff options
Diffstat (limited to 'arch/arm/mach-exynos4/clock.c')
-rw-r--r-- | arch/arm/mach-exynos4/clock.c | 218 |
1 files changed, 146 insertions, 72 deletions
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c index 86964d2e9e1b..0d59be3fa1fe 100644 --- a/arch/arm/mach-exynos4/clock.c +++ b/arch/arm/mach-exynos4/clock.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/syscore_ops.h> | ||
16 | 17 | ||
17 | #include <plat/cpu-freq.h> | 18 | #include <plat/cpu-freq.h> |
18 | #include <plat/clock.h> | 19 | #include <plat/clock.h> |
@@ -20,26 +21,93 @@ | |||
20 | #include <plat/pll.h> | 21 | #include <plat/pll.h> |
21 | #include <plat/s5p-clock.h> | 22 | #include <plat/s5p-clock.h> |
22 | #include <plat/clock-clksrc.h> | 23 | #include <plat/clock-clksrc.h> |
24 | #include <plat/exynos4.h> | ||
25 | #include <plat/pm.h> | ||
23 | 26 | ||
24 | #include <mach/map.h> | 27 | #include <mach/map.h> |
25 | #include <mach/regs-clock.h> | 28 | #include <mach/regs-clock.h> |
26 | #include <mach/sysmmu.h> | 29 | #include <mach/sysmmu.h> |
27 | 30 | #include <mach/exynos4-clock.h> | |
28 | static struct clk clk_sclk_hdmi27m = { | 31 | |
32 | static struct sleep_save exynos4_clock_save[] = { | ||
33 | SAVE_ITEM(S5P_CLKDIV_LEFTBUS), | ||
34 | SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS), | ||
35 | SAVE_ITEM(S5P_CLKDIV_RIGHTBUS), | ||
36 | SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS), | ||
37 | SAVE_ITEM(S5P_CLKSRC_TOP0), | ||
38 | SAVE_ITEM(S5P_CLKSRC_TOP1), | ||
39 | SAVE_ITEM(S5P_CLKSRC_CAM), | ||
40 | SAVE_ITEM(S5P_CLKSRC_TV), | ||
41 | SAVE_ITEM(S5P_CLKSRC_MFC), | ||
42 | SAVE_ITEM(S5P_CLKSRC_G3D), | ||
43 | SAVE_ITEM(S5P_CLKSRC_LCD0), | ||
44 | SAVE_ITEM(S5P_CLKSRC_MAUDIO), | ||
45 | SAVE_ITEM(S5P_CLKSRC_FSYS), | ||
46 | SAVE_ITEM(S5P_CLKSRC_PERIL0), | ||
47 | SAVE_ITEM(S5P_CLKSRC_PERIL1), | ||
48 | SAVE_ITEM(S5P_CLKDIV_CAM), | ||
49 | SAVE_ITEM(S5P_CLKDIV_TV), | ||
50 | SAVE_ITEM(S5P_CLKDIV_MFC), | ||
51 | SAVE_ITEM(S5P_CLKDIV_G3D), | ||
52 | SAVE_ITEM(S5P_CLKDIV_LCD0), | ||
53 | SAVE_ITEM(S5P_CLKDIV_MAUDIO), | ||
54 | SAVE_ITEM(S5P_CLKDIV_FSYS0), | ||
55 | SAVE_ITEM(S5P_CLKDIV_FSYS1), | ||
56 | SAVE_ITEM(S5P_CLKDIV_FSYS2), | ||
57 | SAVE_ITEM(S5P_CLKDIV_FSYS3), | ||
58 | SAVE_ITEM(S5P_CLKDIV_PERIL0), | ||
59 | SAVE_ITEM(S5P_CLKDIV_PERIL1), | ||
60 | SAVE_ITEM(S5P_CLKDIV_PERIL2), | ||
61 | SAVE_ITEM(S5P_CLKDIV_PERIL3), | ||
62 | SAVE_ITEM(S5P_CLKDIV_PERIL4), | ||
63 | SAVE_ITEM(S5P_CLKDIV_PERIL5), | ||
64 | SAVE_ITEM(S5P_CLKDIV_TOP), | ||
65 | SAVE_ITEM(S5P_CLKSRC_MASK_TOP), | ||
66 | SAVE_ITEM(S5P_CLKSRC_MASK_CAM), | ||
67 | SAVE_ITEM(S5P_CLKSRC_MASK_TV), | ||
68 | SAVE_ITEM(S5P_CLKSRC_MASK_LCD0), | ||
69 | SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO), | ||
70 | SAVE_ITEM(S5P_CLKSRC_MASK_FSYS), | ||
71 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0), | ||
72 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1), | ||
73 | SAVE_ITEM(S5P_CLKDIV2_RATIO), | ||
74 | SAVE_ITEM(S5P_CLKGATE_SCLKCAM), | ||
75 | SAVE_ITEM(S5P_CLKGATE_IP_CAM), | ||
76 | SAVE_ITEM(S5P_CLKGATE_IP_TV), | ||
77 | SAVE_ITEM(S5P_CLKGATE_IP_MFC), | ||
78 | SAVE_ITEM(S5P_CLKGATE_IP_G3D), | ||
79 | SAVE_ITEM(S5P_CLKGATE_IP_LCD0), | ||
80 | SAVE_ITEM(S5P_CLKGATE_IP_FSYS), | ||
81 | SAVE_ITEM(S5P_CLKGATE_IP_GPS), | ||
82 | SAVE_ITEM(S5P_CLKGATE_IP_PERIL), | ||
83 | SAVE_ITEM(S5P_CLKGATE_BLOCK), | ||
84 | SAVE_ITEM(S5P_CLKSRC_MASK_DMC), | ||
85 | SAVE_ITEM(S5P_CLKSRC_DMC), | ||
86 | SAVE_ITEM(S5P_CLKDIV_DMC0), | ||
87 | SAVE_ITEM(S5P_CLKDIV_DMC1), | ||
88 | SAVE_ITEM(S5P_CLKGATE_IP_DMC), | ||
89 | SAVE_ITEM(S5P_CLKSRC_CPU), | ||
90 | SAVE_ITEM(S5P_CLKDIV_CPU), | ||
91 | SAVE_ITEM(S5P_CLKDIV_CPU + 0x4), | ||
92 | SAVE_ITEM(S5P_CLKGATE_SCLKCPU), | ||
93 | SAVE_ITEM(S5P_CLKGATE_IP_CPU), | ||
94 | }; | ||
95 | |||
96 | struct clk clk_sclk_hdmi27m = { | ||
29 | .name = "sclk_hdmi27m", | 97 | .name = "sclk_hdmi27m", |
30 | .rate = 27000000, | 98 | .rate = 27000000, |
31 | }; | 99 | }; |
32 | 100 | ||
33 | static struct clk clk_sclk_hdmiphy = { | 101 | struct clk clk_sclk_hdmiphy = { |
34 | .name = "sclk_hdmiphy", | 102 | .name = "sclk_hdmiphy", |
35 | }; | 103 | }; |
36 | 104 | ||
37 | static struct clk clk_sclk_usbphy0 = { | 105 | struct clk clk_sclk_usbphy0 = { |
38 | .name = "sclk_usbphy0", | 106 | .name = "sclk_usbphy0", |
39 | .rate = 27000000, | 107 | .rate = 27000000, |
40 | }; | 108 | }; |
41 | 109 | ||
42 | static struct clk clk_sclk_usbphy1 = { | 110 | struct clk clk_sclk_usbphy1 = { |
43 | .name = "sclk_usbphy1", | 111 | .name = "sclk_usbphy1", |
44 | }; | 112 | }; |
45 | 113 | ||
@@ -58,12 +126,7 @@ static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable) | |||
58 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable); | 126 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable); |
59 | } | 127 | } |
60 | 128 | ||
61 | static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) | 129 | int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) |
62 | { | ||
63 | return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable); | ||
64 | } | ||
65 | |||
66 | static int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) | ||
67 | { | 130 | { |
68 | return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable); | 131 | return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable); |
69 | } | 132 | } |
@@ -103,12 +166,12 @@ static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable) | |||
103 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable); | 166 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable); |
104 | } | 167 | } |
105 | 168 | ||
106 | static int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) | 169 | int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) |
107 | { | 170 | { |
108 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable); | 171 | return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable); |
109 | } | 172 | } |
110 | 173 | ||
111 | static int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) | 174 | int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) |
112 | { | 175 | { |
113 | return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable); | 176 | return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable); |
114 | } | 177 | } |
@@ -133,7 +196,7 @@ static struct clksrc_clk clk_mout_apll = { | |||
133 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, | 196 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, |
134 | }; | 197 | }; |
135 | 198 | ||
136 | static struct clksrc_clk clk_sclk_apll = { | 199 | struct clksrc_clk clk_sclk_apll = { |
137 | .clk = { | 200 | .clk = { |
138 | .name = "sclk_apll", | 201 | .name = "sclk_apll", |
139 | .parent = &clk_mout_apll.clk, | 202 | .parent = &clk_mout_apll.clk, |
@@ -141,7 +204,7 @@ static struct clksrc_clk clk_sclk_apll = { | |||
141 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, | 204 | .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, |
142 | }; | 205 | }; |
143 | 206 | ||
144 | static struct clksrc_clk clk_mout_epll = { | 207 | struct clksrc_clk clk_mout_epll = { |
145 | .clk = { | 208 | .clk = { |
146 | .name = "mout_epll", | 209 | .name = "mout_epll", |
147 | }, | 210 | }, |
@@ -149,12 +212,13 @@ static struct clksrc_clk clk_mout_epll = { | |||
149 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 }, | 212 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 }, |
150 | }; | 213 | }; |
151 | 214 | ||
152 | static struct clksrc_clk clk_mout_mpll = { | 215 | struct clksrc_clk clk_mout_mpll = { |
153 | .clk = { | 216 | .clk = { |
154 | .name = "mout_mpll", | 217 | .name = "mout_mpll", |
155 | }, | 218 | }, |
156 | .sources = &clk_src_mpll, | 219 | .sources = &clk_src_mpll, |
157 | .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 }, | 220 | |
221 | /* reg_src will be added in each SoCs' clock */ | ||
158 | }; | 222 | }; |
159 | 223 | ||
160 | static struct clk *clkset_moutcore_list[] = { | 224 | static struct clk *clkset_moutcore_list[] = { |
@@ -224,12 +288,12 @@ static struct clksrc_clk clk_periphclk = { | |||
224 | 288 | ||
225 | /* Core list of CMU_CORE side */ | 289 | /* Core list of CMU_CORE side */ |
226 | 290 | ||
227 | static struct clk *clkset_corebus_list[] = { | 291 | struct clk *clkset_corebus_list[] = { |
228 | [0] = &clk_mout_mpll.clk, | 292 | [0] = &clk_mout_mpll.clk, |
229 | [1] = &clk_sclk_apll.clk, | 293 | [1] = &clk_sclk_apll.clk, |
230 | }; | 294 | }; |
231 | 295 | ||
232 | static struct clksrc_sources clkset_mout_corebus = { | 296 | struct clksrc_sources clkset_mout_corebus = { |
233 | .sources = clkset_corebus_list, | 297 | .sources = clkset_corebus_list, |
234 | .nr_sources = ARRAY_SIZE(clkset_corebus_list), | 298 | .nr_sources = ARRAY_SIZE(clkset_corebus_list), |
235 | }; | 299 | }; |
@@ -284,12 +348,12 @@ static struct clksrc_clk clk_pclk_acp = { | |||
284 | 348 | ||
285 | /* Core list of CMU_TOP side */ | 349 | /* Core list of CMU_TOP side */ |
286 | 350 | ||
287 | static struct clk *clkset_aclk_top_list[] = { | 351 | struct clk *clkset_aclk_top_list[] = { |
288 | [0] = &clk_mout_mpll.clk, | 352 | [0] = &clk_mout_mpll.clk, |
289 | [1] = &clk_sclk_apll.clk, | 353 | [1] = &clk_sclk_apll.clk, |
290 | }; | 354 | }; |
291 | 355 | ||
292 | static struct clksrc_sources clkset_aclk = { | 356 | struct clksrc_sources clkset_aclk = { |
293 | .sources = clkset_aclk_top_list, | 357 | .sources = clkset_aclk_top_list, |
294 | .nr_sources = ARRAY_SIZE(clkset_aclk_top_list), | 358 | .nr_sources = ARRAY_SIZE(clkset_aclk_top_list), |
295 | }; | 359 | }; |
@@ -321,7 +385,7 @@ static struct clksrc_clk clk_aclk_160 = { | |||
321 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 }, | 385 | .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 }, |
322 | }; | 386 | }; |
323 | 387 | ||
324 | static struct clksrc_clk clk_aclk_133 = { | 388 | struct clksrc_clk clk_aclk_133 = { |
325 | .clk = { | 389 | .clk = { |
326 | .name = "aclk_133", | 390 | .name = "aclk_133", |
327 | }, | 391 | }, |
@@ -360,7 +424,7 @@ static struct clksrc_sources clkset_sclk_vpll = { | |||
360 | .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list), | 424 | .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list), |
361 | }; | 425 | }; |
362 | 426 | ||
363 | static struct clksrc_clk clk_sclk_vpll = { | 427 | struct clksrc_clk clk_sclk_vpll = { |
364 | .clk = { | 428 | .clk = { |
365 | .name = "sclk_vpll", | 429 | .name = "sclk_vpll", |
366 | }, | 430 | }, |
@@ -410,16 +474,6 @@ static struct clk init_clocks_off[] = { | |||
410 | .enable = exynos4_clk_ip_lcd0_ctrl, | 474 | .enable = exynos4_clk_ip_lcd0_ctrl, |
411 | .ctrlbit = (1 << 0), | 475 | .ctrlbit = (1 << 0), |
412 | }, { | 476 | }, { |
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", | 477 | .name = "hsmmc", |
424 | .devname = "s3c-sdhci.0", | 478 | .devname = "s3c-sdhci.0", |
425 | .parent = &clk_aclk_133.clk, | 479 | .parent = &clk_aclk_133.clk, |
@@ -449,11 +503,6 @@ static struct clk init_clocks_off[] = { | |||
449 | .enable = exynos4_clk_ip_fsys_ctrl, | 503 | .enable = exynos4_clk_ip_fsys_ctrl, |
450 | .ctrlbit = (1 << 9), | 504 | .ctrlbit = (1 << 9), |
451 | }, { | 505 | }, { |
452 | .name = "sata", | ||
453 | .parent = &clk_aclk_133.clk, | ||
454 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
455 | .ctrlbit = (1 << 10), | ||
456 | }, { | ||
457 | .name = "pdma", | 506 | .name = "pdma", |
458 | .devname = "s3c-pl330.0", | 507 | .devname = "s3c-pl330.0", |
459 | .enable = exynos4_clk_ip_fsys_ctrl, | 508 | .enable = exynos4_clk_ip_fsys_ctrl, |
@@ -673,7 +722,7 @@ static struct clk init_clocks[] = { | |||
673 | } | 722 | } |
674 | }; | 723 | }; |
675 | 724 | ||
676 | static struct clk *clkset_group_list[] = { | 725 | struct clk *clkset_group_list[] = { |
677 | [0] = &clk_ext_xtal_mux, | 726 | [0] = &clk_ext_xtal_mux, |
678 | [1] = &clk_xusbxti, | 727 | [1] = &clk_xusbxti, |
679 | [2] = &clk_sclk_hdmi27m, | 728 | [2] = &clk_sclk_hdmi27m, |
@@ -685,7 +734,7 @@ static struct clk *clkset_group_list[] = { | |||
685 | [8] = &clk_sclk_vpll.clk, | 734 | [8] = &clk_sclk_vpll.clk, |
686 | }; | 735 | }; |
687 | 736 | ||
688 | static struct clksrc_sources clkset_group = { | 737 | struct clksrc_sources clkset_group = { |
689 | .sources = clkset_group_list, | 738 | .sources = clkset_group_list, |
690 | .nr_sources = ARRAY_SIZE(clkset_group_list), | 739 | .nr_sources = ARRAY_SIZE(clkset_group_list), |
691 | }; | 740 | }; |
@@ -967,25 +1016,6 @@ static struct clksrc_clk clksrcs[] = { | |||
967 | .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 }, | 1016 | .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 }, |
968 | }, { | 1017 | }, { |
969 | .clk = { | 1018 | .clk = { |
970 | .name = "sclk_fimd", | ||
971 | .devname = "exynos4-fb.1", | ||
972 | .enable = exynos4_clksrc_mask_lcd1_ctrl, | ||
973 | .ctrlbit = (1 << 0), | ||
974 | }, | ||
975 | .sources = &clkset_group, | ||
976 | .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 }, | ||
977 | .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 }, | ||
978 | }, { | ||
979 | .clk = { | ||
980 | .name = "sclk_sata", | ||
981 | .enable = exynos4_clksrc_mask_fsys_ctrl, | ||
982 | .ctrlbit = (1 << 24), | ||
983 | }, | ||
984 | .sources = &clkset_mout_corebus, | ||
985 | .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 }, | ||
986 | .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 }, | ||
987 | }, { | ||
988 | .clk = { | ||
989 | .name = "sclk_spi", | 1019 | .name = "sclk_spi", |
990 | .devname = "s3c64xx-spi.0", | 1020 | .devname = "s3c64xx-spi.0", |
991 | .enable = exynos4_clksrc_mask_peril1_ctrl, | 1021 | .enable = exynos4_clksrc_mask_peril1_ctrl, |
@@ -1114,7 +1144,13 @@ static int xtal_rate; | |||
1114 | 1144 | ||
1115 | static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) | 1145 | static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) |
1116 | { | 1146 | { |
1117 | return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508); | 1147 | if (soc_is_exynos4210()) |
1148 | return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), | ||
1149 | pll_4508); | ||
1150 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
1151 | return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0)); | ||
1152 | else | ||
1153 | return 0; | ||
1118 | } | 1154 | } |
1119 | 1155 | ||
1120 | static struct clk_ops exynos4_fout_apll_ops = { | 1156 | static struct clk_ops exynos4_fout_apll_ops = { |
@@ -1124,10 +1160,10 @@ static struct clk_ops exynos4_fout_apll_ops = { | |||
1124 | void __init_or_cpufreq exynos4_setup_clocks(void) | 1160 | void __init_or_cpufreq exynos4_setup_clocks(void) |
1125 | { | 1161 | { |
1126 | struct clk *xtal_clk; | 1162 | struct clk *xtal_clk; |
1127 | unsigned long apll; | 1163 | unsigned long apll = 0; |
1128 | unsigned long mpll; | 1164 | unsigned long mpll = 0; |
1129 | unsigned long epll; | 1165 | unsigned long epll = 0; |
1130 | unsigned long vpll; | 1166 | unsigned long vpll = 0; |
1131 | unsigned long vpllsrc; | 1167 | unsigned long vpllsrc; |
1132 | unsigned long xtal; | 1168 | unsigned long xtal; |
1133 | unsigned long armclk; | 1169 | unsigned long armclk; |
@@ -1151,14 +1187,29 @@ void __init_or_cpufreq exynos4_setup_clocks(void) | |||
1151 | 1187 | ||
1152 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | 1188 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); |
1153 | 1189 | ||
1154 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508); | 1190 | if (soc_is_exynos4210()) { |
1155 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508); | 1191 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), |
1156 | epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0), | 1192 | pll_4508); |
1157 | __raw_readl(S5P_EPLL_CON1), pll_4600); | 1193 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), |
1158 | 1194 | pll_4508); | |
1159 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); | 1195 | epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0), |
1160 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | 1196 | __raw_readl(S5P_EPLL_CON1), pll_4600); |
1161 | __raw_readl(S5P_VPLL_CON1), pll_4650c); | 1197 | |
1198 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); | ||
1199 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | ||
1200 | __raw_readl(S5P_VPLL_CON1), pll_4650c); | ||
1201 | } else if (soc_is_exynos4212() || soc_is_exynos4412()) { | ||
1202 | apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0)); | ||
1203 | mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0)); | ||
1204 | epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0), | ||
1205 | __raw_readl(S5P_EPLL_CON1)); | ||
1206 | |||
1207 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); | ||
1208 | vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | ||
1209 | __raw_readl(S5P_VPLL_CON1)); | ||
1210 | } else { | ||
1211 | /* nothing */ | ||
1212 | } | ||
1162 | 1213 | ||
1163 | clk_fout_apll.ops = &exynos4_fout_apll_ops; | 1214 | clk_fout_apll.ops = &exynos4_fout_apll_ops; |
1164 | clk_fout_mpll.rate = mpll; | 1215 | clk_fout_mpll.rate = mpll; |
@@ -1193,6 +1244,28 @@ static struct clk *clks[] __initdata = { | |||
1193 | /* Nothing here yet */ | 1244 | /* Nothing here yet */ |
1194 | }; | 1245 | }; |
1195 | 1246 | ||
1247 | #ifdef CONFIG_PM_SLEEP | ||
1248 | static int exynos4_clock_suspend(void) | ||
1249 | { | ||
1250 | s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1251 | return 0; | ||
1252 | } | ||
1253 | |||
1254 | static void exynos4_clock_resume(void) | ||
1255 | { | ||
1256 | s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1257 | } | ||
1258 | |||
1259 | #else | ||
1260 | #define exynos4_clock_suspend NULL | ||
1261 | #define exynos4_clock_resume NULL | ||
1262 | #endif | ||
1263 | |||
1264 | struct syscore_ops exynos4_clock_syscore_ops = { | ||
1265 | .suspend = exynos4_clock_suspend, | ||
1266 | .resume = exynos4_clock_resume, | ||
1267 | }; | ||
1268 | |||
1196 | void __init exynos4_register_clocks(void) | 1269 | void __init exynos4_register_clocks(void) |
1197 | { | 1270 | { |
1198 | int ptr; | 1271 | int ptr; |
@@ -1208,5 +1281,6 @@ void __init exynos4_register_clocks(void) | |||
1208 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 1281 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
1209 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 1282 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
1210 | 1283 | ||
1284 | register_syscore_ops(&exynos4_clock_syscore_ops); | ||
1211 | s3c_pwmclk_init(); | 1285 | s3c_pwmclk_init(); |
1212 | } | 1286 | } |