2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
5 * EXYNOS4 - Clock support
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>
30 #include "clock-exynos4.h"
32 #ifdef CONFIG_PM_SLEEP
33 static struct sleep_save exynos4_clock_save
[] = {
34 SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS
),
35 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS
),
36 SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS
),
37 SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS
),
38 SAVE_ITEM(EXYNOS4_CLKSRC_TOP0
),
39 SAVE_ITEM(EXYNOS4_CLKSRC_TOP1
),
40 SAVE_ITEM(EXYNOS4_CLKSRC_CAM
),
41 SAVE_ITEM(EXYNOS4_CLKSRC_TV
),
42 SAVE_ITEM(EXYNOS4_CLKSRC_MFC
),
43 SAVE_ITEM(EXYNOS4_CLKSRC_G3D
),
44 SAVE_ITEM(EXYNOS4_CLKSRC_LCD0
),
45 SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO
),
46 SAVE_ITEM(EXYNOS4_CLKSRC_FSYS
),
47 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0
),
48 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1
),
49 SAVE_ITEM(EXYNOS4_CLKDIV_CAM
),
50 SAVE_ITEM(EXYNOS4_CLKDIV_TV
),
51 SAVE_ITEM(EXYNOS4_CLKDIV_MFC
),
52 SAVE_ITEM(EXYNOS4_CLKDIV_G3D
),
53 SAVE_ITEM(EXYNOS4_CLKDIV_LCD0
),
54 SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO
),
55 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0
),
56 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1
),
57 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2
),
58 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3
),
59 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0
),
60 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1
),
61 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2
),
62 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3
),
63 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4
),
64 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5
),
65 SAVE_ITEM(EXYNOS4_CLKDIV_TOP
),
66 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP
),
67 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM
),
68 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV
),
69 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0
),
70 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO
),
71 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS
),
72 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0
),
73 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1
),
74 SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO
),
75 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM
),
76 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM
),
77 SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV
),
78 SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC
),
79 SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D
),
80 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0
),
81 SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS
),
82 SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS
),
83 SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL
),
84 SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK
),
85 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC
),
86 SAVE_ITEM(EXYNOS4_CLKSRC_DMC
),
87 SAVE_ITEM(EXYNOS4_CLKDIV_DMC0
),
88 SAVE_ITEM(EXYNOS4_CLKDIV_DMC1
),
89 SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC
),
90 SAVE_ITEM(EXYNOS4_CLKSRC_CPU
),
91 SAVE_ITEM(EXYNOS4_CLKDIV_CPU
),
92 SAVE_ITEM(EXYNOS4_CLKDIV_CPU
+ 0x4),
93 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU
),
94 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU
),
98 static struct clk exynos4_clk_sclk_hdmi27m
= {
99 .name
= "sclk_hdmi27m",
103 static struct clk exynos4_clk_sclk_hdmiphy
= {
104 .name
= "sclk_hdmiphy",
107 static struct clk exynos4_clk_sclk_usbphy0
= {
108 .name
= "sclk_usbphy0",
112 static struct clk exynos4_clk_sclk_usbphy1
= {
113 .name
= "sclk_usbphy1",
116 static struct clk dummy_apb_pclk
= {
121 static int exynos4_clksrc_mask_top_ctrl(struct clk
*clk
, int enable
)
123 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP
, clk
, enable
);
126 static int exynos4_clksrc_mask_cam_ctrl(struct clk
*clk
, int enable
)
128 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM
, clk
, enable
);
131 static int exynos4_clksrc_mask_lcd0_ctrl(struct clk
*clk
, int enable
)
133 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0
, clk
, enable
);
136 int exynos4_clksrc_mask_fsys_ctrl(struct clk
*clk
, int enable
)
138 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS
, clk
, enable
);
141 static int exynos4_clksrc_mask_peril0_ctrl(struct clk
*clk
, int enable
)
143 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0
, clk
, enable
);
146 static int exynos4_clksrc_mask_peril1_ctrl(struct clk
*clk
, int enable
)
148 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1
, clk
, enable
);
151 static int exynos4_clk_ip_mfc_ctrl(struct clk
*clk
, int enable
)
153 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC
, clk
, enable
);
156 static int exynos4_clksrc_mask_tv_ctrl(struct clk
*clk
, int enable
)
158 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV
, clk
, enable
);
161 static int exynos4_clk_ip_cam_ctrl(struct clk
*clk
, int enable
)
163 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM
, clk
, enable
);
166 static int exynos4_clk_ip_tv_ctrl(struct clk
*clk
, int enable
)
168 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV
, clk
, enable
);
171 int exynos4_clk_ip_image_ctrl(struct clk
*clk
, int enable
)
173 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE
, clk
, enable
);
176 static int exynos4_clk_ip_lcd0_ctrl(struct clk
*clk
, int enable
)
178 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0
, clk
, enable
);
181 int exynos4_clk_ip_lcd1_ctrl(struct clk
*clk
, int enable
)
183 return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1
, clk
, enable
);
186 int exynos4_clk_ip_fsys_ctrl(struct clk
*clk
, int enable
)
188 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS
, clk
, enable
);
191 static int exynos4_clk_ip_peril_ctrl(struct clk
*clk
, int enable
)
193 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL
, clk
, enable
);
196 static int exynos4_clk_ip_perir_ctrl(struct clk
*clk
, int enable
)
198 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR
, clk
, enable
);
201 int exynos4_clk_ip_dmc_ctrl(struct clk
*clk
, int enable
)
203 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_DMC
, clk
, enable
);
206 static int exynos4_clk_hdmiphy_ctrl(struct clk
*clk
, int enable
)
208 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL
, clk
, enable
);
211 static int exynos4_clk_dac_ctrl(struct clk
*clk
, int enable
)
213 return s5p_gatectrl(S5P_DAC_PHY_CONTROL
, clk
, enable
);
216 /* Core list of CMU_CPU side */
218 static struct clksrc_clk exynos4_clk_mout_apll
= {
222 .sources
= &clk_src_apll
,
223 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CPU
, .shift
= 0, .size
= 1 },
226 static struct clksrc_clk exynos4_clk_sclk_apll
= {
229 .parent
= &exynos4_clk_mout_apll
.clk
,
231 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CPU
, .shift
= 24, .size
= 3 },
234 static struct clksrc_clk exynos4_clk_mout_epll
= {
238 .sources
= &clk_src_epll
,
239 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP0
, .shift
= 4, .size
= 1 },
242 struct clksrc_clk exynos4_clk_mout_mpll
= {
246 .sources
= &clk_src_mpll
,
248 /* reg_src will be added in each SoCs' clock */
251 static struct clk
*exynos4_clkset_moutcore_list
[] = {
252 [0] = &exynos4_clk_mout_apll
.clk
,
253 [1] = &exynos4_clk_mout_mpll
.clk
,
256 static struct clksrc_sources exynos4_clkset_moutcore
= {
257 .sources
= exynos4_clkset_moutcore_list
,
258 .nr_sources
= ARRAY_SIZE(exynos4_clkset_moutcore_list
),
261 static struct clksrc_clk exynos4_clk_moutcore
= {
265 .sources
= &exynos4_clkset_moutcore
,
266 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CPU
, .shift
= 16, .size
= 1 },
269 static struct clksrc_clk exynos4_clk_coreclk
= {
272 .parent
= &exynos4_clk_moutcore
.clk
,
274 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CPU
, .shift
= 0, .size
= 3 },
277 static struct clksrc_clk exynos4_clk_armclk
= {
280 .parent
= &exynos4_clk_coreclk
.clk
,
284 static struct clksrc_clk exynos4_clk_aclk_corem0
= {
286 .name
= "aclk_corem0",
287 .parent
= &exynos4_clk_coreclk
.clk
,
289 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CPU
, .shift
= 4, .size
= 3 },
292 static struct clksrc_clk exynos4_clk_aclk_cores
= {
294 .name
= "aclk_cores",
295 .parent
= &exynos4_clk_coreclk
.clk
,
297 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CPU
, .shift
= 4, .size
= 3 },
300 static struct clksrc_clk exynos4_clk_aclk_corem1
= {
302 .name
= "aclk_corem1",
303 .parent
= &exynos4_clk_coreclk
.clk
,
305 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CPU
, .shift
= 8, .size
= 3 },
308 static struct clksrc_clk exynos4_clk_periphclk
= {
311 .parent
= &exynos4_clk_coreclk
.clk
,
313 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CPU
, .shift
= 12, .size
= 3 },
316 /* Core list of CMU_CORE side */
318 static struct clk
*exynos4_clkset_corebus_list
[] = {
319 [0] = &exynos4_clk_mout_mpll
.clk
,
320 [1] = &exynos4_clk_sclk_apll
.clk
,
323 struct clksrc_sources exynos4_clkset_mout_corebus
= {
324 .sources
= exynos4_clkset_corebus_list
,
325 .nr_sources
= ARRAY_SIZE(exynos4_clkset_corebus_list
),
328 static struct clksrc_clk exynos4_clk_mout_corebus
= {
330 .name
= "mout_corebus",
332 .sources
= &exynos4_clkset_mout_corebus
,
333 .reg_src
= { .reg
= EXYNOS4_CLKSRC_DMC
, .shift
= 4, .size
= 1 },
336 static struct clksrc_clk exynos4_clk_sclk_dmc
= {
339 .parent
= &exynos4_clk_mout_corebus
.clk
,
341 .reg_div
= { .reg
= EXYNOS4_CLKDIV_DMC0
, .shift
= 12, .size
= 3 },
344 static struct clksrc_clk exynos4_clk_aclk_cored
= {
346 .name
= "aclk_cored",
347 .parent
= &exynos4_clk_sclk_dmc
.clk
,
349 .reg_div
= { .reg
= EXYNOS4_CLKDIV_DMC0
, .shift
= 16, .size
= 3 },
352 static struct clksrc_clk exynos4_clk_aclk_corep
= {
354 .name
= "aclk_corep",
355 .parent
= &exynos4_clk_aclk_cored
.clk
,
357 .reg_div
= { .reg
= EXYNOS4_CLKDIV_DMC0
, .shift
= 20, .size
= 3 },
360 static struct clksrc_clk exynos4_clk_aclk_acp
= {
363 .parent
= &exynos4_clk_mout_corebus
.clk
,
365 .reg_div
= { .reg
= EXYNOS4_CLKDIV_DMC0
, .shift
= 0, .size
= 3 },
368 static struct clksrc_clk exynos4_clk_pclk_acp
= {
371 .parent
= &exynos4_clk_aclk_acp
.clk
,
373 .reg_div
= { .reg
= EXYNOS4_CLKDIV_DMC0
, .shift
= 4, .size
= 3 },
376 /* Core list of CMU_TOP side */
378 struct clk
*exynos4_clkset_aclk_top_list
[] = {
379 [0] = &exynos4_clk_mout_mpll
.clk
,
380 [1] = &exynos4_clk_sclk_apll
.clk
,
383 static struct clksrc_sources exynos4_clkset_aclk
= {
384 .sources
= exynos4_clkset_aclk_top_list
,
385 .nr_sources
= ARRAY_SIZE(exynos4_clkset_aclk_top_list
),
388 static struct clksrc_clk exynos4_clk_aclk_200
= {
392 .sources
= &exynos4_clkset_aclk
,
393 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP0
, .shift
= 12, .size
= 1 },
394 .reg_div
= { .reg
= EXYNOS4_CLKDIV_TOP
, .shift
= 0, .size
= 3 },
397 static struct clksrc_clk exynos4_clk_aclk_100
= {
401 .sources
= &exynos4_clkset_aclk
,
402 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP0
, .shift
= 16, .size
= 1 },
403 .reg_div
= { .reg
= EXYNOS4_CLKDIV_TOP
, .shift
= 4, .size
= 4 },
406 static struct clksrc_clk exynos4_clk_aclk_160
= {
410 .sources
= &exynos4_clkset_aclk
,
411 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP0
, .shift
= 20, .size
= 1 },
412 .reg_div
= { .reg
= EXYNOS4_CLKDIV_TOP
, .shift
= 8, .size
= 3 },
415 struct clksrc_clk exynos4_clk_aclk_133
= {
419 .sources
= &exynos4_clkset_aclk
,
420 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP0
, .shift
= 24, .size
= 1 },
421 .reg_div
= { .reg
= EXYNOS4_CLKDIV_TOP
, .shift
= 12, .size
= 3 },
424 static struct clk
*exynos4_clkset_vpllsrc_list
[] = {
426 [1] = &exynos4_clk_sclk_hdmi27m
,
429 static struct clksrc_sources exynos4_clkset_vpllsrc
= {
430 .sources
= exynos4_clkset_vpllsrc_list
,
431 .nr_sources
= ARRAY_SIZE(exynos4_clkset_vpllsrc_list
),
434 static struct clksrc_clk exynos4_clk_vpllsrc
= {
437 .enable
= exynos4_clksrc_mask_top_ctrl
,
440 .sources
= &exynos4_clkset_vpllsrc
,
441 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP1
, .shift
= 0, .size
= 1 },
444 static struct clk
*exynos4_clkset_sclk_vpll_list
[] = {
445 [0] = &exynos4_clk_vpllsrc
.clk
,
446 [1] = &clk_fout_vpll
,
449 static struct clksrc_sources exynos4_clkset_sclk_vpll
= {
450 .sources
= exynos4_clkset_sclk_vpll_list
,
451 .nr_sources
= ARRAY_SIZE(exynos4_clkset_sclk_vpll_list
),
454 static struct clksrc_clk exynos4_clk_sclk_vpll
= {
458 .sources
= &exynos4_clkset_sclk_vpll
,
459 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TOP0
, .shift
= 8, .size
= 1 },
462 static struct clk exynos4_init_clocks_off
[] = {
465 .parent
= &exynos4_clk_aclk_100
.clk
,
466 .enable
= exynos4_clk_ip_peril_ctrl
,
470 .devname
= "s5p-mipi-csis.0",
471 .enable
= exynos4_clk_ip_cam_ctrl
,
475 .devname
= "s5p-mipi-csis.1",
476 .enable
= exynos4_clk_ip_cam_ctrl
,
481 .enable
= exynos4_clk_ip_cam_ctrl
,
485 .devname
= "exynos4-fimc.0",
486 .enable
= exynos4_clk_ip_cam_ctrl
,
490 .devname
= "exynos4-fimc.1",
491 .enable
= exynos4_clk_ip_cam_ctrl
,
495 .devname
= "exynos4-fimc.2",
496 .enable
= exynos4_clk_ip_cam_ctrl
,
500 .devname
= "exynos4-fimc.3",
501 .enable
= exynos4_clk_ip_cam_ctrl
,
505 .devname
= "exynos4-sdhci.0",
506 .parent
= &exynos4_clk_aclk_133
.clk
,
507 .enable
= exynos4_clk_ip_fsys_ctrl
,
511 .devname
= "exynos4-sdhci.1",
512 .parent
= &exynos4_clk_aclk_133
.clk
,
513 .enable
= exynos4_clk_ip_fsys_ctrl
,
517 .devname
= "exynos4-sdhci.2",
518 .parent
= &exynos4_clk_aclk_133
.clk
,
519 .enable
= exynos4_clk_ip_fsys_ctrl
,
523 .devname
= "exynos4-sdhci.3",
524 .parent
= &exynos4_clk_aclk_133
.clk
,
525 .enable
= exynos4_clk_ip_fsys_ctrl
,
529 .parent
= &exynos4_clk_aclk_133
.clk
,
530 .enable
= exynos4_clk_ip_fsys_ctrl
,
534 .devname
= "s5p-sdo",
535 .enable
= exynos4_clk_ip_tv_ctrl
,
539 .devname
= "s5p-mixer",
540 .enable
= exynos4_clk_ip_tv_ctrl
,
544 .devname
= "s5p-mixer",
545 .enable
= exynos4_clk_ip_tv_ctrl
,
549 .devname
= "exynos4-hdmi",
550 .enable
= exynos4_clk_ip_tv_ctrl
,
554 .devname
= "exynos4-hdmi",
555 .enable
= exynos4_clk_hdmiphy_ctrl
,
559 .devname
= "s5p-sdo",
560 .enable
= exynos4_clk_dac_ctrl
,
564 .enable
= exynos4_clk_ip_peril_ctrl
,
565 .ctrlbit
= (1 << 15),
568 .enable
= exynos4_clk_ip_perir_ctrl
,
569 .ctrlbit
= (1 << 16),
572 .enable
= exynos4_clk_ip_perir_ctrl
,
573 .ctrlbit
= (1 << 15),
576 .parent
= &exynos4_clk_aclk_100
.clk
,
577 .enable
= exynos4_clk_ip_perir_ctrl
,
578 .ctrlbit
= (1 << 14),
581 .enable
= exynos4_clk_ip_fsys_ctrl
,
582 .ctrlbit
= (1 << 12),
585 .enable
= exynos4_clk_ip_fsys_ctrl
,
586 .ctrlbit
= (1 << 13),
589 .devname
= "exynos4210-spi.0",
590 .enable
= exynos4_clk_ip_peril_ctrl
,
591 .ctrlbit
= (1 << 16),
594 .devname
= "exynos4210-spi.1",
595 .enable
= exynos4_clk_ip_peril_ctrl
,
596 .ctrlbit
= (1 << 17),
599 .devname
= "exynos4210-spi.2",
600 .enable
= exynos4_clk_ip_peril_ctrl
,
601 .ctrlbit
= (1 << 18),
604 .devname
= "samsung-i2s.0",
605 .enable
= exynos4_clk_ip_peril_ctrl
,
606 .ctrlbit
= (1 << 19),
609 .devname
= "samsung-i2s.1",
610 .enable
= exynos4_clk_ip_peril_ctrl
,
611 .ctrlbit
= (1 << 20),
614 .devname
= "samsung-i2s.2",
615 .enable
= exynos4_clk_ip_peril_ctrl
,
616 .ctrlbit
= (1 << 21),
619 .devname
= "samsung-ac97",
620 .enable
= exynos4_clk_ip_peril_ctrl
,
621 .ctrlbit
= (1 << 27),
624 .devname
= "s5p-mfc",
625 .enable
= exynos4_clk_ip_mfc_ctrl
,
629 .devname
= "s3c2440-i2c.0",
630 .parent
= &exynos4_clk_aclk_100
.clk
,
631 .enable
= exynos4_clk_ip_peril_ctrl
,
635 .devname
= "s3c2440-i2c.1",
636 .parent
= &exynos4_clk_aclk_100
.clk
,
637 .enable
= exynos4_clk_ip_peril_ctrl
,
641 .devname
= "s3c2440-i2c.2",
642 .parent
= &exynos4_clk_aclk_100
.clk
,
643 .enable
= exynos4_clk_ip_peril_ctrl
,
647 .devname
= "s3c2440-i2c.3",
648 .parent
= &exynos4_clk_aclk_100
.clk
,
649 .enable
= exynos4_clk_ip_peril_ctrl
,
653 .devname
= "s3c2440-i2c.4",
654 .parent
= &exynos4_clk_aclk_100
.clk
,
655 .enable
= exynos4_clk_ip_peril_ctrl
,
656 .ctrlbit
= (1 << 10),
659 .devname
= "s3c2440-i2c.5",
660 .parent
= &exynos4_clk_aclk_100
.clk
,
661 .enable
= exynos4_clk_ip_peril_ctrl
,
662 .ctrlbit
= (1 << 11),
665 .devname
= "s3c2440-i2c.6",
666 .parent
= &exynos4_clk_aclk_100
.clk
,
667 .enable
= exynos4_clk_ip_peril_ctrl
,
668 .ctrlbit
= (1 << 12),
671 .devname
= "s3c2440-i2c.7",
672 .parent
= &exynos4_clk_aclk_100
.clk
,
673 .enable
= exynos4_clk_ip_peril_ctrl
,
674 .ctrlbit
= (1 << 13),
677 .devname
= "s3c2440-hdmiphy-i2c",
678 .parent
= &exynos4_clk_aclk_100
.clk
,
679 .enable
= exynos4_clk_ip_peril_ctrl
,
680 .ctrlbit
= (1 << 14),
682 .name
= SYSMMU_CLOCK_NAME
,
683 .devname
= SYSMMU_CLOCK_DEVNAME(mfc_l
, 0),
684 .enable
= exynos4_clk_ip_mfc_ctrl
,
687 .name
= SYSMMU_CLOCK_NAME
,
688 .devname
= SYSMMU_CLOCK_DEVNAME(mfc_r
, 1),
689 .enable
= exynos4_clk_ip_mfc_ctrl
,
692 .name
= SYSMMU_CLOCK_NAME
,
693 .devname
= SYSMMU_CLOCK_DEVNAME(tv
, 2),
694 .enable
= exynos4_clk_ip_tv_ctrl
,
697 .name
= SYSMMU_CLOCK_NAME
,
698 .devname
= SYSMMU_CLOCK_DEVNAME(jpeg
, 3),
699 .enable
= exynos4_clk_ip_cam_ctrl
,
700 .ctrlbit
= (1 << 11),
702 .name
= SYSMMU_CLOCK_NAME
,
703 .devname
= SYSMMU_CLOCK_DEVNAME(rot
, 4),
704 .enable
= exynos4_clk_ip_image_ctrl
,
707 .name
= SYSMMU_CLOCK_NAME
,
708 .devname
= SYSMMU_CLOCK_DEVNAME(fimc0
, 5),
709 .enable
= exynos4_clk_ip_cam_ctrl
,
712 .name
= SYSMMU_CLOCK_NAME
,
713 .devname
= SYSMMU_CLOCK_DEVNAME(fimc1
, 6),
714 .enable
= exynos4_clk_ip_cam_ctrl
,
717 .name
= SYSMMU_CLOCK_NAME
,
718 .devname
= SYSMMU_CLOCK_DEVNAME(fimc2
, 7),
719 .enable
= exynos4_clk_ip_cam_ctrl
,
722 .name
= SYSMMU_CLOCK_NAME
,
723 .devname
= SYSMMU_CLOCK_DEVNAME(fimc3
, 8),
724 .enable
= exynos4_clk_ip_cam_ctrl
,
725 .ctrlbit
= (1 << 10),
727 .name
= SYSMMU_CLOCK_NAME
,
728 .devname
= SYSMMU_CLOCK_DEVNAME(fimd0
, 10),
729 .enable
= exynos4_clk_ip_lcd0_ctrl
,
734 static struct clk exynos4_init_clocks_on
[] = {
737 .devname
= "s5pv210-uart.0",
738 .enable
= exynos4_clk_ip_peril_ctrl
,
742 .devname
= "s5pv210-uart.1",
743 .enable
= exynos4_clk_ip_peril_ctrl
,
747 .devname
= "s5pv210-uart.2",
748 .enable
= exynos4_clk_ip_peril_ctrl
,
752 .devname
= "s5pv210-uart.3",
753 .enable
= exynos4_clk_ip_peril_ctrl
,
757 .devname
= "s5pv210-uart.4",
758 .enable
= exynos4_clk_ip_peril_ctrl
,
762 .devname
= "s5pv210-uart.5",
763 .enable
= exynos4_clk_ip_peril_ctrl
,
768 static struct clk exynos4_clk_pdma0
= {
770 .devname
= "dma-pl330.0",
771 .enable
= exynos4_clk_ip_fsys_ctrl
,
775 static struct clk exynos4_clk_pdma1
= {
777 .devname
= "dma-pl330.1",
778 .enable
= exynos4_clk_ip_fsys_ctrl
,
782 static struct clk exynos4_clk_mdma1
= {
784 .devname
= "dma-pl330.2",
785 .enable
= exynos4_clk_ip_image_ctrl
,
786 .ctrlbit
= ((1 << 8) | (1 << 5) | (1 << 2)),
789 static struct clk exynos4_clk_fimd0
= {
791 .devname
= "exynos4-fb.0",
792 .enable
= exynos4_clk_ip_lcd0_ctrl
,
796 struct clk
*exynos4_clkset_group_list
[] = {
797 [0] = &clk_ext_xtal_mux
,
799 [2] = &exynos4_clk_sclk_hdmi27m
,
800 [3] = &exynos4_clk_sclk_usbphy0
,
801 [4] = &exynos4_clk_sclk_usbphy1
,
802 [5] = &exynos4_clk_sclk_hdmiphy
,
803 [6] = &exynos4_clk_mout_mpll
.clk
,
804 [7] = &exynos4_clk_mout_epll
.clk
,
805 [8] = &exynos4_clk_sclk_vpll
.clk
,
808 struct clksrc_sources exynos4_clkset_group
= {
809 .sources
= exynos4_clkset_group_list
,
810 .nr_sources
= ARRAY_SIZE(exynos4_clkset_group_list
),
813 static struct clk
*exynos4_clkset_mout_g2d0_list
[] = {
814 [0] = &exynos4_clk_mout_mpll
.clk
,
815 [1] = &exynos4_clk_sclk_apll
.clk
,
818 struct clksrc_sources exynos4_clkset_mout_g2d0
= {
819 .sources
= exynos4_clkset_mout_g2d0_list
,
820 .nr_sources
= ARRAY_SIZE(exynos4_clkset_mout_g2d0_list
),
823 static struct clk
*exynos4_clkset_mout_g2d1_list
[] = {
824 [0] = &exynos4_clk_mout_epll
.clk
,
825 [1] = &exynos4_clk_sclk_vpll
.clk
,
828 struct clksrc_sources exynos4_clkset_mout_g2d1
= {
829 .sources
= exynos4_clkset_mout_g2d1_list
,
830 .nr_sources
= ARRAY_SIZE(exynos4_clkset_mout_g2d1_list
),
833 static struct clk
*exynos4_clkset_mout_mfc0_list
[] = {
834 [0] = &exynos4_clk_mout_mpll
.clk
,
835 [1] = &exynos4_clk_sclk_apll
.clk
,
838 static struct clksrc_sources exynos4_clkset_mout_mfc0
= {
839 .sources
= exynos4_clkset_mout_mfc0_list
,
840 .nr_sources
= ARRAY_SIZE(exynos4_clkset_mout_mfc0_list
),
843 static struct clksrc_clk exynos4_clk_mout_mfc0
= {
847 .sources
= &exynos4_clkset_mout_mfc0
,
848 .reg_src
= { .reg
= EXYNOS4_CLKSRC_MFC
, .shift
= 0, .size
= 1 },
851 static struct clk
*exynos4_clkset_mout_mfc1_list
[] = {
852 [0] = &exynos4_clk_mout_epll
.clk
,
853 [1] = &exynos4_clk_sclk_vpll
.clk
,
856 static struct clksrc_sources exynos4_clkset_mout_mfc1
= {
857 .sources
= exynos4_clkset_mout_mfc1_list
,
858 .nr_sources
= ARRAY_SIZE(exynos4_clkset_mout_mfc1_list
),
861 static struct clksrc_clk exynos4_clk_mout_mfc1
= {
865 .sources
= &exynos4_clkset_mout_mfc1
,
866 .reg_src
= { .reg
= EXYNOS4_CLKSRC_MFC
, .shift
= 4, .size
= 1 },
869 static struct clk
*exynos4_clkset_mout_mfc_list
[] = {
870 [0] = &exynos4_clk_mout_mfc0
.clk
,
871 [1] = &exynos4_clk_mout_mfc1
.clk
,
874 static struct clksrc_sources exynos4_clkset_mout_mfc
= {
875 .sources
= exynos4_clkset_mout_mfc_list
,
876 .nr_sources
= ARRAY_SIZE(exynos4_clkset_mout_mfc_list
),
879 static struct clk
*exynos4_clkset_sclk_dac_list
[] = {
880 [0] = &exynos4_clk_sclk_vpll
.clk
,
881 [1] = &exynos4_clk_sclk_hdmiphy
,
884 static struct clksrc_sources exynos4_clkset_sclk_dac
= {
885 .sources
= exynos4_clkset_sclk_dac_list
,
886 .nr_sources
= ARRAY_SIZE(exynos4_clkset_sclk_dac_list
),
889 static struct clksrc_clk exynos4_clk_sclk_dac
= {
892 .enable
= exynos4_clksrc_mask_tv_ctrl
,
895 .sources
= &exynos4_clkset_sclk_dac
,
896 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TV
, .shift
= 8, .size
= 1 },
899 static struct clksrc_clk exynos4_clk_sclk_pixel
= {
901 .name
= "sclk_pixel",
902 .parent
= &exynos4_clk_sclk_vpll
.clk
,
904 .reg_div
= { .reg
= EXYNOS4_CLKDIV_TV
, .shift
= 0, .size
= 4 },
907 static struct clk
*exynos4_clkset_sclk_hdmi_list
[] = {
908 [0] = &exynos4_clk_sclk_pixel
.clk
,
909 [1] = &exynos4_clk_sclk_hdmiphy
,
912 static struct clksrc_sources exynos4_clkset_sclk_hdmi
= {
913 .sources
= exynos4_clkset_sclk_hdmi_list
,
914 .nr_sources
= ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list
),
917 static struct clksrc_clk exynos4_clk_sclk_hdmi
= {
920 .enable
= exynos4_clksrc_mask_tv_ctrl
,
923 .sources
= &exynos4_clkset_sclk_hdmi
,
924 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TV
, .shift
= 0, .size
= 1 },
927 static struct clk
*exynos4_clkset_sclk_mixer_list
[] = {
928 [0] = &exynos4_clk_sclk_dac
.clk
,
929 [1] = &exynos4_clk_sclk_hdmi
.clk
,
932 static struct clksrc_sources exynos4_clkset_sclk_mixer
= {
933 .sources
= exynos4_clkset_sclk_mixer_list
,
934 .nr_sources
= ARRAY_SIZE(exynos4_clkset_sclk_mixer_list
),
937 static struct clksrc_clk exynos4_clk_sclk_mixer
= {
939 .name
= "sclk_mixer",
940 .enable
= exynos4_clksrc_mask_tv_ctrl
,
943 .sources
= &exynos4_clkset_sclk_mixer
,
944 .reg_src
= { .reg
= EXYNOS4_CLKSRC_TV
, .shift
= 4, .size
= 1 },
947 static struct clksrc_clk
*exynos4_sclk_tv
[] = {
948 &exynos4_clk_sclk_dac
,
949 &exynos4_clk_sclk_pixel
,
950 &exynos4_clk_sclk_hdmi
,
951 &exynos4_clk_sclk_mixer
,
954 static struct clksrc_clk exynos4_clk_dout_mmc0
= {
958 .sources
= &exynos4_clkset_group
,
959 .reg_src
= { .reg
= EXYNOS4_CLKSRC_FSYS
, .shift
= 0, .size
= 4 },
960 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS1
, .shift
= 0, .size
= 4 },
963 static struct clksrc_clk exynos4_clk_dout_mmc1
= {
967 .sources
= &exynos4_clkset_group
,
968 .reg_src
= { .reg
= EXYNOS4_CLKSRC_FSYS
, .shift
= 4, .size
= 4 },
969 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS1
, .shift
= 16, .size
= 4 },
972 static struct clksrc_clk exynos4_clk_dout_mmc2
= {
976 .sources
= &exynos4_clkset_group
,
977 .reg_src
= { .reg
= EXYNOS4_CLKSRC_FSYS
, .shift
= 8, .size
= 4 },
978 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS2
, .shift
= 0, .size
= 4 },
981 static struct clksrc_clk exynos4_clk_dout_mmc3
= {
985 .sources
= &exynos4_clkset_group
,
986 .reg_src
= { .reg
= EXYNOS4_CLKSRC_FSYS
, .shift
= 12, .size
= 4 },
987 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS2
, .shift
= 16, .size
= 4 },
990 static struct clksrc_clk exynos4_clk_dout_mmc4
= {
994 .sources
= &exynos4_clkset_group
,
995 .reg_src
= { .reg
= EXYNOS4_CLKSRC_FSYS
, .shift
= 16, .size
= 4 },
996 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS3
, .shift
= 0, .size
= 4 },
999 static struct clksrc_clk exynos4_clksrcs
[] = {
1003 .enable
= exynos4_clksrc_mask_peril0_ctrl
,
1004 .ctrlbit
= (1 << 24),
1006 .sources
= &exynos4_clkset_group
,
1007 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL0
, .shift
= 24, .size
= 4 },
1008 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL3
, .shift
= 0, .size
= 4 },
1011 .name
= "sclk_csis",
1012 .devname
= "s5p-mipi-csis.0",
1013 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1014 .ctrlbit
= (1 << 24),
1016 .sources
= &exynos4_clkset_group
,
1017 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 24, .size
= 4 },
1018 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 24, .size
= 4 },
1021 .name
= "sclk_csis",
1022 .devname
= "s5p-mipi-csis.1",
1023 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1024 .ctrlbit
= (1 << 28),
1026 .sources
= &exynos4_clkset_group
,
1027 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 28, .size
= 4 },
1028 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 28, .size
= 4 },
1031 .name
= "sclk_cam0",
1032 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1033 .ctrlbit
= (1 << 16),
1035 .sources
= &exynos4_clkset_group
,
1036 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 16, .size
= 4 },
1037 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 16, .size
= 4 },
1040 .name
= "sclk_cam1",
1041 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1042 .ctrlbit
= (1 << 20),
1044 .sources
= &exynos4_clkset_group
,
1045 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 20, .size
= 4 },
1046 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 20, .size
= 4 },
1049 .name
= "sclk_fimc",
1050 .devname
= "exynos4-fimc.0",
1051 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1052 .ctrlbit
= (1 << 0),
1054 .sources
= &exynos4_clkset_group
,
1055 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 0, .size
= 4 },
1056 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 0, .size
= 4 },
1059 .name
= "sclk_fimc",
1060 .devname
= "exynos4-fimc.1",
1061 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1062 .ctrlbit
= (1 << 4),
1064 .sources
= &exynos4_clkset_group
,
1065 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 4, .size
= 4 },
1066 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 4, .size
= 4 },
1069 .name
= "sclk_fimc",
1070 .devname
= "exynos4-fimc.2",
1071 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1072 .ctrlbit
= (1 << 8),
1074 .sources
= &exynos4_clkset_group
,
1075 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 8, .size
= 4 },
1076 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 8, .size
= 4 },
1079 .name
= "sclk_fimc",
1080 .devname
= "exynos4-fimc.3",
1081 .enable
= exynos4_clksrc_mask_cam_ctrl
,
1082 .ctrlbit
= (1 << 12),
1084 .sources
= &exynos4_clkset_group
,
1085 .reg_src
= { .reg
= EXYNOS4_CLKSRC_CAM
, .shift
= 12, .size
= 4 },
1086 .reg_div
= { .reg
= EXYNOS4_CLKDIV_CAM
, .shift
= 12, .size
= 4 },
1089 .name
= "sclk_fimd",
1090 .devname
= "exynos4-fb.0",
1091 .enable
= exynos4_clksrc_mask_lcd0_ctrl
,
1092 .ctrlbit
= (1 << 0),
1094 .sources
= &exynos4_clkset_group
,
1095 .reg_src
= { .reg
= EXYNOS4_CLKSRC_LCD0
, .shift
= 0, .size
= 4 },
1096 .reg_div
= { .reg
= EXYNOS4_CLKDIV_LCD0
, .shift
= 0, .size
= 4 },
1100 .devname
= "s5p-mfc",
1102 .sources
= &exynos4_clkset_mout_mfc
,
1103 .reg_src
= { .reg
= EXYNOS4_CLKSRC_MFC
, .shift
= 8, .size
= 1 },
1104 .reg_div
= { .reg
= EXYNOS4_CLKDIV_MFC
, .shift
= 0, .size
= 4 },
1107 .name
= "sclk_dwmmc",
1108 .parent
= &exynos4_clk_dout_mmc4
.clk
,
1109 .enable
= exynos4_clksrc_mask_fsys_ctrl
,
1110 .ctrlbit
= (1 << 16),
1112 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS3
, .shift
= 8, .size
= 8 },
1116 static struct clksrc_clk exynos4_clk_sclk_uart0
= {
1119 .devname
= "exynos4210-uart.0",
1120 .enable
= exynos4_clksrc_mask_peril0_ctrl
,
1121 .ctrlbit
= (1 << 0),
1123 .sources
= &exynos4_clkset_group
,
1124 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL0
, .shift
= 0, .size
= 4 },
1125 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL0
, .shift
= 0, .size
= 4 },
1128 static struct clksrc_clk exynos4_clk_sclk_uart1
= {
1131 .devname
= "exynos4210-uart.1",
1132 .enable
= exynos4_clksrc_mask_peril0_ctrl
,
1133 .ctrlbit
= (1 << 4),
1135 .sources
= &exynos4_clkset_group
,
1136 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL0
, .shift
= 4, .size
= 4 },
1137 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL0
, .shift
= 4, .size
= 4 },
1140 static struct clksrc_clk exynos4_clk_sclk_uart2
= {
1143 .devname
= "exynos4210-uart.2",
1144 .enable
= exynos4_clksrc_mask_peril0_ctrl
,
1145 .ctrlbit
= (1 << 8),
1147 .sources
= &exynos4_clkset_group
,
1148 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL0
, .shift
= 8, .size
= 4 },
1149 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL0
, .shift
= 8, .size
= 4 },
1152 static struct clksrc_clk exynos4_clk_sclk_uart3
= {
1155 .devname
= "exynos4210-uart.3",
1156 .enable
= exynos4_clksrc_mask_peril0_ctrl
,
1157 .ctrlbit
= (1 << 12),
1159 .sources
= &exynos4_clkset_group
,
1160 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL0
, .shift
= 12, .size
= 4 },
1161 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL0
, .shift
= 12, .size
= 4 },
1164 static struct clksrc_clk exynos4_clk_sclk_mmc0
= {
1167 .devname
= "exynos4-sdhci.0",
1168 .parent
= &exynos4_clk_dout_mmc0
.clk
,
1169 .enable
= exynos4_clksrc_mask_fsys_ctrl
,
1170 .ctrlbit
= (1 << 0),
1172 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS1
, .shift
= 8, .size
= 8 },
1175 static struct clksrc_clk exynos4_clk_sclk_mmc1
= {
1178 .devname
= "exynos4-sdhci.1",
1179 .parent
= &exynos4_clk_dout_mmc1
.clk
,
1180 .enable
= exynos4_clksrc_mask_fsys_ctrl
,
1181 .ctrlbit
= (1 << 4),
1183 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS1
, .shift
= 24, .size
= 8 },
1186 static struct clksrc_clk exynos4_clk_sclk_mmc2
= {
1189 .devname
= "exynos4-sdhci.2",
1190 .parent
= &exynos4_clk_dout_mmc2
.clk
,
1191 .enable
= exynos4_clksrc_mask_fsys_ctrl
,
1192 .ctrlbit
= (1 << 8),
1194 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS2
, .shift
= 8, .size
= 8 },
1197 static struct clksrc_clk exynos4_clk_sclk_mmc3
= {
1200 .devname
= "exynos4-sdhci.3",
1201 .parent
= &exynos4_clk_dout_mmc3
.clk
,
1202 .enable
= exynos4_clksrc_mask_fsys_ctrl
,
1203 .ctrlbit
= (1 << 12),
1205 .reg_div
= { .reg
= EXYNOS4_CLKDIV_FSYS2
, .shift
= 24, .size
= 8 },
1208 static struct clksrc_clk exynos4_clk_mdout_spi0
= {
1210 .name
= "mdout_spi",
1211 .devname
= "exynos4210-spi.0",
1213 .sources
= &exynos4_clkset_group
,
1214 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL1
, .shift
= 16, .size
= 4 },
1215 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL1
, .shift
= 0, .size
= 4 },
1218 static struct clksrc_clk exynos4_clk_mdout_spi1
= {
1220 .name
= "mdout_spi",
1221 .devname
= "exynos4210-spi.1",
1223 .sources
= &exynos4_clkset_group
,
1224 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL1
, .shift
= 20, .size
= 4 },
1225 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL1
, .shift
= 16, .size
= 4 },
1228 static struct clksrc_clk exynos4_clk_mdout_spi2
= {
1230 .name
= "mdout_spi",
1231 .devname
= "exynos4210-spi.2",
1233 .sources
= &exynos4_clkset_group
,
1234 .reg_src
= { .reg
= EXYNOS4_CLKSRC_PERIL1
, .shift
= 24, .size
= 4 },
1235 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL2
, .shift
= 0, .size
= 4 },
1238 static struct clksrc_clk exynos4_clk_sclk_spi0
= {
1241 .devname
= "exynos4210-spi.0",
1242 .parent
= &exynos4_clk_mdout_spi0
.clk
,
1243 .enable
= exynos4_clksrc_mask_peril1_ctrl
,
1244 .ctrlbit
= (1 << 16),
1246 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL1
, .shift
= 8, .size
= 8 },
1249 static struct clksrc_clk exynos4_clk_sclk_spi1
= {
1252 .devname
= "exynos4210-spi.1",
1253 .parent
= &exynos4_clk_mdout_spi1
.clk
,
1254 .enable
= exynos4_clksrc_mask_peril1_ctrl
,
1255 .ctrlbit
= (1 << 20),
1257 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL1
, .shift
= 24, .size
= 8 },
1260 static struct clksrc_clk exynos4_clk_sclk_spi2
= {
1263 .devname
= "exynos4210-spi.2",
1264 .parent
= &exynos4_clk_mdout_spi2
.clk
,
1265 .enable
= exynos4_clksrc_mask_peril1_ctrl
,
1266 .ctrlbit
= (1 << 24),
1268 .reg_div
= { .reg
= EXYNOS4_CLKDIV_PERIL2
, .shift
= 8, .size
= 8 },
1271 /* Clock initialization code */
1272 static struct clksrc_clk
*exynos4_sysclks
[] = {
1273 &exynos4_clk_mout_apll
,
1274 &exynos4_clk_sclk_apll
,
1275 &exynos4_clk_mout_epll
,
1276 &exynos4_clk_mout_mpll
,
1277 &exynos4_clk_moutcore
,
1278 &exynos4_clk_coreclk
,
1279 &exynos4_clk_armclk
,
1280 &exynos4_clk_aclk_corem0
,
1281 &exynos4_clk_aclk_cores
,
1282 &exynos4_clk_aclk_corem1
,
1283 &exynos4_clk_periphclk
,
1284 &exynos4_clk_mout_corebus
,
1285 &exynos4_clk_sclk_dmc
,
1286 &exynos4_clk_aclk_cored
,
1287 &exynos4_clk_aclk_corep
,
1288 &exynos4_clk_aclk_acp
,
1289 &exynos4_clk_pclk_acp
,
1290 &exynos4_clk_vpllsrc
,
1291 &exynos4_clk_sclk_vpll
,
1292 &exynos4_clk_aclk_200
,
1293 &exynos4_clk_aclk_100
,
1294 &exynos4_clk_aclk_160
,
1295 &exynos4_clk_aclk_133
,
1296 &exynos4_clk_dout_mmc0
,
1297 &exynos4_clk_dout_mmc1
,
1298 &exynos4_clk_dout_mmc2
,
1299 &exynos4_clk_dout_mmc3
,
1300 &exynos4_clk_dout_mmc4
,
1301 &exynos4_clk_mout_mfc0
,
1302 &exynos4_clk_mout_mfc1
,
1305 static struct clk
*exynos4_clk_cdev
[] = {
1312 static struct clksrc_clk
*exynos4_clksrc_cdev
[] = {
1313 &exynos4_clk_sclk_uart0
,
1314 &exynos4_clk_sclk_uart1
,
1315 &exynos4_clk_sclk_uart2
,
1316 &exynos4_clk_sclk_uart3
,
1317 &exynos4_clk_sclk_mmc0
,
1318 &exynos4_clk_sclk_mmc1
,
1319 &exynos4_clk_sclk_mmc2
,
1320 &exynos4_clk_sclk_mmc3
,
1321 &exynos4_clk_sclk_spi0
,
1322 &exynos4_clk_sclk_spi1
,
1323 &exynos4_clk_sclk_spi2
,
1324 &exynos4_clk_mdout_spi0
,
1325 &exynos4_clk_mdout_spi1
,
1326 &exynos4_clk_mdout_spi2
,
1329 static struct clk_lookup exynos4_clk_lookup
[] = {
1330 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0
.clk
),
1331 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1
.clk
),
1332 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2
.clk
),
1333 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3
.clk
),
1334 CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0
.clk
),
1335 CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1
.clk
),
1336 CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2
.clk
),
1337 CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3
.clk
),
1338 CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0
),
1339 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0
),
1340 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1
),
1341 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1
),
1342 CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0
.clk
),
1343 CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1
.clk
),
1344 CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2
.clk
),
1347 static int xtal_rate
;
1349 static unsigned long exynos4_fout_apll_get_rate(struct clk
*clk
)
1351 if (soc_is_exynos4210())
1352 return s5p_get_pll45xx(xtal_rate
, __raw_readl(EXYNOS4_APLL_CON0
),
1354 else if (soc_is_exynos4212() || soc_is_exynos4412())
1355 return s5p_get_pll35xx(xtal_rate
, __raw_readl(EXYNOS4_APLL_CON0
));
1360 static struct clk_ops exynos4_fout_apll_ops
= {
1361 .get_rate
= exynos4_fout_apll_get_rate
,
1364 static u32 exynos4_vpll_div
[][8] = {
1365 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1366 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1369 static unsigned long exynos4_vpll_get_rate(struct clk
*clk
)
1374 static int exynos4_vpll_set_rate(struct clk
*clk
, unsigned long rate
)
1376 unsigned int vpll_con0
, vpll_con1
= 0;
1379 /* Return if nothing changed */
1380 if (clk
->rate
== rate
)
1383 vpll_con0
= __raw_readl(EXYNOS4_VPLL_CON0
);
1384 vpll_con0
&= ~(0x1 << 27 | \
1385 PLL90XX_MDIV_MASK
<< PLL46XX_MDIV_SHIFT
| \
1386 PLL90XX_PDIV_MASK
<< PLL46XX_PDIV_SHIFT
| \
1387 PLL90XX_SDIV_MASK
<< PLL46XX_SDIV_SHIFT
);
1389 vpll_con1
= __raw_readl(EXYNOS4_VPLL_CON1
);
1390 vpll_con1
&= ~(PLL46XX_MRR_MASK
<< PLL46XX_MRR_SHIFT
| \
1391 PLL46XX_MFR_MASK
<< PLL46XX_MFR_SHIFT
| \
1392 PLL4650C_KDIV_MASK
<< PLL46XX_KDIV_SHIFT
);
1394 for (i
= 0; i
< ARRAY_SIZE(exynos4_vpll_div
); i
++) {
1395 if (exynos4_vpll_div
[i
][0] == rate
) {
1396 vpll_con0
|= exynos4_vpll_div
[i
][1] << PLL46XX_PDIV_SHIFT
;
1397 vpll_con0
|= exynos4_vpll_div
[i
][2] << PLL46XX_MDIV_SHIFT
;
1398 vpll_con0
|= exynos4_vpll_div
[i
][3] << PLL46XX_SDIV_SHIFT
;
1399 vpll_con1
|= exynos4_vpll_div
[i
][4] << PLL46XX_KDIV_SHIFT
;
1400 vpll_con1
|= exynos4_vpll_div
[i
][5] << PLL46XX_MFR_SHIFT
;
1401 vpll_con1
|= exynos4_vpll_div
[i
][6] << PLL46XX_MRR_SHIFT
;
1402 vpll_con0
|= exynos4_vpll_div
[i
][7] << 27;
1407 if (i
== ARRAY_SIZE(exynos4_vpll_div
)) {
1408 printk(KERN_ERR
"%s: Invalid Clock VPLL Frequency\n",
1413 __raw_writel(vpll_con0
, EXYNOS4_VPLL_CON0
);
1414 __raw_writel(vpll_con1
, EXYNOS4_VPLL_CON1
);
1416 /* Wait for VPLL lock */
1417 while (!(__raw_readl(EXYNOS4_VPLL_CON0
) & (1 << PLL46XX_LOCKED_SHIFT
)))
1424 static struct clk_ops exynos4_vpll_ops
= {
1425 .get_rate
= exynos4_vpll_get_rate
,
1426 .set_rate
= exynos4_vpll_set_rate
,
1429 void __init_or_cpufreq
exynos4_setup_clocks(void)
1431 struct clk
*xtal_clk
;
1432 unsigned long apll
= 0;
1433 unsigned long mpll
= 0;
1434 unsigned long epll
= 0;
1435 unsigned long vpll
= 0;
1436 unsigned long vpllsrc
;
1438 unsigned long armclk
;
1439 unsigned long sclk_dmc
;
1440 unsigned long aclk_200
;
1441 unsigned long aclk_100
;
1442 unsigned long aclk_160
;
1443 unsigned long aclk_133
;
1446 printk(KERN_DEBUG
"%s: registering clocks\n", __func__
);
1448 xtal_clk
= clk_get(NULL
, "xtal");
1449 BUG_ON(IS_ERR(xtal_clk
));
1451 xtal
= clk_get_rate(xtal_clk
);
1457 printk(KERN_DEBUG
"%s: xtal is %ld\n", __func__
, xtal
);
1459 if (soc_is_exynos4210()) {
1460 apll
= s5p_get_pll45xx(xtal
, __raw_readl(EXYNOS4_APLL_CON0
),
1462 mpll
= s5p_get_pll45xx(xtal
, __raw_readl(EXYNOS4_MPLL_CON0
),
1464 epll
= s5p_get_pll46xx(xtal
, __raw_readl(EXYNOS4_EPLL_CON0
),
1465 __raw_readl(EXYNOS4_EPLL_CON1
), pll_4600
);
1467 vpllsrc
= clk_get_rate(&exynos4_clk_vpllsrc
.clk
);
1468 vpll
= s5p_get_pll46xx(vpllsrc
, __raw_readl(EXYNOS4_VPLL_CON0
),
1469 __raw_readl(EXYNOS4_VPLL_CON1
), pll_4650c
);
1470 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1471 apll
= s5p_get_pll35xx(xtal
, __raw_readl(EXYNOS4_APLL_CON0
));
1472 mpll
= s5p_get_pll35xx(xtal
, __raw_readl(EXYNOS4_MPLL_CON0
));
1473 epll
= s5p_get_pll36xx(xtal
, __raw_readl(EXYNOS4_EPLL_CON0
),
1474 __raw_readl(EXYNOS4_EPLL_CON1
));
1476 vpllsrc
= clk_get_rate(&exynos4_clk_vpllsrc
.clk
);
1477 vpll
= s5p_get_pll36xx(vpllsrc
, __raw_readl(EXYNOS4_VPLL_CON0
),
1478 __raw_readl(EXYNOS4_VPLL_CON1
));
1483 clk_fout_apll
.ops
= &exynos4_fout_apll_ops
;
1484 clk_fout_mpll
.rate
= mpll
;
1485 clk_fout_epll
.rate
= epll
;
1486 clk_fout_vpll
.ops
= &exynos4_vpll_ops
;
1487 clk_fout_vpll
.rate
= vpll
;
1489 printk(KERN_INFO
"EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1490 apll
, mpll
, epll
, vpll
);
1492 armclk
= clk_get_rate(&exynos4_clk_armclk
.clk
);
1493 sclk_dmc
= clk_get_rate(&exynos4_clk_sclk_dmc
.clk
);
1495 aclk_200
= clk_get_rate(&exynos4_clk_aclk_200
.clk
);
1496 aclk_100
= clk_get_rate(&exynos4_clk_aclk_100
.clk
);
1497 aclk_160
= clk_get_rate(&exynos4_clk_aclk_160
.clk
);
1498 aclk_133
= clk_get_rate(&exynos4_clk_aclk_133
.clk
);
1500 printk(KERN_INFO
"EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1501 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1502 armclk
, sclk_dmc
, aclk_200
,
1503 aclk_100
, aclk_160
, aclk_133
);
1505 clk_f
.rate
= armclk
;
1506 clk_h
.rate
= sclk_dmc
;
1507 clk_p
.rate
= aclk_100
;
1509 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos4_clksrcs
); ptr
++)
1510 s3c_set_clksrc(&exynos4_clksrcs
[ptr
], true);
1513 static struct clk
*exynos4_clks
[] __initdata
= {
1514 &exynos4_clk_sclk_hdmi27m
,
1515 &exynos4_clk_sclk_hdmiphy
,
1516 &exynos4_clk_sclk_usbphy0
,
1517 &exynos4_clk_sclk_usbphy1
,
1520 #ifdef CONFIG_PM_SLEEP
1521 static int exynos4_clock_suspend(void)
1523 s3c_pm_do_save(exynos4_clock_save
, ARRAY_SIZE(exynos4_clock_save
));
1527 static void exynos4_clock_resume(void)
1529 s3c_pm_do_restore_core(exynos4_clock_save
, ARRAY_SIZE(exynos4_clock_save
));
1533 #define exynos4_clock_suspend NULL
1534 #define exynos4_clock_resume NULL
1537 static struct syscore_ops exynos4_clock_syscore_ops
= {
1538 .suspend
= exynos4_clock_suspend
,
1539 .resume
= exynos4_clock_resume
,
1542 void __init
exynos4_register_clocks(void)
1546 s3c24xx_register_clocks(exynos4_clks
, ARRAY_SIZE(exynos4_clks
));
1548 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos4_sysclks
); ptr
++)
1549 s3c_register_clksrc(exynos4_sysclks
[ptr
], 1);
1551 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos4_sclk_tv
); ptr
++)
1552 s3c_register_clksrc(exynos4_sclk_tv
[ptr
], 1);
1554 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos4_clksrc_cdev
); ptr
++)
1555 s3c_register_clksrc(exynos4_clksrc_cdev
[ptr
], 1);
1557 s3c_register_clksrc(exynos4_clksrcs
, ARRAY_SIZE(exynos4_clksrcs
));
1558 s3c_register_clocks(exynos4_init_clocks_on
, ARRAY_SIZE(exynos4_init_clocks_on
));
1560 s3c24xx_register_clocks(exynos4_clk_cdev
, ARRAY_SIZE(exynos4_clk_cdev
));
1561 for (ptr
= 0; ptr
< ARRAY_SIZE(exynos4_clk_cdev
); ptr
++)
1562 s3c_disable_clocks(exynos4_clk_cdev
[ptr
], 1);
1564 s3c_register_clocks(exynos4_init_clocks_off
, ARRAY_SIZE(exynos4_init_clocks_off
));
1565 s3c_disable_clocks(exynos4_init_clocks_off
, ARRAY_SIZE(exynos4_init_clocks_off
));
1566 clkdev_add_table(exynos4_clk_lookup
, ARRAY_SIZE(exynos4_clk_lookup
));
1568 register_syscore_ops(&exynos4_clock_syscore_ops
);
1569 s3c24xx_register_clock(&dummy_apb_pclk
);