2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
5 * Clock support for EXYNOS5 SoCs
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/err.h>
15 #include <linux/syscore_ops.h>
17 #include <plat/cpu-freq.h>
18 #include <plat/clock.h>
21 #include <plat/s5p-clock.h>
22 #include <plat/clock-clksrc.h>
26 #include <mach/regs-clock.h>
27 #include <mach/sysmmu.h>
31 #ifdef CONFIG_PM_SLEEP
32 static struct sleep_save exynos5_clock_save
[] = {
33 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_TOP
),
34 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_GSCL
),
35 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_DISP1_0
),
36 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_FSYS
),
37 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_MAUDIO
),
38 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC0
),
39 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC1
),
40 SAVE_ITEM(EXYNOS5_CLKGATE_IP_GSCL
),
41 SAVE_ITEM(EXYNOS5_CLKGATE_IP_DISP1
),
42 SAVE_ITEM(EXYNOS5_CLKGATE_IP_MFC
),
43 SAVE_ITEM(EXYNOS5_CLKGATE_IP_G3D
),
44 SAVE_ITEM(EXYNOS5_CLKGATE_IP_GEN
),
45 SAVE_ITEM(EXYNOS5_CLKGATE_IP_FSYS
),
46 SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIC
),
47 SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIS
),
48 SAVE_ITEM(EXYNOS5_CLKGATE_BLOCK
),
49 SAVE_ITEM(EXYNOS5_CLKDIV_TOP0
),
50 SAVE_ITEM(EXYNOS5_CLKDIV_TOP1
),
51 SAVE_ITEM(EXYNOS5_CLKDIV_GSCL
),
52 SAVE_ITEM(EXYNOS5_CLKDIV_DISP1_0
),
53 SAVE_ITEM(EXYNOS5_CLKDIV_GEN
),
54 SAVE_ITEM(EXYNOS5_CLKDIV_MAUDIO
),
55 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS0
),
56 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS1
),
57 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS2
),
58 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS3
),
59 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC0
),
60 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC1
),
61 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC2
),
62 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC3
),
63 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC4
),
64 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC5
),
65 SAVE_ITEM(EXYNOS5_SCLK_DIV_ISP
),
66 SAVE_ITEM(EXYNOS5_CLKSRC_TOP0
),
67 SAVE_ITEM(EXYNOS5_CLKSRC_TOP1
),
68 SAVE_ITEM(EXYNOS5_CLKSRC_TOP2
),
69 SAVE_ITEM(EXYNOS5_CLKSRC_TOP3
),
70 SAVE_ITEM(EXYNOS5_CLKSRC_GSCL
),
71 SAVE_ITEM(EXYNOS5_CLKSRC_DISP1_0
),
72 SAVE_ITEM(EXYNOS5_CLKSRC_MAUDIO
),
73 SAVE_ITEM(EXYNOS5_CLKSRC_FSYS
),
74 SAVE_ITEM(EXYNOS5_CLKSRC_PERIC0
),
75 SAVE_ITEM(EXYNOS5_CLKSRC_PERIC1
),
76 SAVE_ITEM(EXYNOS5_SCLK_SRC_ISP
),
77 SAVE_ITEM(EXYNOS5_EPLL_CON0
),
78 SAVE_ITEM(EXYNOS5_EPLL_CON1
),
79 SAVE_ITEM(EXYNOS5_EPLL_CON2
),
80 SAVE_ITEM(EXYNOS5_VPLL_CON0
),
81 SAVE_ITEM(EXYNOS5_VPLL_CON1
),
82 SAVE_ITEM(EXYNOS5_VPLL_CON2
),
86 static struct clk exynos5_clk_sclk_dptxphy
= {
90 static struct clk exynos5_clk_sclk_hdmi24m
= {
91 .name
= "sclk_hdmi24m",
95 static struct clk exynos5_clk_sclk_hdmi27m
= {
96 .name
= "sclk_hdmi27m",
100 static struct clk exynos5_clk_sclk_hdmiphy
= {
101 .name
= "sclk_hdmiphy",
104 static struct clk exynos5_clk_sclk_usbphy
= {
105 .name
= "sclk_usbphy",
109 static int exynos5_clksrc_mask_top_ctrl(struct clk
*clk
, int enable
)
111 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_TOP
, clk
, enable
);
114 static int exynos5_clksrc_mask_disp1_0_ctrl(struct clk
*clk
, int enable
)
116 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_DISP1_0
, clk
, enable
);
119 static int exynos5_clksrc_mask_fsys_ctrl(struct clk
*clk
, int enable
)
121 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_FSYS
, clk
, enable
);
124 static int exynos5_clksrc_mask_gscl_ctrl(struct clk
*clk
, int enable
)
126 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_GSCL
, clk
, enable
);
129 static int exynos5_clksrc_mask_peric0_ctrl(struct clk
*clk
, int enable
)
131 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0
, clk
, enable
);
134 static int exynos5_clksrc_mask_peric1_ctrl(struct clk
*clk
, int enable
)
136 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC1
, clk
, enable
);
139 static int exynos5_clk_ip_acp_ctrl(struct clk
*clk
, int enable
)
141 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ACP
, clk
, enable
);
144 static int exynos5_clk_ip_core_ctrl(struct clk
*clk
, int enable
)
146 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_CORE
, clk
, enable
);
149 static int exynos5_clk_ip_disp1_ctrl(struct clk
*clk
, int enable
)
151 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_DISP1
, clk
, enable
);
154 static int exynos5_clk_ip_fsys_ctrl(struct clk
*clk
, int enable
)
156 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_FSYS
, clk
, enable
);
159 static int exynos5_clk_block_ctrl(struct clk
*clk
, int enable
)
161 return s5p_gatectrl(EXYNOS5_CLKGATE_BLOCK
, clk
, enable
);
164 static int exynos5_clk_ip_gen_ctrl(struct clk
*clk
, int enable
)
166 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN
, clk
, enable
);
169 static int exynos5_clk_ip_gps_ctrl(struct clk
*clk
, int enable
)
171 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GPS
, clk
, enable
);
174 static int exynos5_clk_ip_mfc_ctrl(struct clk
*clk
, int enable
)
176 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC
, clk
, enable
);
179 static int exynos5_clk_ip_peric_ctrl(struct clk
*clk
, int enable
)
181 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIC
, clk
, enable
);
184 static int exynos5_clk_ip_peris_ctrl(struct clk
*clk
, int enable
)
186 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIS
, clk
, enable
);
189 static int exynos5_clk_ip_gscl_ctrl(struct clk
*clk
, int enable
)
191 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GSCL
, clk
, enable
);
194 static int exynos5_clk_ip_isp0_ctrl(struct clk
*clk
, int enable
)
196 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP0
, clk
, enable
);
199 static int exynos5_clk_ip_isp1_ctrl(struct clk
*clk
, int enable
)
201 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP1
, clk
, enable
);
204 /* Core list of CMU_CPU side */
206 static struct clksrc_clk exynos5_clk_mout_apll
= {
210 .sources
= &clk_src_apll
,
211 .reg_src
= { .reg
= EXYNOS5_CLKSRC_CPU
, .shift
= 0, .size
= 1 },
214 static struct clksrc_clk exynos5_clk_sclk_apll
= {
217 .parent
= &exynos5_clk_mout_apll
.clk
,
219 .reg_div
= { .reg
= EXYNOS5_CLKDIV_CPU0
, .shift
= 24, .size
= 3 },
222 static struct clksrc_clk exynos5_clk_mout_bpll_fout
= {
224 .name
= "mout_bpll_fout",
226 .sources
= &clk_src_bpll_fout
,
227 .reg_src
= { .reg
= EXYNOS5_PLL_DIV2_SEL
, .shift
= 0, .size
= 1 },
230 static struct clk
*exynos5_clk_src_bpll_list
[] = {
232 [1] = &exynos5_clk_mout_bpll_fout
.clk
,
235 static struct clksrc_sources exynos5_clk_src_bpll
= {
236 .sources
= exynos5_clk_src_bpll_list
,
237 .nr_sources
= ARRAY_SIZE(exynos5_clk_src_bpll_list
),
240 static struct clksrc_clk exynos5_clk_mout_bpll
= {
244 .sources
= &exynos5_clk_src_bpll
,
245 .reg_src
= { .reg
= EXYNOS5_CLKSRC_CDREX
, .shift
= 0, .size
= 1 },
248 static struct clk
*exynos5_clk_src_bpll_user_list
[] = {
250 [1] = &exynos5_clk_mout_bpll
.clk
,
253 static struct clksrc_sources exynos5_clk_src_bpll_user
= {
254 .sources
= exynos5_clk_src_bpll_user_list
,
255 .nr_sources
= ARRAY_SIZE(exynos5_clk_src_bpll_user_list
),
258 static struct clksrc_clk exynos5_clk_mout_bpll_user
= {
260 .name
= "mout_bpll_user",
262 .sources
= &exynos5_clk_src_bpll_user
,
263 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP2
, .shift
= 24, .size
= 1 },
266 static struct clksrc_clk exynos5_clk_mout_cpll
= {
270 .sources
= &clk_src_cpll
,
271 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP2
, .shift
= 8, .size
= 1 },
274 static struct clksrc_clk exynos5_clk_mout_epll
= {
278 .sources
= &clk_src_epll
,
279 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP2
, .shift
= 12, .size
= 1 },
282 static struct clksrc_clk exynos5_clk_mout_mpll_fout
= {
284 .name
= "mout_mpll_fout",
286 .sources
= &clk_src_mpll_fout
,
287 .reg_src
= { .reg
= EXYNOS5_PLL_DIV2_SEL
, .shift
= 4, .size
= 1 },
290 static struct clk
*exynos5_clk_src_mpll_list
[] = {
292 [1] = &exynos5_clk_mout_mpll_fout
.clk
,
295 static struct clksrc_sources exynos5_clk_src_mpll
= {
296 .sources
= exynos5_clk_src_mpll_list
,
297 .nr_sources
= ARRAY_SIZE(exynos5_clk_src_mpll_list
),
300 struct clksrc_clk exynos5_clk_mout_mpll
= {
304 .sources
= &exynos5_clk_src_mpll
,
305 .reg_src
= { .reg
= EXYNOS5_CLKSRC_CORE1
, .shift
= 8, .size
= 1 },
308 static struct clk
*exynos_clkset_vpllsrc_list
[] = {
310 [1] = &exynos5_clk_sclk_hdmi27m
,
313 static struct clksrc_sources exynos5_clkset_vpllsrc
= {
314 .sources
= exynos_clkset_vpllsrc_list
,
315 .nr_sources
= ARRAY_SIZE(exynos_clkset_vpllsrc_list
),
318 static struct clksrc_clk exynos5_clk_vpllsrc
= {
321 .enable
= exynos5_clksrc_mask_top_ctrl
,
324 .sources
= &exynos5_clkset_vpllsrc
,
325 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP2
, .shift
= 0, .size
= 1 },
328 static struct clk
*exynos5_clkset_sclk_vpll_list
[] = {
329 [0] = &exynos5_clk_vpllsrc
.clk
,
330 [1] = &clk_fout_vpll
,
333 static struct clksrc_sources exynos5_clkset_sclk_vpll
= {
334 .sources
= exynos5_clkset_sclk_vpll_list
,
335 .nr_sources
= ARRAY_SIZE(exynos5_clkset_sclk_vpll_list
),
338 static struct clksrc_clk exynos5_clk_sclk_vpll
= {
342 .sources
= &exynos5_clkset_sclk_vpll
,
343 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP2
, .shift
= 16, .size
= 1 },
346 static struct clksrc_clk exynos5_clk_sclk_pixel
= {
348 .name
= "sclk_pixel",
349 .parent
= &exynos5_clk_sclk_vpll
.clk
,
351 .reg_div
= { .reg
= EXYNOS5_CLKDIV_DISP1_0
, .shift
= 28, .size
= 4 },
354 static struct clk
*exynos5_clkset_sclk_hdmi_list
[] = {
355 [0] = &exynos5_clk_sclk_pixel
.clk
,
356 [1] = &exynos5_clk_sclk_hdmiphy
,
359 static struct clksrc_sources exynos5_clkset_sclk_hdmi
= {
360 .sources
= exynos5_clkset_sclk_hdmi_list
,
361 .nr_sources
= ARRAY_SIZE(exynos5_clkset_sclk_hdmi_list
),
364 static struct clksrc_clk exynos5_clk_sclk_hdmi
= {
367 .enable
= exynos5_clksrc_mask_disp1_0_ctrl
,
368 .ctrlbit
= (1 << 20),
370 .sources
= &exynos5_clkset_sclk_hdmi
,
371 .reg_src
= { .reg
= EXYNOS5_CLKSRC_DISP1_0
, .shift
= 20, .size
= 1 },
374 static struct clksrc_clk
*exynos5_sclk_tv
[] = {
375 &exynos5_clk_sclk_pixel
,
376 &exynos5_clk_sclk_hdmi
,
379 static struct clk
*exynos5_clk_src_mpll_user_list
[] = {
381 [1] = &exynos5_clk_mout_mpll
.clk
,
384 static struct clksrc_sources exynos5_clk_src_mpll_user
= {
385 .sources
= exynos5_clk_src_mpll_user_list
,
386 .nr_sources
= ARRAY_SIZE(exynos5_clk_src_mpll_user_list
),
389 static struct clksrc_clk exynos5_clk_mout_mpll_user
= {
391 .name
= "mout_mpll_user",
393 .sources
= &exynos5_clk_src_mpll_user
,
394 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP2
, .shift
= 20, .size
= 1 },
397 static struct clk
*exynos5_clkset_mout_cpu_list
[] = {
398 [0] = &exynos5_clk_mout_apll
.clk
,
399 [1] = &exynos5_clk_mout_mpll
.clk
,
402 static struct clksrc_sources exynos5_clkset_mout_cpu
= {
403 .sources
= exynos5_clkset_mout_cpu_list
,
404 .nr_sources
= ARRAY_SIZE(exynos5_clkset_mout_cpu_list
),
407 static struct clksrc_clk exynos5_clk_mout_cpu
= {
411 .sources
= &exynos5_clkset_mout_cpu
,
412 .reg_src
= { .reg
= EXYNOS5_CLKSRC_CPU
, .shift
= 16, .size
= 1 },
415 static struct clksrc_clk exynos5_clk_dout_armclk
= {
417 .name
= "dout_armclk",
418 .parent
= &exynos5_clk_mout_cpu
.clk
,
420 .reg_div
= { .reg
= EXYNOS5_CLKDIV_CPU0
, .shift
= 0, .size
= 3 },
423 static struct clksrc_clk exynos5_clk_dout_arm2clk
= {
425 .name
= "dout_arm2clk",
426 .parent
= &exynos5_clk_dout_armclk
.clk
,
428 .reg_div
= { .reg
= EXYNOS5_CLKDIV_CPU0
, .shift
= 28, .size
= 3 },
431 static struct clk exynos5_clk_armclk
= {
433 .parent
= &exynos5_clk_dout_arm2clk
.clk
,
436 /* Core list of CMU_CDREX side */
438 static struct clk
*exynos5_clkset_cdrex_list
[] = {
439 [0] = &exynos5_clk_mout_mpll
.clk
,
440 [1] = &exynos5_clk_mout_bpll
.clk
,
443 static struct clksrc_sources exynos5_clkset_cdrex
= {
444 .sources
= exynos5_clkset_cdrex_list
,
445 .nr_sources
= ARRAY_SIZE(exynos5_clkset_cdrex_list
),
448 static struct clksrc_clk exynos5_clk_cdrex
= {
452 .sources
= &exynos5_clkset_cdrex
,
453 .reg_src
= { .reg
= EXYNOS5_CLKSRC_CDREX
, .shift
= 4, .size
= 1 },
454 .reg_div
= { .reg
= EXYNOS5_CLKDIV_CDREX
, .shift
= 16, .size
= 3 },
457 static struct clksrc_clk exynos5_clk_aclk_acp
= {
460 .parent
= &exynos5_clk_mout_mpll
.clk
,
462 .reg_div
= { .reg
= EXYNOS5_CLKDIV_ACP
, .shift
= 0, .size
= 3 },
465 static struct clksrc_clk exynos5_clk_pclk_acp
= {
468 .parent
= &exynos5_clk_aclk_acp
.clk
,
470 .reg_div
= { .reg
= EXYNOS5_CLKDIV_ACP
, .shift
= 4, .size
= 3 },
473 /* Core list of CMU_TOP side */
475 struct clk
*exynos5_clkset_aclk_top_list
[] = {
476 [0] = &exynos5_clk_mout_mpll_user
.clk
,
477 [1] = &exynos5_clk_mout_bpll_user
.clk
,
480 struct clksrc_sources exynos5_clkset_aclk
= {
481 .sources
= exynos5_clkset_aclk_top_list
,
482 .nr_sources
= ARRAY_SIZE(exynos5_clkset_aclk_top_list
),
485 static struct clksrc_clk exynos5_clk_aclk_400
= {
489 .sources
= &exynos5_clkset_aclk
,
490 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP0
, .shift
= 20, .size
= 1 },
491 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 24, .size
= 3 },
494 struct clk
*exynos5_clkset_aclk_333_166_list
[] = {
495 [0] = &exynos5_clk_mout_cpll
.clk
,
496 [1] = &exynos5_clk_mout_mpll_user
.clk
,
499 struct clksrc_sources exynos5_clkset_aclk_333_166
= {
500 .sources
= exynos5_clkset_aclk_333_166_list
,
501 .nr_sources
= ARRAY_SIZE(exynos5_clkset_aclk_333_166_list
),
504 static struct clksrc_clk exynos5_clk_aclk_333
= {
508 .sources
= &exynos5_clkset_aclk_333_166
,
509 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP0
, .shift
= 16, .size
= 1 },
510 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 20, .size
= 3 },
513 static struct clksrc_clk exynos5_clk_aclk_166
= {
517 .sources
= &exynos5_clkset_aclk_333_166
,
518 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP0
, .shift
= 8, .size
= 1 },
519 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 8, .size
= 3 },
522 static struct clksrc_clk exynos5_clk_aclk_266
= {
525 .parent
= &exynos5_clk_mout_mpll_user
.clk
,
527 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 16, .size
= 3 },
530 static struct clksrc_clk exynos5_clk_aclk_200
= {
534 .sources
= &exynos5_clkset_aclk
,
535 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP0
, .shift
= 12, .size
= 1 },
536 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 12, .size
= 3 },
539 static struct clksrc_clk exynos5_clk_aclk_66_pre
= {
541 .name
= "aclk_66_pre",
542 .parent
= &exynos5_clk_mout_mpll_user
.clk
,
544 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP1
, .shift
= 24, .size
= 3 },
547 static struct clksrc_clk exynos5_clk_aclk_66
= {
550 .parent
= &exynos5_clk_aclk_66_pre
.clk
,
552 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 0, .size
= 3 },
555 static struct clk exynos5_init_clocks_off
[] = {
558 .parent
= &exynos5_clk_aclk_66
.clk
,
559 .enable
= exynos5_clk_ip_peric_ctrl
,
560 .ctrlbit
= (1 << 24),
563 .parent
= &exynos5_clk_aclk_66
.clk
,
564 .enable
= exynos5_clk_ip_peris_ctrl
,
565 .ctrlbit
= (1 << 20),
568 .parent
= &exynos5_clk_aclk_66
.clk
,
569 .enable
= exynos5_clk_ip_peris_ctrl
,
570 .ctrlbit
= (1 << 19),
573 .devname
= "exynos4-sdhci.0",
574 .parent
= &exynos5_clk_aclk_200
.clk
,
575 .enable
= exynos5_clk_ip_fsys_ctrl
,
576 .ctrlbit
= (1 << 12),
579 .devname
= "exynos4-sdhci.1",
580 .parent
= &exynos5_clk_aclk_200
.clk
,
581 .enable
= exynos5_clk_ip_fsys_ctrl
,
582 .ctrlbit
= (1 << 13),
585 .devname
= "exynos4-sdhci.2",
586 .parent
= &exynos5_clk_aclk_200
.clk
,
587 .enable
= exynos5_clk_ip_fsys_ctrl
,
588 .ctrlbit
= (1 << 14),
591 .devname
= "exynos4-sdhci.3",
592 .parent
= &exynos5_clk_aclk_200
.clk
,
593 .enable
= exynos5_clk_ip_fsys_ctrl
,
594 .ctrlbit
= (1 << 15),
597 .parent
= &exynos5_clk_aclk_200
.clk
,
598 .enable
= exynos5_clk_ip_fsys_ctrl
,
599 .ctrlbit
= (1 << 16),
603 .enable
= exynos5_clk_ip_fsys_ctrl
,
607 .enable
= exynos5_clk_ip_fsys_ctrl
,
608 .ctrlbit
= (1 << 24),
610 .name
= "sata_phy_i2c",
611 .enable
= exynos5_clk_ip_fsys_ctrl
,
612 .ctrlbit
= (1 << 25),
615 .devname
= "s5p-mfc",
616 .enable
= exynos5_clk_ip_mfc_ctrl
,
620 .devname
= "exynos4-hdmi",
621 .enable
= exynos5_clk_ip_disp1_ctrl
,
625 .devname
= "s5p-mixer",
626 .enable
= exynos5_clk_ip_disp1_ctrl
,
630 .enable
= exynos5_clk_ip_gen_ctrl
,
634 .enable
= exynos5_clk_ip_disp1_ctrl
,
638 .devname
= "samsung-i2s.1",
639 .enable
= exynos5_clk_ip_peric_ctrl
,
640 .ctrlbit
= (1 << 20),
643 .devname
= "samsung-i2s.2",
644 .enable
= exynos5_clk_ip_peric_ctrl
,
645 .ctrlbit
= (1 << 21),
648 .devname
= "samsung-pcm.1",
649 .enable
= exynos5_clk_ip_peric_ctrl
,
650 .ctrlbit
= (1 << 22),
653 .devname
= "samsung-pcm.2",
654 .enable
= exynos5_clk_ip_peric_ctrl
,
655 .ctrlbit
= (1 << 23),
658 .devname
= "samsung-spdif",
659 .enable
= exynos5_clk_ip_peric_ctrl
,
660 .ctrlbit
= (1 << 26),
663 .devname
= "samsung-ac97",
664 .enable
= exynos5_clk_ip_peric_ctrl
,
665 .ctrlbit
= (1 << 27),
668 .enable
= exynos5_clk_ip_fsys_ctrl
,
669 .ctrlbit
= (1 << 18),
672 .enable
= exynos5_clk_ip_fsys_ctrl
,
676 .enable
= exynos5_clk_ip_gps_ctrl
,
677 .ctrlbit
= ((1 << 3) | (1 << 2) | (1 << 0)),
680 .enable
= exynos5_clk_ip_fsys_ctrl
,
681 .ctrlbit
= (1 << 22),
684 .enable
= exynos5_clk_ip_fsys_ctrl
,
685 .ctrlbit
= ((1 << 30) | (1 << 26) | (1 << 23)),
688 .enable
= exynos5_clk_ip_core_ctrl
,
689 .ctrlbit
= ((1 << 21) | (1 << 3)),
692 .enable
= exynos5_clk_ip_fsys_ctrl
,
696 .devname
= "s3c2440-i2c.0",
697 .parent
= &exynos5_clk_aclk_66
.clk
,
698 .enable
= exynos5_clk_ip_peric_ctrl
,
702 .devname
= "s3c2440-i2c.1",
703 .parent
= &exynos5_clk_aclk_66
.clk
,
704 .enable
= exynos5_clk_ip_peric_ctrl
,
708 .devname
= "s3c2440-i2c.2",
709 .parent
= &exynos5_clk_aclk_66
.clk
,
710 .enable
= exynos5_clk_ip_peric_ctrl
,
714 .devname
= "s3c2440-i2c.3",
715 .parent
= &exynos5_clk_aclk_66
.clk
,
716 .enable
= exynos5_clk_ip_peric_ctrl
,
720 .devname
= "s3c2440-i2c.4",
721 .parent
= &exynos5_clk_aclk_66
.clk
,
722 .enable
= exynos5_clk_ip_peric_ctrl
,
723 .ctrlbit
= (1 << 10),
726 .devname
= "s3c2440-i2c.5",
727 .parent
= &exynos5_clk_aclk_66
.clk
,
728 .enable
= exynos5_clk_ip_peric_ctrl
,
729 .ctrlbit
= (1 << 11),
732 .devname
= "s3c2440-i2c.6",
733 .parent
= &exynos5_clk_aclk_66
.clk
,
734 .enable
= exynos5_clk_ip_peric_ctrl
,
735 .ctrlbit
= (1 << 12),
738 .devname
= "s3c2440-i2c.7",
739 .parent
= &exynos5_clk_aclk_66
.clk
,
740 .enable
= exynos5_clk_ip_peric_ctrl
,
741 .ctrlbit
= (1 << 13),
744 .devname
= "s3c2440-hdmiphy-i2c",
745 .parent
= &exynos5_clk_aclk_66
.clk
,
746 .enable
= exynos5_clk_ip_peric_ctrl
,
747 .ctrlbit
= (1 << 14),
750 .devname
= "exynos4210-spi.0",
751 .parent
= &exynos5_clk_aclk_66
.clk
,
752 .enable
= exynos5_clk_ip_peric_ctrl
,
753 .ctrlbit
= (1 << 16),
756 .devname
= "exynos4210-spi.1",
757 .parent
= &exynos5_clk_aclk_66
.clk
,
758 .enable
= exynos5_clk_ip_peric_ctrl
,
759 .ctrlbit
= (1 << 17),
762 .devname
= "exynos4210-spi.2",
763 .parent
= &exynos5_clk_aclk_66
.clk
,
764 .enable
= exynos5_clk_ip_peric_ctrl
,
765 .ctrlbit
= (1 << 18),
767 .name
= SYSMMU_CLOCK_NAME
,
768 .devname
= SYSMMU_CLOCK_DEVNAME(mfc_l
, 0),
769 .enable
= &exynos5_clk_ip_mfc_ctrl
,
772 .name
= SYSMMU_CLOCK_NAME
,
773 .devname
= SYSMMU_CLOCK_DEVNAME(mfc_r
, 1),
774 .enable
= &exynos5_clk_ip_mfc_ctrl
,
777 .name
= SYSMMU_CLOCK_NAME
,
778 .devname
= SYSMMU_CLOCK_DEVNAME(tv
, 2),
779 .enable
= &exynos5_clk_ip_disp1_ctrl
,
782 .name
= SYSMMU_CLOCK_NAME
,
783 .devname
= SYSMMU_CLOCK_DEVNAME(jpeg
, 3),
784 .enable
= &exynos5_clk_ip_gen_ctrl
,
787 .name
= SYSMMU_CLOCK_NAME
,
788 .devname
= SYSMMU_CLOCK_DEVNAME(rot
, 4),
789 .enable
= &exynos5_clk_ip_gen_ctrl
,
792 .name
= SYSMMU_CLOCK_NAME
,
793 .devname
= SYSMMU_CLOCK_DEVNAME(gsc0
, 5),
794 .enable
= &exynos5_clk_ip_gscl_ctrl
,
797 .name
= SYSMMU_CLOCK_NAME
,
798 .devname
= SYSMMU_CLOCK_DEVNAME(gsc1
, 6),
799 .enable
= &exynos5_clk_ip_gscl_ctrl
,
802 .name
= SYSMMU_CLOCK_NAME
,
803 .devname
= SYSMMU_CLOCK_DEVNAME(gsc2
, 7),
804 .enable
= &exynos5_clk_ip_gscl_ctrl
,
807 .name
= SYSMMU_CLOCK_NAME
,
808 .devname
= SYSMMU_CLOCK_DEVNAME(gsc3
, 8),
809 .enable
= &exynos5_clk_ip_gscl_ctrl
,
810 .ctrlbit
= (1 << 10),
812 .name
= SYSMMU_CLOCK_NAME
,
813 .devname
= SYSMMU_CLOCK_DEVNAME(isp
, 9),
814 .enable
= &exynos5_clk_ip_isp0_ctrl
,
815 .ctrlbit
= (0x3F << 8),
817 .name
= SYSMMU_CLOCK_NAME2
,
818 .devname
= SYSMMU_CLOCK_DEVNAME(isp
, 9),
819 .enable
= &exynos5_clk_ip_isp1_ctrl
,
820 .ctrlbit
= (0xF << 4),
822 .name
= SYSMMU_CLOCK_NAME
,
823 .devname
= SYSMMU_CLOCK_DEVNAME(camif0
, 12),
824 .enable
= &exynos5_clk_ip_gscl_ctrl
,
825 .ctrlbit
= (1 << 11),
827 .name
= SYSMMU_CLOCK_NAME
,
828 .devname
= SYSMMU_CLOCK_DEVNAME(camif1
, 13),
829 .enable
= &exynos5_clk_ip_gscl_ctrl
,
830 .ctrlbit
= (1 << 12),
832 .name
= SYSMMU_CLOCK_NAME
,
833 .devname
= SYSMMU_CLOCK_DEVNAME(2d
, 14),
834 .enable
= &exynos5_clk_ip_acp_ctrl
,
839 static struct clk exynos5_init_clocks_on
[] = {
842 .devname
= "s5pv210-uart.0",
843 .enable
= exynos5_clk_ip_peric_ctrl
,
847 .devname
= "s5pv210-uart.1",
848 .enable
= exynos5_clk_ip_peric_ctrl
,
852 .devname
= "s5pv210-uart.2",
853 .enable
= exynos5_clk_ip_peric_ctrl
,
857 .devname
= "s5pv210-uart.3",
858 .enable
= exynos5_clk_ip_peric_ctrl
,
862 .devname
= "s5pv210-uart.4",
863 .enable
= exynos5_clk_ip_peric_ctrl
,
867 .devname
= "s5pv210-uart.5",
868 .enable
= exynos5_clk_ip_peric_ctrl
,
873 static struct clk exynos5_clk_pdma0
= {
875 .devname
= "dma-pl330.0",
876 .enable
= exynos5_clk_ip_fsys_ctrl
,
880 static struct clk exynos5_clk_pdma1
= {
882 .devname
= "dma-pl330.1",
883 .enable
= exynos5_clk_ip_fsys_ctrl
,
887 static struct clk exynos5_clk_mdma1
= {
889 .devname
= "dma-pl330.2",
890 .enable
= exynos5_clk_ip_gen_ctrl
,
894 struct clk
*exynos5_clkset_group_list
[] = {
895 [0] = &clk_ext_xtal_mux
,
897 [2] = &exynos5_clk_sclk_hdmi24m
,
898 [3] = &exynos5_clk_sclk_dptxphy
,
899 [4] = &exynos5_clk_sclk_usbphy
,
900 [5] = &exynos5_clk_sclk_hdmiphy
,
901 [6] = &exynos5_clk_mout_mpll_user
.clk
,
902 [7] = &exynos5_clk_mout_epll
.clk
,
903 [8] = &exynos5_clk_sclk_vpll
.clk
,
904 [9] = &exynos5_clk_mout_cpll
.clk
,
907 struct clksrc_sources exynos5_clkset_group
= {
908 .sources
= exynos5_clkset_group_list
,
909 .nr_sources
= ARRAY_SIZE(exynos5_clkset_group_list
),
912 /* Possible clock sources for aclk_266_gscl_sub Mux */
913 static struct clk
*clk_src_gscl_266_list
[] = {
914 [0] = &clk_ext_xtal_mux
,
915 [1] = &exynos5_clk_aclk_266
.clk
,
918 static struct clksrc_sources clk_src_gscl_266
= {
919 .sources
= clk_src_gscl_266_list
,
920 .nr_sources
= ARRAY_SIZE(clk_src_gscl_266_list
),
923 static struct clksrc_clk exynos5_clk_dout_mmc0
= {
927 .sources
= &exynos5_clkset_group
,
928 .reg_src
= { .reg
= EXYNOS5_CLKSRC_FSYS
, .shift
= 0, .size
= 4 },
929 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS1
, .shift
= 0, .size
= 4 },
932 static struct clksrc_clk exynos5_clk_dout_mmc1
= {
936 .sources
= &exynos5_clkset_group
,
937 .reg_src
= { .reg
= EXYNOS5_CLKSRC_FSYS
, .shift
= 4, .size
= 4 },
938 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS1
, .shift
= 16, .size
= 4 },
941 static struct clksrc_clk exynos5_clk_dout_mmc2
= {
945 .sources
= &exynos5_clkset_group
,
946 .reg_src
= { .reg
= EXYNOS5_CLKSRC_FSYS
, .shift
= 8, .size
= 4 },
947 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS2
, .shift
= 0, .size
= 4 },
950 static struct clksrc_clk exynos5_clk_dout_mmc3
= {
954 .sources
= &exynos5_clkset_group
,
955 .reg_src
= { .reg
= EXYNOS5_CLKSRC_FSYS
, .shift
= 12, .size
= 4 },
956 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS2
, .shift
= 16, .size
= 4 },
959 static struct clksrc_clk exynos5_clk_dout_mmc4
= {
963 .sources
= &exynos5_clkset_group
,
964 .reg_src
= { .reg
= EXYNOS5_CLKSRC_FSYS
, .shift
= 16, .size
= 4 },
965 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS3
, .shift
= 0, .size
= 4 },
968 static struct clksrc_clk exynos5_clk_sclk_uart0
= {
971 .devname
= "exynos4210-uart.0",
972 .enable
= exynos5_clksrc_mask_peric0_ctrl
,
975 .sources
= &exynos5_clkset_group
,
976 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC0
, .shift
= 0, .size
= 4 },
977 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC0
, .shift
= 0, .size
= 4 },
980 static struct clksrc_clk exynos5_clk_sclk_uart1
= {
983 .devname
= "exynos4210-uart.1",
984 .enable
= exynos5_clksrc_mask_peric0_ctrl
,
987 .sources
= &exynos5_clkset_group
,
988 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC0
, .shift
= 4, .size
= 4 },
989 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC0
, .shift
= 4, .size
= 4 },
992 static struct clksrc_clk exynos5_clk_sclk_uart2
= {
995 .devname
= "exynos4210-uart.2",
996 .enable
= exynos5_clksrc_mask_peric0_ctrl
,
999 .sources
= &exynos5_clkset_group
,
1000 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC0
, .shift
= 8, .size
= 4 },
1001 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC0
, .shift
= 8, .size
= 4 },
1004 static struct clksrc_clk exynos5_clk_sclk_uart3
= {
1007 .devname
= "exynos4210-uart.3",
1008 .enable
= exynos5_clksrc_mask_peric0_ctrl
,
1009 .ctrlbit
= (1 << 12),
1011 .sources
= &exynos5_clkset_group
,
1012 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC0
, .shift
= 12, .size
= 4 },
1013 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC0
, .shift
= 12, .size
= 4 },
1016 static struct clksrc_clk exynos5_clk_sclk_mmc0
= {
1019 .devname
= "exynos4-sdhci.0",
1020 .parent
= &exynos5_clk_dout_mmc0
.clk
,
1021 .enable
= exynos5_clksrc_mask_fsys_ctrl
,
1022 .ctrlbit
= (1 << 0),
1024 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS1
, .shift
= 8, .size
= 8 },
1027 static struct clksrc_clk exynos5_clk_sclk_mmc1
= {
1030 .devname
= "exynos4-sdhci.1",
1031 .parent
= &exynos5_clk_dout_mmc1
.clk
,
1032 .enable
= exynos5_clksrc_mask_fsys_ctrl
,
1033 .ctrlbit
= (1 << 4),
1035 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS1
, .shift
= 24, .size
= 8 },
1038 static struct clksrc_clk exynos5_clk_sclk_mmc2
= {
1041 .devname
= "exynos4-sdhci.2",
1042 .parent
= &exynos5_clk_dout_mmc2
.clk
,
1043 .enable
= exynos5_clksrc_mask_fsys_ctrl
,
1044 .ctrlbit
= (1 << 8),
1046 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS2
, .shift
= 8, .size
= 8 },
1049 static struct clksrc_clk exynos5_clk_sclk_mmc3
= {
1052 .devname
= "exynos4-sdhci.3",
1053 .parent
= &exynos5_clk_dout_mmc3
.clk
,
1054 .enable
= exynos5_clksrc_mask_fsys_ctrl
,
1055 .ctrlbit
= (1 << 12),
1057 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS2
, .shift
= 24, .size
= 8 },
1060 static struct clksrc_clk exynos5_clk_mdout_spi0
= {
1062 .name
= "mdout_spi",
1063 .devname
= "exynos4210-spi.0",
1065 .sources
= &exynos5_clkset_group
,
1066 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC1
, .shift
= 16, .size
= 4 },
1067 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC1
, .shift
= 0, .size
= 4 },
1070 static struct clksrc_clk exynos5_clk_mdout_spi1
= {
1072 .name
= "mdout_spi",
1073 .devname
= "exynos4210-spi.1",
1075 .sources
= &exynos5_clkset_group
,
1076 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC1
, .shift
= 20, .size
= 4 },
1077 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC1
, .shift
= 16, .size
= 4 },
1080 static struct clksrc_clk exynos5_clk_mdout_spi2
= {
1082 .name
= "mdout_spi",
1083 .devname
= "exynos4210-spi.2",
1085 .sources
= &exynos5_clkset_group
,
1086 .reg_src
= { .reg
= EXYNOS5_CLKSRC_PERIC1
, .shift
= 24, .size
= 4 },
1087 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC2
, .shift
= 0, .size
= 4 },
1090 static struct clksrc_clk exynos5_clk_sclk_spi0
= {
1093 .devname
= "exynos4210-spi.0",
1094 .parent
= &exynos5_clk_mdout_spi0
.clk
,
1095 .enable
= exynos5_clksrc_mask_peric1_ctrl
,
1096 .ctrlbit
= (1 << 16),
1098 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC1
, .shift
= 8, .size
= 8 },
1101 static struct clksrc_clk exynos5_clk_sclk_spi1
= {
1104 .devname
= "exynos4210-spi.1",
1105 .parent
= &exynos5_clk_mdout_spi1
.clk
,
1106 .enable
= exynos5_clksrc_mask_peric1_ctrl
,
1107 .ctrlbit
= (1 << 20),
1109 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC1
, .shift
= 24, .size
= 8 },
1112 static struct clksrc_clk exynos5_clk_sclk_spi2
= {
1115 .devname
= "exynos4210-spi.2",
1116 .parent
= &exynos5_clk_mdout_spi2
.clk
,
1117 .enable
= exynos5_clksrc_mask_peric1_ctrl
,
1118 .ctrlbit
= (1 << 24),
1120 .reg_div
= { .reg
= EXYNOS5_CLKDIV_PERIC2
, .shift
= 8, .size
= 8 },
1123 static struct clksrc_clk exynos5_clksrcs
[] = {
1126 .name
= "sclk_dwmci",
1127 .parent
= &exynos5_clk_dout_mmc4
.clk
,
1128 .enable
= exynos5_clksrc_mask_fsys_ctrl
,
1129 .ctrlbit
= (1 << 16),
1131 .reg_div
= { .reg
= EXYNOS5_CLKDIV_FSYS3
, .shift
= 8, .size
= 8 },
1134 .name
= "sclk_fimd",
1135 .devname
= "s3cfb.1",
1136 .enable
= exynos5_clksrc_mask_disp1_0_ctrl
,
1137 .ctrlbit
= (1 << 0),
1139 .sources
= &exynos5_clkset_group
,
1140 .reg_src
= { .reg
= EXYNOS5_CLKSRC_DISP1_0
, .shift
= 0, .size
= 4 },
1141 .reg_div
= { .reg
= EXYNOS5_CLKDIV_DISP1_0
, .shift
= 0, .size
= 4 },
1144 .name
= "aclk_266_gscl",
1146 .sources
= &clk_src_gscl_266
,
1147 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP3
, .shift
= 8, .size
= 1 },
1151 .devname
= "mali-t604.0",
1152 .enable
= exynos5_clk_block_ctrl
,
1153 .ctrlbit
= (1 << 1),
1155 .sources
= &exynos5_clkset_aclk
,
1156 .reg_src
= { .reg
= EXYNOS5_CLKSRC_TOP0
, .shift
= 20, .size
= 1 },
1157 .reg_div
= { .reg
= EXYNOS5_CLKDIV_TOP0
, .shift
= 24, .size
= 3 },
1160 .name
= "sclk_gscl_wrap",
1161 .devname
= "s5p-mipi-csis.0",
1162 .enable
= exynos5_clksrc_mask_gscl_ctrl
,
1163 .ctrlbit
= (1 << 24),
1165 .sources
= &exynos5_clkset_group
,
1166 .reg_src
= { .reg
= EXYNOS5_CLKSRC_GSCL
, .shift
= 24, .size
= 4 },
1167 .reg_div
= { .reg
= EXYNOS5_CLKDIV_GSCL
, .shift
= 24, .size
= 4 },
1170 .name
= "sclk_gscl_wrap",
1171 .devname
= "s5p-mipi-csis.1",
1172 .enable
= exynos5_clksrc_mask_gscl_ctrl
,
1173 .ctrlbit
= (1 << 28),
1175 .sources
= &exynos5_clkset_group
,
1176 .reg_src
= { .reg
= EXYNOS5_CLKSRC_GSCL
, .shift
= 28, .size
= 4 },
1177 .reg_div
= { .reg
= EXYNOS5_CLKDIV_GSCL
, .shift
= 28, .size
= 4 },
1180 .name
= "sclk_cam0",
1181 .enable
= exynos5_clksrc_mask_gscl_ctrl
,
1182 .ctrlbit
= (1 << 16),
1184 .sources
= &exynos5_clkset_group
,
1185 .reg_src
= { .reg
= EXYNOS5_CLKSRC_GSCL
, .shift
= 16, .size
= 4 },
1186 .reg_div
= { .reg
= EXYNOS5_CLKDIV_GSCL
, .shift
= 16, .size
= 4 },
1189 .name
= "sclk_cam1",
1190 .enable
= exynos5_clksrc_mask_gscl_ctrl
,
1191 .ctrlbit
= (1 << 20),
1193 .sources
= &exynos5_clkset_group
,
1194 .reg_src
= { .reg
= EXYNOS5_CLKSRC_GSCL
, .shift
= 20, .size
= 4 },
1195 .reg_div
= { .reg
= EXYNOS5_CLKDIV_GSCL
, .shift
= 20, .size
= 4 },
1198 .name
= "sclk_jpeg",
1199 .parent
= &exynos5_clk_mout_cpll
.clk
,
1201 .reg_div
= { .reg
= EXYNOS5_CLKDIV_GEN
, .shift
= 4, .size
= 3 },
1205 /* Clock initialization code */
1206 static struct clksrc_clk
*exynos5_sysclks
[] = {
1207 &exynos5_clk_mout_apll
,
1208 &exynos5_clk_sclk_apll
,
1209 &exynos5_clk_mout_bpll
,
1210 &exynos5_clk_mout_bpll_fout
,
1211 &exynos5_clk_mout_bpll_user
,
1212 &exynos5_clk_mout_cpll
,
1213 &exynos5_clk_mout_epll
,
1214 &exynos5_clk_mout_mpll
,
1215 &exynos5_clk_mout_mpll_fout
,
1216 &exynos5_clk_mout_mpll_user
,
1217 &exynos5_clk_vpllsrc
,
1218 &exynos5_clk_sclk_vpll
,
1219 &exynos5_clk_mout_cpu
,
1220 &exynos5_clk_dout_armclk
,
1221 &exynos5_clk_dout_arm2clk
,
1223 &exynos5_clk_aclk_400
,
1224 &exynos5_clk_aclk_333
,
1225 &exynos5_clk_aclk_266
,
1226 &exynos5_clk_aclk_200
,
1227 &exynos5_clk_aclk_166
,
1228 &exynos5_clk_aclk_66_pre
,
1229 &exynos5_clk_aclk_66
,
1230 &exynos5_clk_dout_mmc0
,
1231 &exynos5_clk_dout_mmc1
,
1232 &exynos5_clk_dout_mmc2
,
1233 &exynos5_clk_dout_mmc3
,
1234 &exynos5_clk_dout_mmc4
,
1235 &exynos5_clk_aclk_acp
,
1236 &exynos5_clk_pclk_acp
,
1237 &exynos5_clk_sclk_spi0
,
1238 &exynos5_clk_sclk_spi1
,
1239 &exynos5_clk_sclk_spi2
,
1240 &exynos5_clk_mdout_spi0
,
1241 &exynos5_clk_mdout_spi1
,
1242 &exynos5_clk_mdout_spi2
,
1245 static struct clk
*exynos5_clk_cdev
[] = {
1251 static struct clksrc_clk
*exynos5_clksrc_cdev
[] = {
1252 &exynos5_clk_sclk_uart0
,
1253 &exynos5_clk_sclk_uart1
,
1254 &exynos5_clk_sclk_uart2
,
1255 &exynos5_clk_sclk_uart3
,
1256 &exynos5_clk_sclk_mmc0
,
1257 &exynos5_clk_sclk_mmc1
,
1258 &exynos5_clk_sclk_mmc2
,
1259 &exynos5_clk_sclk_mmc3
,
1262 static struct clk_lookup exynos5_clk_lookup
[] = {
1263 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos5_clk_sclk_uart0
.clk
),
1264 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1
.clk
),
1265 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2
.clk
),
1266 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3
.clk
),
1267 CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0
.clk
),
1268 CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1
.clk
),
1269 CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2
.clk
),
1270 CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3
.clk
),
1271 CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos5_clk_sclk_spi0
.clk
),
1272 CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos5_clk_sclk_spi1
.clk
),
1273 CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos5_clk_sclk_spi2
.clk
),
1274 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0
),
1275 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1
),
1276 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1
),
1279 static unsigned long exynos5_epll_get_rate(struct clk
*clk
)
1284 static struct clk
*exynos5_clks
[] __initdata
= {
1285 &exynos5_clk_sclk_hdmi27m
,
1286 &exynos5_clk_sclk_hdmiphy
,
1288 &clk_fout_bpll_div2
,
1290 &clk_fout_mpll_div2
,
1291 &exynos5_clk_armclk
,
1294 static u32 epll_div
[][6] = {
1295 { 192000000, 0, 48, 3, 1, 0 },
1296 { 180000000, 0, 45, 3, 1, 0 },
1297 { 73728000, 1, 73, 3, 3, 47710 },
1298 { 67737600, 1, 90, 4, 3, 20762 },
1299 { 49152000, 0, 49, 3, 3, 9961 },
1300 { 45158400, 0, 45, 3, 3, 10381 },
1301 { 180633600, 0, 45, 3, 1, 10381 },
1304 static int exynos5_epll_set_rate(struct clk
*clk
, unsigned long rate
)
1306 unsigned int epll_con
, epll_con_k
;
1309 unsigned int epll_rate
;
1310 unsigned int locktime
;
1311 unsigned int lockcnt
;
1313 /* Return if nothing changed */
1314 if (clk
->rate
== rate
)
1318 epll_rate
= clk_get_rate(clk
->parent
);
1320 epll_rate
= clk_ext_xtal_mux
.rate
;
1322 if (epll_rate
!= 24000000) {
1323 pr_err("Invalid Clock : recommended clock is 24MHz.\n");
1327 epll_con
= __raw_readl(EXYNOS5_EPLL_CON0
);
1328 epll_con
&= ~(0x1 << 27 | \
1329 PLL46XX_MDIV_MASK
<< PLL46XX_MDIV_SHIFT
| \
1330 PLL46XX_PDIV_MASK
<< PLL46XX_PDIV_SHIFT
| \
1331 PLL46XX_SDIV_MASK
<< PLL46XX_SDIV_SHIFT
);
1333 for (i
= 0; i
< ARRAY_SIZE(epll_div
); i
++) {
1334 if (epll_div
[i
][0] == rate
) {
1335 epll_con_k
= epll_div
[i
][5] << 0;
1336 epll_con
|= epll_div
[i
][1] << 27;
1337 epll_con
|= epll_div
[i
][2] << PLL46XX_MDIV_SHIFT
;
1338 epll_con
|= epll_div
[i
][3] << PLL46XX_PDIV_SHIFT
;
1339 epll_con
|= epll_div
[i
][4] << PLL46XX_SDIV_SHIFT
;
1344 if (i
== ARRAY_SIZE(epll_div
)) {
1345 printk(KERN_ERR
"%s: Invalid Clock EPLL Frequency\n",
1350 epll_rate
/= 1000000;
1352 /* 3000 max_cycls : specification data */
1353 locktime
= 3000 / epll_rate
* epll_div
[i
][3];
1354 lockcnt
= locktime
* 10000 / (10000 / epll_rate
);
1356 __raw_writel(lockcnt
, EXYNOS5_EPLL_LOCK
);
1358 __raw_writel(epll_con
, EXYNOS5_EPLL_CON0
);
1359 __raw_writel(epll_con_k
, EXYNOS5_EPLL_CON1
);
1362 tmp
= __raw_readl(EXYNOS5_EPLL_CON0
);
1363 } while (!(tmp
& 0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT
));
1370 static struct clk_ops exynos5_epll_ops
= {
1371 .get_rate
= exynos5_epll_get_rate
,
1372 .set_rate
= exynos5_epll_set_rate
,
1375 static int xtal_rate
;
1377 static unsigned long exynos5_fout_apll_get_rate(struct clk
*clk
)
1379 return s5p_get_pll35xx(xtal_rate
, __raw_readl(EXYNOS5_APLL_CON0
));
1382 static struct clk_ops exynos5_fout_apll_ops
= {
1383 .get_rate
= exynos5_fout_apll_get_rate
,
1387 static int exynos5_clock_suspend(void)
1389 s3c_pm_do_save(exynos5_clock_save
, ARRAY_SIZE(exynos5_clock_save
));
1394 static void exynos5_clock_resume(void)
1396 s3c_pm_do_restore_core(exynos5_clock_save
, ARRAY_SIZE(exynos5_clock_save
));
1399 #define exynos5_clock_suspend NULL
1400 #define exynos5_clock_resume NULL
1403 struct syscore_ops exynos5_clock_syscore_ops
= {
1404 .suspend
= exynos5_clock_suspend
,
1405 .resume
= exynos5_clock_resume
,
1408 void __init_or_cpufreq
exynos5_setup_clocks(void)
1410 struct clk
*xtal_clk
;
1417 unsigned long vpllsrc
;
1419 unsigned long armclk
;
1420 unsigned long mout_cdrex
;
1421 unsigned long aclk_400
;
1422 unsigned long aclk_333
;
1423 unsigned long aclk_266
;
1424 unsigned long aclk_200
;
1425 unsigned long aclk_166
;
1426 unsigned long aclk_66
;
1429 printk(KERN_DEBUG
"%s: registering clocks\n", __func__
);
1431 xtal_clk
= clk_get(NULL
, "xtal");
1432 BUG_ON(IS_ERR(xtal_clk
));
1434 xtal
= clk_get_rate(xtal_clk
);
1440 printk(KERN_DEBUG
"%s: xtal is %ld\n", __func__
, xtal
);
1442 apll
= s5p_get_pll35xx(xtal
, __raw_readl(EXYNOS5_APLL_CON0
));
1443 bpll
= s5p_get_pll35xx(xtal
, __raw_readl(EXYNOS5_BPLL_CON0
));
1444 cpll
= s5p_get_pll35xx(xtal
, __raw_readl(EXYNOS5_CPLL_CON0
));
1445 mpll
= s5p_get_pll35xx(xtal
, __raw_readl(EXYNOS5_MPLL_CON0
));
1446 epll
= s5p_get_pll36xx(xtal
, __raw_readl(EXYNOS5_EPLL_CON0
),
1447 __raw_readl(EXYNOS5_EPLL_CON1
));
1449 vpllsrc
= clk_get_rate(&exynos5_clk_vpllsrc
.clk
);
1450 vpll
= s5p_get_pll36xx(vpllsrc
, __raw_readl(EXYNOS5_VPLL_CON0
),
1451 __raw_readl(EXYNOS5_VPLL_CON1
));
1453 clk_fout_apll
.ops
= &exynos5_fout_apll_ops
;
1454 clk_fout_bpll
.rate
= bpll
;
1455 clk_fout_bpll_div2
.rate
= bpll
>> 1;
1456 clk_fout_cpll
.rate
= cpll
;
1457 clk_fout_mpll
.rate
= mpll
;
1458 clk_fout_mpll_div2
.rate
= mpll
>> 1;
1459 clk_fout_epll
.rate
= epll
;
1460 clk_fout_vpll
.rate
= vpll
;
1462 printk(KERN_INFO
"EXYNOS5: PLL settings, A=%ld, B=%ld, C=%ld\n"
1463 "M=%ld, E=%ld V=%ld",
1464 apll
, bpll
, cpll
, mpll
, epll
, vpll
);
1466 armclk
= clk_get_rate(&exynos5_clk_armclk
);
1467 mout_cdrex
= clk_get_rate(&exynos5_clk_cdrex
.clk
);
1469 aclk_400
= clk_get_rate(&exynos5_clk_aclk_400
.clk
);
1470 aclk_333
= clk_get_rate(&exynos5_clk_aclk_333
.clk
);
1471 aclk_266
= clk_get_rate(&exynos5_clk_aclk_266
.clk
);
1472 aclk_200
= clk_get_rate(&exynos5_clk_aclk_200
.clk
);
1473 aclk_166
= clk_get_rate(&exynos5_clk_aclk_166
.clk
);
1474 aclk_66
= clk_get_rate(&exynos5_clk_aclk_66
.clk
);
1476 printk(KERN_INFO
"EXYNOS5: ARMCLK=%ld, CDREX=%ld, ACLK400=%ld\n"
1477 "ACLK333=%ld, ACLK266=%ld, ACLK200=%ld\n"
1478 "ACLK166=%ld, ACLK66=%ld\n",
1479 armclk
, mout_cdrex
, aclk_400
,
1480 aclk_333
, aclk_266
, aclk_200
,
1484 clk_fout_epll
.ops
= &exynos5_epll_ops
;
1486 if (clk_set_parent(&exynos5_clk_mout_epll
.clk
, &clk_fout_epll
))
1487 printk(KERN_ERR
"Unable to set parent %s of clock %s.\n",
1488 clk_fout_epll
.name
, exynos5_clk_mout_epll
.clk
.name
);
1490 clk_set_rate(&exynos5_clk_sclk_apll
.clk
, 100000000);
1491 clk_set_rate(&exynos5_clk_aclk_266
.clk
, 300000000);
1493 clk_set_rate(&exynos5_clk_aclk_acp
.clk
, 267000000);
1494 clk_set_rate(&exynos5_clk_pclk_acp
.clk
, 134000000);
1496 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos5_clksrcs
); ptr
++)
1497 s3c_set_clksrc(&exynos5_clksrcs
[ptr
], true);
1500 void __init
exynos5_register_clocks(void)
1504 s3c24xx_register_clocks(exynos5_clks
, ARRAY_SIZE(exynos5_clks
));
1506 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos5_sysclks
); ptr
++)
1507 s3c_register_clksrc(exynos5_sysclks
[ptr
], 1);
1509 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos5_sclk_tv
); ptr
++)
1510 s3c_register_clksrc(exynos5_sclk_tv
[ptr
], 1);
1512 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos5_clksrc_cdev
); ptr
++)
1513 s3c_register_clksrc(exynos5_clksrc_cdev
[ptr
], 1);
1515 s3c_register_clksrc(exynos5_clksrcs
, ARRAY_SIZE(exynos5_clksrcs
));
1516 s3c_register_clocks(exynos5_init_clocks_on
, ARRAY_SIZE(exynos5_init_clocks_on
));
1518 s3c24xx_register_clocks(exynos5_clk_cdev
, ARRAY_SIZE(exynos5_clk_cdev
));
1519 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos5_clk_cdev
); ptr
++)
1520 s3c_disable_clocks(exynos5_clk_cdev
[ptr
], 1);
1522 s3c_register_clocks(exynos5_init_clocks_off
, ARRAY_SIZE(exynos5_init_clocks_off
));
1523 s3c_disable_clocks(exynos5_init_clocks_off
, ARRAY_SIZE(exynos5_init_clocks_off
));
1524 clkdev_add_table(exynos5_clk_lookup
, ARRAY_SIZE(exynos5_clk_lookup
));
1526 register_syscore_ops(&exynos5_clock_syscore_ops
);