blob: 871f9d508fde93898e0f1867ddb068c64a89fe31 [file] [log] [blame]
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001/* linux/arch/arm/mach-exynos4/clock.c
Changhwan Younc8bef142010-07-27 17:52:39 +09002 *
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09003 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
Changhwan Younc8bef142010-07-27 17:52:39 +09005 *
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09006 * EXYNOS4 - Clock support
Changhwan Younc8bef142010-07-27 17:52:39 +09007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/err.h>
15#include <linux/io.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23
24#include <mach/map.h>
25#include <mach/regs-clock.h>
KyongHo Chob0b6ff02011-03-07 09:10:24 +090026#include <mach/sysmmu.h>
Changhwan Younc8bef142010-07-27 17:52:39 +090027
28static struct clk clk_sclk_hdmi27m = {
29 .name = "sclk_hdmi27m",
30 .id = -1,
31 .rate = 27000000,
32};
33
Jongpill Leeb99380e2010-08-18 22:16:45 +090034static struct clk clk_sclk_hdmiphy = {
35 .name = "sclk_hdmiphy",
36 .id = -1,
37};
38
39static struct clk clk_sclk_usbphy0 = {
40 .name = "sclk_usbphy0",
41 .id = -1,
42 .rate = 27000000,
43};
44
45static struct clk clk_sclk_usbphy1 = {
46 .name = "sclk_usbphy1",
47 .id = -1,
48};
49
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090050static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
Jongpill Lee37e01722010-08-18 22:33:43 +090051{
52 return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
53}
54
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090055static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +090056{
57 return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
58}
59
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090060static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +090061{
62 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
63}
64
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090065static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +090066{
67 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable);
68}
69
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090070static int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
Jongpill Lee340ea1e2010-08-18 22:39:26 +090071{
72 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
73}
74
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090075static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
Jongpill Lee3297c2e2010-08-27 17:53:26 +090076{
77 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
78}
79
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090080static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +090081{
82 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
83}
84
KyongHo Chob0b6ff02011-03-07 09:10:24 +090085static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
86{
87 return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
88}
89
Kukjin Kimb3ed3a12011-02-14 16:08:04 +090090static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +090091{
92 return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
93}
94
KyongHo Chob0b6ff02011-03-07 09:10:24 +090095static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
96{
97 return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
98}
99
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900100static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900101{
102 return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
103}
104
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900105static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900106{
107 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
108}
109
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900110static int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900111{
112 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
113}
114
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900115static int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900116{
117 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
118}
119
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900120static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
Jongpill Lee5a847b42010-08-27 16:50:47 +0900121{
122 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
123}
124
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900125static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900126{
127 return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
128}
129
Changhwan Younc8bef142010-07-27 17:52:39 +0900130/* Core list of CMU_CPU side */
131
132static struct clksrc_clk clk_mout_apll = {
133 .clk = {
134 .name = "mout_apll",
135 .id = -1,
136 },
137 .sources = &clk_src_apll,
138 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
Jongpill Lee3ff31022010-08-18 22:20:31 +0900139};
140
141static struct clksrc_clk clk_sclk_apll = {
142 .clk = {
143 .name = "sclk_apll",
144 .id = -1,
145 .parent = &clk_mout_apll.clk,
146 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900147 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
148};
149
150static struct clksrc_clk clk_mout_epll = {
151 .clk = {
152 .name = "mout_epll",
153 .id = -1,
154 },
155 .sources = &clk_src_epll,
156 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
157};
158
159static struct clksrc_clk clk_mout_mpll = {
160 .clk = {
161 .name = "mout_mpll",
162 .id = -1,
163 },
164 .sources = &clk_src_mpll,
165 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 },
166};
167
168static struct clk *clkset_moutcore_list[] = {
Jaecheol Lee8f3b9cf2010-09-18 10:50:46 +0900169 [0] = &clk_mout_apll.clk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900170 [1] = &clk_mout_mpll.clk,
171};
172
173static struct clksrc_sources clkset_moutcore = {
174 .sources = clkset_moutcore_list,
175 .nr_sources = ARRAY_SIZE(clkset_moutcore_list),
176};
177
178static struct clksrc_clk clk_moutcore = {
179 .clk = {
180 .name = "moutcore",
181 .id = -1,
182 },
183 .sources = &clkset_moutcore,
184 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
185};
186
187static struct clksrc_clk clk_coreclk = {
188 .clk = {
189 .name = "core_clk",
190 .id = -1,
191 .parent = &clk_moutcore.clk,
192 },
193 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
194};
195
196static struct clksrc_clk clk_armclk = {
197 .clk = {
198 .name = "armclk",
199 .id = -1,
200 .parent = &clk_coreclk.clk,
201 },
202};
203
204static struct clksrc_clk clk_aclk_corem0 = {
205 .clk = {
206 .name = "aclk_corem0",
207 .id = -1,
208 .parent = &clk_coreclk.clk,
209 },
210 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
211};
212
213static struct clksrc_clk clk_aclk_cores = {
214 .clk = {
215 .name = "aclk_cores",
216 .id = -1,
217 .parent = &clk_coreclk.clk,
218 },
219 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
220};
221
222static struct clksrc_clk clk_aclk_corem1 = {
223 .clk = {
224 .name = "aclk_corem1",
225 .id = -1,
226 .parent = &clk_coreclk.clk,
227 },
228 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
229};
230
231static struct clksrc_clk clk_periphclk = {
232 .clk = {
233 .name = "periphclk",
234 .id = -1,
235 .parent = &clk_coreclk.clk,
236 },
237 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
238};
239
Changhwan Younc8bef142010-07-27 17:52:39 +0900240/* Core list of CMU_CORE side */
241
242static struct clk *clkset_corebus_list[] = {
243 [0] = &clk_mout_mpll.clk,
Jongpill Lee3ff31022010-08-18 22:20:31 +0900244 [1] = &clk_sclk_apll.clk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900245};
246
247static struct clksrc_sources clkset_mout_corebus = {
248 .sources = clkset_corebus_list,
249 .nr_sources = ARRAY_SIZE(clkset_corebus_list),
250};
251
252static struct clksrc_clk clk_mout_corebus = {
253 .clk = {
254 .name = "mout_corebus",
255 .id = -1,
256 },
257 .sources = &clkset_mout_corebus,
Sunyoung Kang7af36b92010-09-18 10:59:31 +0900258 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900259};
260
261static struct clksrc_clk clk_sclk_dmc = {
262 .clk = {
263 .name = "sclk_dmc",
264 .id = -1,
265 .parent = &clk_mout_corebus.clk,
266 },
Sunyoung Kang7af36b92010-09-18 10:59:31 +0900267 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900268};
269
270static struct clksrc_clk clk_aclk_cored = {
271 .clk = {
272 .name = "aclk_cored",
273 .id = -1,
274 .parent = &clk_sclk_dmc.clk,
275 },
Sunyoung Kang7af36b92010-09-18 10:59:31 +0900276 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900277};
278
279static struct clksrc_clk clk_aclk_corep = {
280 .clk = {
281 .name = "aclk_corep",
282 .id = -1,
283 .parent = &clk_aclk_cored.clk,
284 },
Sunyoung Kang7af36b92010-09-18 10:59:31 +0900285 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900286};
287
288static struct clksrc_clk clk_aclk_acp = {
289 .clk = {
290 .name = "aclk_acp",
291 .id = -1,
292 .parent = &clk_mout_corebus.clk,
293 },
Sunyoung Kang7af36b92010-09-18 10:59:31 +0900294 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900295};
296
297static struct clksrc_clk clk_pclk_acp = {
298 .clk = {
299 .name = "pclk_acp",
300 .id = -1,
301 .parent = &clk_aclk_acp.clk,
302 },
Sunyoung Kang7af36b92010-09-18 10:59:31 +0900303 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900304};
305
306/* Core list of CMU_TOP side */
307
308static struct clk *clkset_aclk_top_list[] = {
309 [0] = &clk_mout_mpll.clk,
Jongpill Lee3ff31022010-08-18 22:20:31 +0900310 [1] = &clk_sclk_apll.clk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900311};
312
Kukjin Kim9e235522010-08-18 22:06:02 +0900313static struct clksrc_sources clkset_aclk = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900314 .sources = clkset_aclk_top_list,
315 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
316};
317
318static struct clksrc_clk clk_aclk_200 = {
319 .clk = {
320 .name = "aclk_200",
321 .id = -1,
322 },
Kukjin Kim9e235522010-08-18 22:06:02 +0900323 .sources = &clkset_aclk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900324 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
325 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
326};
327
Changhwan Younc8bef142010-07-27 17:52:39 +0900328static struct clksrc_clk clk_aclk_100 = {
329 .clk = {
330 .name = "aclk_100",
331 .id = -1,
332 },
Kukjin Kim9e235522010-08-18 22:06:02 +0900333 .sources = &clkset_aclk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900334 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
335 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
336};
337
Changhwan Younc8bef142010-07-27 17:52:39 +0900338static struct clksrc_clk clk_aclk_160 = {
339 .clk = {
340 .name = "aclk_160",
341 .id = -1,
342 },
Kukjin Kim9e235522010-08-18 22:06:02 +0900343 .sources = &clkset_aclk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900344 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
345 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
346};
347
Changhwan Younc8bef142010-07-27 17:52:39 +0900348static struct clksrc_clk clk_aclk_133 = {
349 .clk = {
350 .name = "aclk_133",
351 .id = -1,
352 },
Kukjin Kim9e235522010-08-18 22:06:02 +0900353 .sources = &clkset_aclk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900354 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
355 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
356};
357
358static struct clk *clkset_vpllsrc_list[] = {
359 [0] = &clk_fin_vpll,
360 [1] = &clk_sclk_hdmi27m,
361};
362
363static struct clksrc_sources clkset_vpllsrc = {
364 .sources = clkset_vpllsrc_list,
365 .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
366};
367
368static struct clksrc_clk clk_vpllsrc = {
369 .clk = {
370 .name = "vpll_src",
371 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900372 .enable = exynos4_clksrc_mask_top_ctrl,
Jongpill Lee37e01722010-08-18 22:33:43 +0900373 .ctrlbit = (1 << 0),
Changhwan Younc8bef142010-07-27 17:52:39 +0900374 },
375 .sources = &clkset_vpllsrc,
376 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
377};
378
379static struct clk *clkset_sclk_vpll_list[] = {
380 [0] = &clk_vpllsrc.clk,
381 [1] = &clk_fout_vpll,
382};
383
384static struct clksrc_sources clkset_sclk_vpll = {
385 .sources = clkset_sclk_vpll_list,
386 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
387};
388
389static struct clksrc_clk clk_sclk_vpll = {
390 .clk = {
391 .name = "sclk_vpll",
392 .id = -1,
393 },
394 .sources = &clkset_sclk_vpll,
395 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
396};
397
Kukjin Kim957c4612011-01-04 17:58:22 +0900398static struct clk init_clocks_off[] = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900399 {
400 .name = "timers",
401 .id = -1,
402 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900403 .enable = exynos4_clk_ip_peril_ctrl,
Changhwan Younc8bef142010-07-27 17:52:39 +0900404 .ctrlbit = (1<<24),
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900405 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900406 .name = "csis",
407 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900408 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900409 .ctrlbit = (1 << 4),
410 }, {
411 .name = "csis",
412 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900413 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900414 .ctrlbit = (1 << 5),
415 }, {
416 .name = "fimc",
417 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900418 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900419 .ctrlbit = (1 << 0),
420 }, {
421 .name = "fimc",
422 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900423 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900424 .ctrlbit = (1 << 1),
425 }, {
426 .name = "fimc",
427 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900428 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900429 .ctrlbit = (1 << 2),
430 }, {
431 .name = "fimc",
432 .id = 3,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900433 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900434 .ctrlbit = (1 << 3),
435 }, {
436 .name = "fimd",
437 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900438 .enable = exynos4_clk_ip_lcd0_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900439 .ctrlbit = (1 << 0),
440 }, {
441 .name = "fimd",
442 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900443 .enable = exynos4_clk_ip_lcd1_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900444 .ctrlbit = (1 << 0),
445 }, {
Abhilash Kesavan40360212011-03-15 18:35:24 +0900446 .name = "sataphy",
447 .id = -1,
448 .parent = &clk_aclk_133.clk,
449 .enable = exynos4_clk_ip_fsys_ctrl,
450 .ctrlbit = (1 << 3),
451 }, {
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900452 .name = "hsmmc",
453 .id = 0,
454 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900455 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900456 .ctrlbit = (1 << 5),
457 }, {
458 .name = "hsmmc",
459 .id = 1,
460 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900461 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900462 .ctrlbit = (1 << 6),
463 }, {
464 .name = "hsmmc",
465 .id = 2,
466 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900467 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900468 .ctrlbit = (1 << 7),
469 }, {
470 .name = "hsmmc",
471 .id = 3,
472 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900473 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900474 .ctrlbit = (1 << 8),
475 }, {
476 .name = "hsmmc",
477 .id = 4,
478 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900479 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900480 .ctrlbit = (1 << 9),
Jongpill Lee82260bf2010-08-18 22:49:24 +0900481 }, {
482 .name = "sata",
483 .id = -1,
Abhilash Kesavan40360212011-03-15 18:35:24 +0900484 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900485 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900486 .ctrlbit = (1 << 10),
487 }, {
Jassi Brar3055c6d2010-12-21 09:54:35 +0900488 .name = "pdma",
489 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900490 .enable = exynos4_clk_ip_fsys_ctrl,
Jassi Brar3055c6d2010-12-21 09:54:35 +0900491 .ctrlbit = (1 << 0),
492 }, {
493 .name = "pdma",
494 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900495 .enable = exynos4_clk_ip_fsys_ctrl,
Jassi Brar3055c6d2010-12-21 09:54:35 +0900496 .ctrlbit = (1 << 1),
497 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900498 .name = "adc",
499 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900500 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900501 .ctrlbit = (1 << 15),
502 }, {
Naveen Krishna Chf9d7bcb2011-02-22 17:13:42 +0900503 .name = "keypad",
504 .id = -1,
505 .enable = exynos4_clk_ip_perir_ctrl,
506 .ctrlbit = (1 << 16),
507 }, {
Changhwan Youncdff6e62010-09-20 15:25:51 +0900508 .name = "rtc",
509 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900510 .enable = exynos4_clk_ip_perir_ctrl,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900511 .ctrlbit = (1 << 15),
512 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900513 .name = "watchdog",
514 .id = -1,
Inderpal Singhf5fb4a22011-03-08 07:13:45 +0900515 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900516 .enable = exynos4_clk_ip_perir_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900517 .ctrlbit = (1 << 14),
518 }, {
519 .name = "usbhost",
520 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900521 .enable = exynos4_clk_ip_fsys_ctrl ,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900522 .ctrlbit = (1 << 12),
523 }, {
524 .name = "otg",
525 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900526 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900527 .ctrlbit = (1 << 13),
528 }, {
529 .name = "spi",
530 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900531 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900532 .ctrlbit = (1 << 16),
533 }, {
534 .name = "spi",
535 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900536 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900537 .ctrlbit = (1 << 17),
538 }, {
539 .name = "spi",
540 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900541 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900542 .ctrlbit = (1 << 18),
543 }, {
Jassi Brar2d270432010-12-21 09:57:03 +0900544 .name = "iis",
545 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900546 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Brar2d270432010-12-21 09:57:03 +0900547 .ctrlbit = (1 << 19),
548 }, {
549 .name = "iis",
550 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900551 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Brar2d270432010-12-21 09:57:03 +0900552 .ctrlbit = (1 << 20),
553 }, {
554 .name = "iis",
555 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900556 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Brar2d270432010-12-21 09:57:03 +0900557 .ctrlbit = (1 << 21),
558 }, {
Jassi Braraa227552010-12-21 09:54:57 +0900559 .name = "ac97",
560 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900561 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Braraa227552010-12-21 09:54:57 +0900562 .ctrlbit = (1 << 27),
563 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900564 .name = "fimg2d",
565 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900566 .enable = exynos4_clk_ip_image_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900567 .ctrlbit = (1 << 0),
568 }, {
569 .name = "i2c",
570 .id = 0,
571 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900572 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900573 .ctrlbit = (1 << 6),
574 }, {
575 .name = "i2c",
576 .id = 1,
577 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900578 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900579 .ctrlbit = (1 << 7),
580 }, {
581 .name = "i2c",
582 .id = 2,
583 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900584 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900585 .ctrlbit = (1 << 8),
586 }, {
587 .name = "i2c",
588 .id = 3,
589 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900590 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900591 .ctrlbit = (1 << 9),
592 }, {
593 .name = "i2c",
594 .id = 4,
595 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900596 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900597 .ctrlbit = (1 << 10),
598 }, {
599 .name = "i2c",
600 .id = 5,
601 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900602 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900603 .ctrlbit = (1 << 11),
604 }, {
605 .name = "i2c",
606 .id = 6,
607 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900608 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900609 .ctrlbit = (1 << 12),
610 }, {
611 .name = "i2c",
612 .id = 7,
613 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900614 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900615 .ctrlbit = (1 << 13),
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900616 }, {
617 .name = "SYSMMU_MDMA",
618 .id = -1,
619 .enable = exynos4_clk_ip_image_ctrl,
620 .ctrlbit = (1 << 5),
621 }, {
622 .name = "SYSMMU_FIMC0",
623 .id = -1,
624 .enable = exynos4_clk_ip_cam_ctrl,
625 .ctrlbit = (1 << 7),
626 }, {
627 .name = "SYSMMU_FIMC1",
628 .id = -1,
629 .enable = exynos4_clk_ip_cam_ctrl,
630 .ctrlbit = (1 << 8),
631 }, {
632 .name = "SYSMMU_FIMC2",
633 .id = -1,
634 .enable = exynos4_clk_ip_cam_ctrl,
635 .ctrlbit = (1 << 9),
636 }, {
637 .name = "SYSMMU_FIMC3",
638 .id = -1,
639 .enable = exynos4_clk_ip_cam_ctrl,
640 .ctrlbit = (1 << 10),
641 }, {
642 .name = "SYSMMU_JPEG",
643 .id = -1,
644 .enable = exynos4_clk_ip_cam_ctrl,
645 .ctrlbit = (1 << 11),
646 }, {
647 .name = "SYSMMU_FIMD0",
648 .id = -1,
649 .enable = exynos4_clk_ip_lcd0_ctrl,
650 .ctrlbit = (1 << 4),
651 }, {
652 .name = "SYSMMU_FIMD1",
653 .id = -1,
654 .enable = exynos4_clk_ip_lcd1_ctrl,
655 .ctrlbit = (1 << 4),
656 }, {
657 .name = "SYSMMU_PCIe",
658 .id = -1,
659 .enable = exynos4_clk_ip_fsys_ctrl,
660 .ctrlbit = (1 << 18),
661 }, {
662 .name = "SYSMMU_G2D",
663 .id = -1,
664 .enable = exynos4_clk_ip_image_ctrl,
665 .ctrlbit = (1 << 3),
666 }, {
667 .name = "SYSMMU_ROTATOR",
668 .id = -1,
669 .enable = exynos4_clk_ip_image_ctrl,
670 .ctrlbit = (1 << 4),
671 }, {
672 .name = "SYSMMU_TV",
673 .id = -1,
674 .enable = exynos4_clk_ip_tv_ctrl,
675 .ctrlbit = (1 << 4),
676 }, {
677 .name = "SYSMMU_MFC_L",
678 .id = -1,
679 .enable = exynos4_clk_ip_mfc_ctrl,
680 .ctrlbit = (1 << 1),
681 }, {
682 .name = "SYSMMU_MFC_R",
683 .id = -1,
684 .enable = exynos4_clk_ip_mfc_ctrl,
685 .ctrlbit = (1 << 2),
686 }
Changhwan Younc8bef142010-07-27 17:52:39 +0900687};
688
689static struct clk init_clocks[] = {
Jongpill Lee5a847b42010-08-27 16:50:47 +0900690 {
691 .name = "uart",
692 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900693 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900694 .ctrlbit = (1 << 0),
695 }, {
696 .name = "uart",
697 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900698 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900699 .ctrlbit = (1 << 1),
700 }, {
701 .name = "uart",
702 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900703 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900704 .ctrlbit = (1 << 2),
705 }, {
706 .name = "uart",
707 .id = 3,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900708 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900709 .ctrlbit = (1 << 3),
710 }, {
711 .name = "uart",
712 .id = 4,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900713 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900714 .ctrlbit = (1 << 4),
715 }, {
716 .name = "uart",
717 .id = 5,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900718 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900719 .ctrlbit = (1 << 5),
720 }
Changhwan Younc8bef142010-07-27 17:52:39 +0900721};
722
723static struct clk *clkset_group_list[] = {
724 [0] = &clk_ext_xtal_mux,
725 [1] = &clk_xusbxti,
726 [2] = &clk_sclk_hdmi27m,
Jongpill Leeb99380e2010-08-18 22:16:45 +0900727 [3] = &clk_sclk_usbphy0,
728 [4] = &clk_sclk_usbphy1,
729 [5] = &clk_sclk_hdmiphy,
Changhwan Younc8bef142010-07-27 17:52:39 +0900730 [6] = &clk_mout_mpll.clk,
731 [7] = &clk_mout_epll.clk,
732 [8] = &clk_sclk_vpll.clk,
733};
734
735static struct clksrc_sources clkset_group = {
736 .sources = clkset_group_list,
737 .nr_sources = ARRAY_SIZE(clkset_group_list),
738};
739
Jongpill Lee06cba8d2010-08-18 22:51:23 +0900740static struct clk *clkset_mout_g2d0_list[] = {
741 [0] = &clk_mout_mpll.clk,
742 [1] = &clk_sclk_apll.clk,
743};
744
745static struct clksrc_sources clkset_mout_g2d0 = {
746 .sources = clkset_mout_g2d0_list,
747 .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list),
748};
749
750static struct clksrc_clk clk_mout_g2d0 = {
751 .clk = {
752 .name = "mout_g2d0",
753 .id = -1,
754 },
755 .sources = &clkset_mout_g2d0,
756 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
757};
758
759static struct clk *clkset_mout_g2d1_list[] = {
760 [0] = &clk_mout_epll.clk,
761 [1] = &clk_sclk_vpll.clk,
762};
763
764static struct clksrc_sources clkset_mout_g2d1 = {
765 .sources = clkset_mout_g2d1_list,
766 .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list),
767};
768
769static struct clksrc_clk clk_mout_g2d1 = {
770 .clk = {
771 .name = "mout_g2d1",
772 .id = -1,
773 },
774 .sources = &clkset_mout_g2d1,
775 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
776};
777
778static struct clk *clkset_mout_g2d_list[] = {
779 [0] = &clk_mout_g2d0.clk,
780 [1] = &clk_mout_g2d1.clk,
781};
782
783static struct clksrc_sources clkset_mout_g2d = {
784 .sources = clkset_mout_g2d_list,
785 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
786};
787
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900788static struct clksrc_clk clk_dout_mmc0 = {
789 .clk = {
790 .name = "dout_mmc0",
791 .id = -1,
792 },
793 .sources = &clkset_group,
794 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
795 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
796};
797
798static struct clksrc_clk clk_dout_mmc1 = {
799 .clk = {
800 .name = "dout_mmc1",
801 .id = -1,
802 },
803 .sources = &clkset_group,
804 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
805 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
806};
807
808static struct clksrc_clk clk_dout_mmc2 = {
809 .clk = {
810 .name = "dout_mmc2",
811 .id = -1,
812 },
813 .sources = &clkset_group,
814 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
815 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
816};
817
818static struct clksrc_clk clk_dout_mmc3 = {
819 .clk = {
820 .name = "dout_mmc3",
821 .id = -1,
822 },
823 .sources = &clkset_group,
824 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
825 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
826};
827
828static struct clksrc_clk clk_dout_mmc4 = {
829 .clk = {
830 .name = "dout_mmc4",
831 .id = -1,
832 },
833 .sources = &clkset_group,
834 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
835 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
836};
837
Changhwan Younc8bef142010-07-27 17:52:39 +0900838static struct clksrc_clk clksrcs[] = {
839 {
840 .clk = {
841 .name = "uclk1",
842 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900843 .enable = exynos4_clksrc_mask_peril0_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900844 .ctrlbit = (1 << 0),
Changhwan Younc8bef142010-07-27 17:52:39 +0900845 },
846 .sources = &clkset_group,
847 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
848 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
849 }, {
850 .clk = {
851 .name = "uclk1",
852 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900853 .enable = exynos4_clksrc_mask_peril0_ctrl,
Jongpill Lee3297c2e2010-08-27 17:53:26 +0900854 .ctrlbit = (1 << 4),
Changhwan Younc8bef142010-07-27 17:52:39 +0900855 },
856 .sources = &clkset_group,
857 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
858 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
859 }, {
860 .clk = {
861 .name = "uclk1",
862 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900863 .enable = exynos4_clksrc_mask_peril0_ctrl,
Jongpill Lee3297c2e2010-08-27 17:53:26 +0900864 .ctrlbit = (1 << 8),
Changhwan Younc8bef142010-07-27 17:52:39 +0900865 },
866 .sources = &clkset_group,
867 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
868 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
869 }, {
870 .clk = {
871 .name = "uclk1",
872 .id = 3,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900873 .enable = exynos4_clksrc_mask_peril0_ctrl,
Jongpill Lee3297c2e2010-08-27 17:53:26 +0900874 .ctrlbit = (1 << 12),
Changhwan Younc8bef142010-07-27 17:52:39 +0900875 },
876 .sources = &clkset_group,
877 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
878 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
879 }, {
880 .clk = {
881 .name = "sclk_pwm",
882 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900883 .enable = exynos4_clksrc_mask_peril0_ctrl,
Changhwan Younc8bef142010-07-27 17:52:39 +0900884 .ctrlbit = (1 << 24),
885 },
886 .sources = &clkset_group,
887 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
888 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900889 }, {
890 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +0900891 .name = "sclk_csis",
892 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900893 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900894 .ctrlbit = (1 << 24),
895 },
896 .sources = &clkset_group,
897 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
898 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
899 }, {
900 .clk = {
901 .name = "sclk_csis",
902 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900903 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900904 .ctrlbit = (1 << 28),
905 },
906 .sources = &clkset_group,
907 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
908 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
909 }, {
910 .clk = {
911 .name = "sclk_cam",
912 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900913 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900914 .ctrlbit = (1 << 16),
915 },
916 .sources = &clkset_group,
917 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
918 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
919 }, {
920 .clk = {
921 .name = "sclk_cam",
922 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900923 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900924 .ctrlbit = (1 << 20),
925 },
926 .sources = &clkset_group,
927 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
928 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
929 }, {
930 .clk = {
931 .name = "sclk_fimc",
932 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900933 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900934 .ctrlbit = (1 << 0),
935 },
936 .sources = &clkset_group,
937 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
938 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
939 }, {
940 .clk = {
941 .name = "sclk_fimc",
942 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900943 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900944 .ctrlbit = (1 << 4),
945 },
946 .sources = &clkset_group,
947 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
948 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
949 }, {
950 .clk = {
951 .name = "sclk_fimc",
952 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900953 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900954 .ctrlbit = (1 << 8),
955 },
956 .sources = &clkset_group,
957 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
958 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
959 }, {
960 .clk = {
961 .name = "sclk_fimc",
962 .id = 3,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900963 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900964 .ctrlbit = (1 << 12),
965 },
966 .sources = &clkset_group,
967 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
968 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
969 }, {
970 .clk = {
971 .name = "sclk_fimd",
972 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900973 .enable = exynos4_clksrc_mask_lcd0_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900974 .ctrlbit = (1 << 0),
975 },
976 .sources = &clkset_group,
977 .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
978 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
979 }, {
980 .clk = {
981 .name = "sclk_fimd",
982 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900983 .enable = exynos4_clksrc_mask_lcd1_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900984 .ctrlbit = (1 << 0),
985 },
986 .sources = &clkset_group,
987 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 },
988 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 },
989 }, {
990 .clk = {
991 .name = "sclk_sata",
992 .id = -1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900993 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +0900994 .ctrlbit = (1 << 24),
995 },
996 .sources = &clkset_mout_corebus,
997 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 },
998 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 },
999 }, {
1000 .clk = {
1001 .name = "sclk_spi",
1002 .id = 0,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001003 .enable = exynos4_clksrc_mask_peril1_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001004 .ctrlbit = (1 << 16),
1005 },
1006 .sources = &clkset_group,
1007 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1008 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1009 }, {
1010 .clk = {
1011 .name = "sclk_spi",
1012 .id = 1,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001013 .enable = exynos4_clksrc_mask_peril1_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001014 .ctrlbit = (1 << 20),
1015 },
1016 .sources = &clkset_group,
1017 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1018 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1019 }, {
1020 .clk = {
1021 .name = "sclk_spi",
1022 .id = 2,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001023 .enable = exynos4_clksrc_mask_peril1_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001024 .ctrlbit = (1 << 24),
1025 },
1026 .sources = &clkset_group,
1027 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1028 .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1029 }, {
1030 .clk = {
1031 .name = "sclk_fimg2d",
1032 .id = -1,
1033 },
1034 .sources = &clkset_mout_g2d,
1035 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1036 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1037 }, {
1038 .clk = {
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001039 .name = "sclk_mmc",
1040 .id = 0,
1041 .parent = &clk_dout_mmc0.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001042 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001043 .ctrlbit = (1 << 0),
1044 },
1045 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1046 }, {
1047 .clk = {
1048 .name = "sclk_mmc",
1049 .id = 1,
1050 .parent = &clk_dout_mmc1.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001051 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001052 .ctrlbit = (1 << 4),
1053 },
1054 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1055 }, {
1056 .clk = {
1057 .name = "sclk_mmc",
1058 .id = 2,
1059 .parent = &clk_dout_mmc2.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001060 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001061 .ctrlbit = (1 << 8),
1062 },
1063 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1064 }, {
1065 .clk = {
1066 .name = "sclk_mmc",
1067 .id = 3,
1068 .parent = &clk_dout_mmc3.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001069 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001070 .ctrlbit = (1 << 12),
1071 },
1072 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1073 }, {
1074 .clk = {
1075 .name = "sclk_mmc",
1076 .id = 4,
1077 .parent = &clk_dout_mmc4.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001078 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001079 .ctrlbit = (1 << 16),
1080 },
1081 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1082 }
Changhwan Younc8bef142010-07-27 17:52:39 +09001083};
1084
1085/* Clock initialization code */
1086static struct clksrc_clk *sysclks[] = {
1087 &clk_mout_apll,
Jongpill Lee3ff31022010-08-18 22:20:31 +09001088 &clk_sclk_apll,
Changhwan Younc8bef142010-07-27 17:52:39 +09001089 &clk_mout_epll,
1090 &clk_mout_mpll,
1091 &clk_moutcore,
1092 &clk_coreclk,
1093 &clk_armclk,
1094 &clk_aclk_corem0,
1095 &clk_aclk_cores,
1096 &clk_aclk_corem1,
1097 &clk_periphclk,
Changhwan Younc8bef142010-07-27 17:52:39 +09001098 &clk_mout_corebus,
1099 &clk_sclk_dmc,
1100 &clk_aclk_cored,
1101 &clk_aclk_corep,
1102 &clk_aclk_acp,
1103 &clk_pclk_acp,
1104 &clk_vpllsrc,
1105 &clk_sclk_vpll,
1106 &clk_aclk_200,
1107 &clk_aclk_100,
1108 &clk_aclk_160,
1109 &clk_aclk_133,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001110 &clk_dout_mmc0,
1111 &clk_dout_mmc1,
1112 &clk_dout_mmc2,
1113 &clk_dout_mmc3,
1114 &clk_dout_mmc4,
Changhwan Younc8bef142010-07-27 17:52:39 +09001115};
1116
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001117static int xtal_rate;
1118
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001119static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001120{
1121 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508);
1122}
1123
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001124static struct clk_ops exynos4_fout_apll_ops = {
1125 .get_rate = exynos4_fout_apll_get_rate,
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001126};
1127
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001128void __init_or_cpufreq exynos4_setup_clocks(void)
Changhwan Younc8bef142010-07-27 17:52:39 +09001129{
1130 struct clk *xtal_clk;
1131 unsigned long apll;
1132 unsigned long mpll;
1133 unsigned long epll;
1134 unsigned long vpll;
1135 unsigned long vpllsrc;
1136 unsigned long xtal;
1137 unsigned long armclk;
Changhwan Younc8bef142010-07-27 17:52:39 +09001138 unsigned long sclk_dmc;
Jongpill Lee228ef982010-08-18 22:24:53 +09001139 unsigned long aclk_200;
1140 unsigned long aclk_100;
1141 unsigned long aclk_160;
1142 unsigned long aclk_133;
Changhwan Younc8bef142010-07-27 17:52:39 +09001143 unsigned int ptr;
1144
1145 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1146
1147 xtal_clk = clk_get(NULL, "xtal");
1148 BUG_ON(IS_ERR(xtal_clk));
1149
1150 xtal = clk_get_rate(xtal_clk);
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001151
1152 xtal_rate = xtal;
1153
Changhwan Younc8bef142010-07-27 17:52:39 +09001154 clk_put(xtal_clk);
1155
1156 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1157
1158 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0), pll_4508);
1159 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0), pll_4508);
1160 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
Jongpill Lee4d235f792010-08-18 22:13:49 +09001161 __raw_readl(S5P_EPLL_CON1), pll_4600);
Changhwan Younc8bef142010-07-27 17:52:39 +09001162
1163 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1164 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
Jongpill Lee4d235f792010-08-18 22:13:49 +09001165 __raw_readl(S5P_VPLL_CON1), pll_4650);
Changhwan Younc8bef142010-07-27 17:52:39 +09001166
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001167 clk_fout_apll.ops = &exynos4_fout_apll_ops;
Changhwan Younc8bef142010-07-27 17:52:39 +09001168 clk_fout_mpll.rate = mpll;
1169 clk_fout_epll.rate = epll;
1170 clk_fout_vpll.rate = vpll;
1171
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001172 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
Changhwan Younc8bef142010-07-27 17:52:39 +09001173 apll, mpll, epll, vpll);
1174
1175 armclk = clk_get_rate(&clk_armclk.clk);
Changhwan Younc8bef142010-07-27 17:52:39 +09001176 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
Changhwan Younc8bef142010-07-27 17:52:39 +09001177
Jongpill Lee228ef982010-08-18 22:24:53 +09001178 aclk_200 = clk_get_rate(&clk_aclk_200.clk);
1179 aclk_100 = clk_get_rate(&clk_aclk_100.clk);
1180 aclk_160 = clk_get_rate(&clk_aclk_160.clk);
1181 aclk_133 = clk_get_rate(&clk_aclk_133.clk);
1182
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001183 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
Jongpill Lee228ef982010-08-18 22:24:53 +09001184 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1185 armclk, sclk_dmc, aclk_200,
1186 aclk_100, aclk_160, aclk_133);
Changhwan Younc8bef142010-07-27 17:52:39 +09001187
1188 clk_f.rate = armclk;
1189 clk_h.rate = sclk_dmc;
Jongpill Lee228ef982010-08-18 22:24:53 +09001190 clk_p.rate = aclk_100;
Changhwan Younc8bef142010-07-27 17:52:39 +09001191
1192 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1193 s3c_set_clksrc(&clksrcs[ptr], true);
1194}
1195
1196static struct clk *clks[] __initdata = {
1197 /* Nothing here yet */
1198};
1199
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001200void __init exynos4_register_clocks(void)
Changhwan Younc8bef142010-07-27 17:52:39 +09001201{
Changhwan Younc8bef142010-07-27 17:52:39 +09001202 int ptr;
1203
Kukjin Kim957c4612011-01-04 17:58:22 +09001204 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
Changhwan Younc8bef142010-07-27 17:52:39 +09001205
1206 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1207 s3c_register_clksrc(sysclks[ptr], 1);
1208
1209 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1210 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1211
Kukjin Kim957c4612011-01-04 17:58:22 +09001212 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1213 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
Changhwan Younc8bef142010-07-27 17:52:39 +09001214
1215 s3c_pwmclk_init();
1216}