blob: 962c95e00c002424e7ac8e36a0539fd57aa09f79 [file] [log] [blame]
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001/*
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09002 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
Changhwan Younc8bef142010-07-27 17:52:39 +09004 *
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09005 * EXYNOS4 - Clock support
Changhwan Younc8bef142010-07-27 17:52:39 +09006 *
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.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
Jonghwan Choiacd35612011-08-24 21:52:45 +090015#include <linux/syscore_ops.h>
Changhwan Younc8bef142010-07-27 17:52:39 +090016
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>
Jonghwan Choiacd35612011-08-24 21:52:45 +090023#include <plat/pm.h>
Changhwan Younc8bef142010-07-27 17:52:39 +090024
25#include <mach/map.h>
26#include <mach/regs-clock.h>
KyongHo Chob0b6ff02011-03-07 09:10:24 +090027#include <mach/sysmmu.h>
Changhwan Younc8bef142010-07-27 17:52:39 +090028
Kukjin Kimcc511b82011-12-27 08:18:36 +010029#include "common.h"
Kukjin Kimce9c00e2012-03-09 13:51:24 -080030#include "clock-exynos4.h"
Kukjin Kimcc511b82011-12-27 08:18:36 +010031
Kukjin Kim7cdf04d2012-01-27 14:56:17 +090032#ifdef CONFIG_PM_SLEEP
Jonghwan Choiacd35612011-08-24 21:52:45 +090033static struct sleep_save exynos4_clock_save[] = {
34 SAVE_ITEM(S5P_CLKDIV_LEFTBUS),
35 SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS),
36 SAVE_ITEM(S5P_CLKDIV_RIGHTBUS),
37 SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS),
38 SAVE_ITEM(S5P_CLKSRC_TOP0),
39 SAVE_ITEM(S5P_CLKSRC_TOP1),
40 SAVE_ITEM(S5P_CLKSRC_CAM),
41 SAVE_ITEM(S5P_CLKSRC_TV),
42 SAVE_ITEM(S5P_CLKSRC_MFC),
43 SAVE_ITEM(S5P_CLKSRC_G3D),
44 SAVE_ITEM(S5P_CLKSRC_LCD0),
45 SAVE_ITEM(S5P_CLKSRC_MAUDIO),
46 SAVE_ITEM(S5P_CLKSRC_FSYS),
47 SAVE_ITEM(S5P_CLKSRC_PERIL0),
48 SAVE_ITEM(S5P_CLKSRC_PERIL1),
49 SAVE_ITEM(S5P_CLKDIV_CAM),
50 SAVE_ITEM(S5P_CLKDIV_TV),
51 SAVE_ITEM(S5P_CLKDIV_MFC),
52 SAVE_ITEM(S5P_CLKDIV_G3D),
53 SAVE_ITEM(S5P_CLKDIV_LCD0),
54 SAVE_ITEM(S5P_CLKDIV_MAUDIO),
55 SAVE_ITEM(S5P_CLKDIV_FSYS0),
56 SAVE_ITEM(S5P_CLKDIV_FSYS1),
57 SAVE_ITEM(S5P_CLKDIV_FSYS2),
58 SAVE_ITEM(S5P_CLKDIV_FSYS3),
59 SAVE_ITEM(S5P_CLKDIV_PERIL0),
60 SAVE_ITEM(S5P_CLKDIV_PERIL1),
61 SAVE_ITEM(S5P_CLKDIV_PERIL2),
62 SAVE_ITEM(S5P_CLKDIV_PERIL3),
63 SAVE_ITEM(S5P_CLKDIV_PERIL4),
64 SAVE_ITEM(S5P_CLKDIV_PERIL5),
65 SAVE_ITEM(S5P_CLKDIV_TOP),
66 SAVE_ITEM(S5P_CLKSRC_MASK_TOP),
67 SAVE_ITEM(S5P_CLKSRC_MASK_CAM),
68 SAVE_ITEM(S5P_CLKSRC_MASK_TV),
69 SAVE_ITEM(S5P_CLKSRC_MASK_LCD0),
70 SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO),
71 SAVE_ITEM(S5P_CLKSRC_MASK_FSYS),
72 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0),
73 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1),
74 SAVE_ITEM(S5P_CLKDIV2_RATIO),
75 SAVE_ITEM(S5P_CLKGATE_SCLKCAM),
76 SAVE_ITEM(S5P_CLKGATE_IP_CAM),
77 SAVE_ITEM(S5P_CLKGATE_IP_TV),
78 SAVE_ITEM(S5P_CLKGATE_IP_MFC),
79 SAVE_ITEM(S5P_CLKGATE_IP_G3D),
80 SAVE_ITEM(S5P_CLKGATE_IP_LCD0),
81 SAVE_ITEM(S5P_CLKGATE_IP_FSYS),
82 SAVE_ITEM(S5P_CLKGATE_IP_GPS),
83 SAVE_ITEM(S5P_CLKGATE_IP_PERIL),
84 SAVE_ITEM(S5P_CLKGATE_BLOCK),
85 SAVE_ITEM(S5P_CLKSRC_MASK_DMC),
86 SAVE_ITEM(S5P_CLKSRC_DMC),
87 SAVE_ITEM(S5P_CLKDIV_DMC0),
88 SAVE_ITEM(S5P_CLKDIV_DMC1),
89 SAVE_ITEM(S5P_CLKGATE_IP_DMC),
90 SAVE_ITEM(S5P_CLKSRC_CPU),
91 SAVE_ITEM(S5P_CLKDIV_CPU),
92 SAVE_ITEM(S5P_CLKDIV_CPU + 0x4),
93 SAVE_ITEM(S5P_CLKGATE_SCLKCPU),
94 SAVE_ITEM(S5P_CLKGATE_IP_CPU),
95};
Kukjin Kim7cdf04d2012-01-27 14:56:17 +090096#endif
Jonghwan Choiacd35612011-08-24 21:52:45 +090097
Kukjin Kim2bc02c02011-08-24 17:25:09 +090098struct clk clk_sclk_hdmi27m = {
Changhwan Younc8bef142010-07-27 17:52:39 +090099 .name = "sclk_hdmi27m",
Changhwan Younc8bef142010-07-27 17:52:39 +0900100 .rate = 27000000,
101};
102
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900103struct clk clk_sclk_hdmiphy = {
Jongpill Leeb99380e2010-08-18 22:16:45 +0900104 .name = "sclk_hdmiphy",
Jongpill Leeb99380e2010-08-18 22:16:45 +0900105};
106
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900107struct clk clk_sclk_usbphy0 = {
Jongpill Leeb99380e2010-08-18 22:16:45 +0900108 .name = "sclk_usbphy0",
Jongpill Leeb99380e2010-08-18 22:16:45 +0900109 .rate = 27000000,
110};
111
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900112struct clk clk_sclk_usbphy1 = {
Jongpill Leeb99380e2010-08-18 22:16:45 +0900113 .name = "sclk_usbphy1",
Jongpill Leeb99380e2010-08-18 22:16:45 +0900114};
115
Boojin Kimbf856fb2011-09-02 09:44:36 +0900116static struct clk dummy_apb_pclk = {
117 .name = "apb_pclk",
118 .id = -1,
119};
120
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900121static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
Jongpill Lee37e01722010-08-18 22:33:43 +0900122{
123 return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
124}
125
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900126static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +0900127{
128 return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
129}
130
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900131static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +0900132{
133 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
134}
135
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900136int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900137{
138 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
139}
140
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900141static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
Jongpill Lee3297c2e2010-08-27 17:53:26 +0900142{
143 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
144}
145
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900146static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
Jongpill Lee33f469d2010-08-18 22:54:48 +0900147{
148 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
149}
150
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900151static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
152{
153 return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
154}
155
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +0900156static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
157{
158 return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
159}
160
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900161static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900162{
163 return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
164}
165
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900166static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
167{
168 return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
169}
170
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900171static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900172{
173 return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
174}
175
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900176static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900177{
178 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
179}
180
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900181int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900182{
183 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
184}
185
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900186int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900187{
188 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
189}
190
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900191static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
Jongpill Lee5a847b42010-08-27 16:50:47 +0900192{
193 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
194}
195
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900196static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
Jongpill Lee82260bf2010-08-18 22:49:24 +0900197{
198 return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
199}
200
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +0900201static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
202{
203 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
204}
205
206static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
207{
208 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
209}
210
Changhwan Younc8bef142010-07-27 17:52:39 +0900211/* Core list of CMU_CPU side */
212
213static struct clksrc_clk clk_mout_apll = {
214 .clk = {
215 .name = "mout_apll",
Changhwan Younc8bef142010-07-27 17:52:39 +0900216 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800217 .sources = &clk_src_apll,
218 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
Jongpill Lee3ff31022010-08-18 22:20:31 +0900219};
220
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900221struct clksrc_clk clk_sclk_apll = {
Jongpill Lee3ff31022010-08-18 22:20:31 +0900222 .clk = {
223 .name = "sclk_apll",
Jongpill Lee3ff31022010-08-18 22:20:31 +0900224 .parent = &clk_mout_apll.clk,
225 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800226 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900227};
228
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900229struct clksrc_clk clk_mout_epll = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900230 .clk = {
231 .name = "mout_epll",
Changhwan Younc8bef142010-07-27 17:52:39 +0900232 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800233 .sources = &clk_src_epll,
234 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900235};
236
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900237struct clksrc_clk clk_mout_mpll = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800238 .clk = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900239 .name = "mout_mpll",
Changhwan Younc8bef142010-07-27 17:52:39 +0900240 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800241 .sources = &clk_src_mpll,
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900242
243 /* reg_src will be added in each SoCs' clock */
Changhwan Younc8bef142010-07-27 17:52:39 +0900244};
245
246static struct clk *clkset_moutcore_list[] = {
Jaecheol Lee8f3b9cf2010-09-18 10:50:46 +0900247 [0] = &clk_mout_apll.clk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900248 [1] = &clk_mout_mpll.clk,
249};
250
251static struct clksrc_sources clkset_moutcore = {
252 .sources = clkset_moutcore_list,
253 .nr_sources = ARRAY_SIZE(clkset_moutcore_list),
254};
255
256static struct clksrc_clk clk_moutcore = {
257 .clk = {
258 .name = "moutcore",
Changhwan Younc8bef142010-07-27 17:52:39 +0900259 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800260 .sources = &clkset_moutcore,
261 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900262};
263
264static struct clksrc_clk clk_coreclk = {
265 .clk = {
266 .name = "core_clk",
Changhwan Younc8bef142010-07-27 17:52:39 +0900267 .parent = &clk_moutcore.clk,
268 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800269 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900270};
271
272static struct clksrc_clk clk_armclk = {
273 .clk = {
274 .name = "armclk",
Changhwan Younc8bef142010-07-27 17:52:39 +0900275 .parent = &clk_coreclk.clk,
276 },
277};
278
279static struct clksrc_clk clk_aclk_corem0 = {
280 .clk = {
281 .name = "aclk_corem0",
Changhwan Younc8bef142010-07-27 17:52:39 +0900282 .parent = &clk_coreclk.clk,
283 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800284 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900285};
286
287static struct clksrc_clk clk_aclk_cores = {
288 .clk = {
289 .name = "aclk_cores",
Changhwan Younc8bef142010-07-27 17:52:39 +0900290 .parent = &clk_coreclk.clk,
291 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800292 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900293};
294
295static struct clksrc_clk clk_aclk_corem1 = {
296 .clk = {
297 .name = "aclk_corem1",
Changhwan Younc8bef142010-07-27 17:52:39 +0900298 .parent = &clk_coreclk.clk,
299 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800300 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900301};
302
303static struct clksrc_clk clk_periphclk = {
304 .clk = {
305 .name = "periphclk",
Changhwan Younc8bef142010-07-27 17:52:39 +0900306 .parent = &clk_coreclk.clk,
307 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800308 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900309};
310
Changhwan Younc8bef142010-07-27 17:52:39 +0900311/* Core list of CMU_CORE side */
312
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900313struct clk *clkset_corebus_list[] = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900314 [0] = &clk_mout_mpll.clk,
Jongpill Lee3ff31022010-08-18 22:20:31 +0900315 [1] = &clk_sclk_apll.clk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900316};
317
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900318struct clksrc_sources clkset_mout_corebus = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900319 .sources = clkset_corebus_list,
320 .nr_sources = ARRAY_SIZE(clkset_corebus_list),
321};
322
323static struct clksrc_clk clk_mout_corebus = {
324 .clk = {
325 .name = "mout_corebus",
Changhwan Younc8bef142010-07-27 17:52:39 +0900326 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800327 .sources = &clkset_mout_corebus,
328 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900329};
330
331static struct clksrc_clk clk_sclk_dmc = {
332 .clk = {
333 .name = "sclk_dmc",
Changhwan Younc8bef142010-07-27 17:52:39 +0900334 .parent = &clk_mout_corebus.clk,
335 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800336 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900337};
338
339static struct clksrc_clk clk_aclk_cored = {
340 .clk = {
341 .name = "aclk_cored",
Changhwan Younc8bef142010-07-27 17:52:39 +0900342 .parent = &clk_sclk_dmc.clk,
343 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800344 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900345};
346
347static struct clksrc_clk clk_aclk_corep = {
348 .clk = {
349 .name = "aclk_corep",
Changhwan Younc8bef142010-07-27 17:52:39 +0900350 .parent = &clk_aclk_cored.clk,
351 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800352 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900353};
354
355static struct clksrc_clk clk_aclk_acp = {
356 .clk = {
357 .name = "aclk_acp",
Changhwan Younc8bef142010-07-27 17:52:39 +0900358 .parent = &clk_mout_corebus.clk,
359 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800360 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900361};
362
363static struct clksrc_clk clk_pclk_acp = {
364 .clk = {
365 .name = "pclk_acp",
Changhwan Younc8bef142010-07-27 17:52:39 +0900366 .parent = &clk_aclk_acp.clk,
367 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800368 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900369};
370
371/* Core list of CMU_TOP side */
372
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900373struct clk *clkset_aclk_top_list[] = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900374 [0] = &clk_mout_mpll.clk,
Jongpill Lee3ff31022010-08-18 22:20:31 +0900375 [1] = &clk_sclk_apll.clk,
Changhwan Younc8bef142010-07-27 17:52:39 +0900376};
377
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900378struct clksrc_sources clkset_aclk = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900379 .sources = clkset_aclk_top_list,
380 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
381};
382
383static struct clksrc_clk clk_aclk_200 = {
384 .clk = {
385 .name = "aclk_200",
Changhwan Younc8bef142010-07-27 17:52:39 +0900386 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800387 .sources = &clkset_aclk,
388 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
389 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900390};
391
Changhwan Younc8bef142010-07-27 17:52:39 +0900392static struct clksrc_clk clk_aclk_100 = {
393 .clk = {
394 .name = "aclk_100",
Changhwan Younc8bef142010-07-27 17:52:39 +0900395 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800396 .sources = &clkset_aclk,
397 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
398 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900399};
400
Changhwan Younc8bef142010-07-27 17:52:39 +0900401static struct clksrc_clk clk_aclk_160 = {
402 .clk = {
403 .name = "aclk_160",
Changhwan Younc8bef142010-07-27 17:52:39 +0900404 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800405 .sources = &clkset_aclk,
406 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
407 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900408};
409
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900410struct clksrc_clk clk_aclk_133 = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900411 .clk = {
412 .name = "aclk_133",
Changhwan Younc8bef142010-07-27 17:52:39 +0900413 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800414 .sources = &clkset_aclk,
415 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
416 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900417};
418
419static struct clk *clkset_vpllsrc_list[] = {
420 [0] = &clk_fin_vpll,
421 [1] = &clk_sclk_hdmi27m,
422};
423
424static struct clksrc_sources clkset_vpllsrc = {
425 .sources = clkset_vpllsrc_list,
426 .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
427};
428
429static struct clksrc_clk clk_vpllsrc = {
430 .clk = {
431 .name = "vpll_src",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900432 .enable = exynos4_clksrc_mask_top_ctrl,
Jongpill Lee37e01722010-08-18 22:33:43 +0900433 .ctrlbit = (1 << 0),
Changhwan Younc8bef142010-07-27 17:52:39 +0900434 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800435 .sources = &clkset_vpllsrc,
436 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900437};
438
439static struct clk *clkset_sclk_vpll_list[] = {
440 [0] = &clk_vpllsrc.clk,
441 [1] = &clk_fout_vpll,
442};
443
444static struct clksrc_sources clkset_sclk_vpll = {
445 .sources = clkset_sclk_vpll_list,
446 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
447};
448
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900449struct clksrc_clk clk_sclk_vpll = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900450 .clk = {
451 .name = "sclk_vpll",
Changhwan Younc8bef142010-07-27 17:52:39 +0900452 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800453 .sources = &clkset_sclk_vpll,
454 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
Changhwan Younc8bef142010-07-27 17:52:39 +0900455};
456
Kukjin Kim957c4612011-01-04 17:58:22 +0900457static struct clk init_clocks_off[] = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900458 {
459 .name = "timers",
Changhwan Younc8bef142010-07-27 17:52:39 +0900460 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900461 .enable = exynos4_clk_ip_peril_ctrl,
Changhwan Younc8bef142010-07-27 17:52:39 +0900462 .ctrlbit = (1<<24),
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900463 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900464 .name = "csis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900465 .devname = "s5p-mipi-csis.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900466 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900467 .ctrlbit = (1 << 4),
468 }, {
469 .name = "csis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900470 .devname = "s5p-mipi-csis.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900471 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900472 .ctrlbit = (1 << 5),
473 }, {
474 .name = "fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900475 .devname = "exynos4-fimc.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900476 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900477 .ctrlbit = (1 << 0),
478 }, {
479 .name = "fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900480 .devname = "exynos4-fimc.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900481 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900482 .ctrlbit = (1 << 1),
483 }, {
484 .name = "fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900485 .devname = "exynos4-fimc.2",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900486 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900487 .ctrlbit = (1 << 2),
488 }, {
489 .name = "fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900490 .devname = "exynos4-fimc.3",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900491 .enable = exynos4_clk_ip_cam_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900492 .ctrlbit = (1 << 3),
493 }, {
494 .name = "fimd",
Jingoo Han268a7ef2011-07-21 15:42:38 +0900495 .devname = "exynos4-fb.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900496 .enable = exynos4_clk_ip_lcd0_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900497 .ctrlbit = (1 << 0),
498 }, {
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900499 .name = "hsmmc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900500 .devname = "s3c-sdhci.0",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900501 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900502 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900503 .ctrlbit = (1 << 5),
504 }, {
505 .name = "hsmmc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900506 .devname = "s3c-sdhci.1",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900507 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900508 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900509 .ctrlbit = (1 << 6),
510 }, {
511 .name = "hsmmc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900512 .devname = "s3c-sdhci.2",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900513 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900514 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900515 .ctrlbit = (1 << 7),
516 }, {
517 .name = "hsmmc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900518 .devname = "s3c-sdhci.3",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900519 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900520 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900521 .ctrlbit = (1 << 8),
522 }, {
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900523 .name = "dwmmc",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900524 .parent = &clk_aclk_133.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900525 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900526 .ctrlbit = (1 << 9),
Jongpill Lee82260bf2010-08-18 22:49:24 +0900527 }, {
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +0900528 .name = "dac",
529 .devname = "s5p-sdo",
530 .enable = exynos4_clk_ip_tv_ctrl,
531 .ctrlbit = (1 << 2),
532 }, {
533 .name = "mixer",
534 .devname = "s5p-mixer",
535 .enable = exynos4_clk_ip_tv_ctrl,
536 .ctrlbit = (1 << 1),
537 }, {
538 .name = "vp",
539 .devname = "s5p-mixer",
540 .enable = exynos4_clk_ip_tv_ctrl,
541 .ctrlbit = (1 << 0),
542 }, {
543 .name = "hdmi",
544 .devname = "exynos4-hdmi",
545 .enable = exynos4_clk_ip_tv_ctrl,
546 .ctrlbit = (1 << 3),
547 }, {
548 .name = "hdmiphy",
549 .devname = "exynos4-hdmi",
550 .enable = exynos4_clk_hdmiphy_ctrl,
551 .ctrlbit = (1 << 0),
552 }, {
553 .name = "dacphy",
554 .devname = "s5p-sdo",
555 .enable = exynos4_clk_dac_ctrl,
556 .ctrlbit = (1 << 0),
557 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900558 .name = "adc",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900559 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900560 .ctrlbit = (1 << 15),
561 }, {
Naveen Krishna Chf9d7bcb2011-02-22 17:13:42 +0900562 .name = "keypad",
Naveen Krishna Chf9d7bcb2011-02-22 17:13:42 +0900563 .enable = exynos4_clk_ip_perir_ctrl,
564 .ctrlbit = (1 << 16),
565 }, {
Changhwan Youncdff6e62010-09-20 15:25:51 +0900566 .name = "rtc",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900567 .enable = exynos4_clk_ip_perir_ctrl,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900568 .ctrlbit = (1 << 15),
569 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900570 .name = "watchdog",
Inderpal Singhf5fb4a22011-03-08 07:13:45 +0900571 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900572 .enable = exynos4_clk_ip_perir_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900573 .ctrlbit = (1 << 14),
574 }, {
575 .name = "usbhost",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900576 .enable = exynos4_clk_ip_fsys_ctrl ,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900577 .ctrlbit = (1 << 12),
578 }, {
579 .name = "otg",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900580 .enable = exynos4_clk_ip_fsys_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900581 .ctrlbit = (1 << 13),
582 }, {
583 .name = "spi",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900584 .devname = "s3c64xx-spi.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900585 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900586 .ctrlbit = (1 << 16),
587 }, {
588 .name = "spi",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900589 .devname = "s3c64xx-spi.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900590 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900591 .ctrlbit = (1 << 17),
592 }, {
593 .name = "spi",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900594 .devname = "s3c64xx-spi.2",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900595 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900596 .ctrlbit = (1 << 18),
597 }, {
Jassi Brar2d270432010-12-21 09:57:03 +0900598 .name = "iis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900599 .devname = "samsung-i2s.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900600 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Brar2d270432010-12-21 09:57:03 +0900601 .ctrlbit = (1 << 19),
602 }, {
603 .name = "iis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900604 .devname = "samsung-i2s.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900605 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Brar2d270432010-12-21 09:57:03 +0900606 .ctrlbit = (1 << 20),
607 }, {
608 .name = "iis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900609 .devname = "samsung-i2s.2",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900610 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Brar2d270432010-12-21 09:57:03 +0900611 .ctrlbit = (1 << 21),
612 }, {
Jassi Braraa227552010-12-21 09:54:57 +0900613 .name = "ac97",
Jonghwan Choiaf8a9f62011-08-12 18:15:42 +0900614 .devname = "samsung-ac97",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900615 .enable = exynos4_clk_ip_peril_ctrl,
Jassi Braraa227552010-12-21 09:54:57 +0900616 .ctrlbit = (1 << 27),
617 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900618 .name = "fimg2d",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900619 .enable = exynos4_clk_ip_image_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900620 .ctrlbit = (1 << 0),
621 }, {
Kamil Debski0f75a962011-07-21 16:42:30 +0900622 .name = "mfc",
623 .devname = "s5p-mfc",
624 .enable = exynos4_clk_ip_mfc_ctrl,
625 .ctrlbit = (1 << 0),
626 }, {
Jongpill Lee82260bf2010-08-18 22:49:24 +0900627 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900628 .devname = "s3c2440-i2c.0",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900629 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900630 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900631 .ctrlbit = (1 << 6),
632 }, {
633 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900634 .devname = "s3c2440-i2c.1",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900635 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900636 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900637 .ctrlbit = (1 << 7),
638 }, {
639 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900640 .devname = "s3c2440-i2c.2",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900641 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900642 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900643 .ctrlbit = (1 << 8),
644 }, {
645 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900646 .devname = "s3c2440-i2c.3",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900647 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900648 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900649 .ctrlbit = (1 << 9),
650 }, {
651 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900652 .devname = "s3c2440-i2c.4",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900653 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900654 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900655 .ctrlbit = (1 << 10),
656 }, {
657 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900658 .devname = "s3c2440-i2c.5",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900659 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900660 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900661 .ctrlbit = (1 << 11),
662 }, {
663 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900664 .devname = "s3c2440-i2c.6",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900665 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900666 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900667 .ctrlbit = (1 << 12),
668 }, {
669 .name = "i2c",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900670 .devname = "s3c2440-i2c.7",
Jongpill Lee82260bf2010-08-18 22:49:24 +0900671 .parent = &clk_aclk_100.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900672 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee82260bf2010-08-18 22:49:24 +0900673 .ctrlbit = (1 << 13),
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900674 }, {
Tomasz Stanislawskic40e7e02011-09-16 18:44:36 +0900675 .name = "i2c",
676 .devname = "s3c2440-hdmiphy-i2c",
677 .parent = &clk_aclk_100.clk,
678 .enable = exynos4_clk_ip_peril_ctrl,
679 .ctrlbit = (1 << 14),
680 }, {
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900681 .name = "SYSMMU_MDMA",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900682 .enable = exynos4_clk_ip_image_ctrl,
683 .ctrlbit = (1 << 5),
684 }, {
685 .name = "SYSMMU_FIMC0",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900686 .enable = exynos4_clk_ip_cam_ctrl,
687 .ctrlbit = (1 << 7),
688 }, {
689 .name = "SYSMMU_FIMC1",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900690 .enable = exynos4_clk_ip_cam_ctrl,
691 .ctrlbit = (1 << 8),
692 }, {
693 .name = "SYSMMU_FIMC2",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900694 .enable = exynos4_clk_ip_cam_ctrl,
695 .ctrlbit = (1 << 9),
696 }, {
697 .name = "SYSMMU_FIMC3",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900698 .enable = exynos4_clk_ip_cam_ctrl,
699 .ctrlbit = (1 << 10),
700 }, {
701 .name = "SYSMMU_JPEG",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900702 .enable = exynos4_clk_ip_cam_ctrl,
703 .ctrlbit = (1 << 11),
704 }, {
705 .name = "SYSMMU_FIMD0",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900706 .enable = exynos4_clk_ip_lcd0_ctrl,
707 .ctrlbit = (1 << 4),
708 }, {
709 .name = "SYSMMU_FIMD1",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900710 .enable = exynos4_clk_ip_lcd1_ctrl,
711 .ctrlbit = (1 << 4),
712 }, {
713 .name = "SYSMMU_PCIe",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900714 .enable = exynos4_clk_ip_fsys_ctrl,
715 .ctrlbit = (1 << 18),
716 }, {
717 .name = "SYSMMU_G2D",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900718 .enable = exynos4_clk_ip_image_ctrl,
719 .ctrlbit = (1 << 3),
720 }, {
721 .name = "SYSMMU_ROTATOR",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900722 .enable = exynos4_clk_ip_image_ctrl,
723 .ctrlbit = (1 << 4),
724 }, {
725 .name = "SYSMMU_TV",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900726 .enable = exynos4_clk_ip_tv_ctrl,
727 .ctrlbit = (1 << 4),
728 }, {
729 .name = "SYSMMU_MFC_L",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900730 .enable = exynos4_clk_ip_mfc_ctrl,
731 .ctrlbit = (1 << 1),
732 }, {
733 .name = "SYSMMU_MFC_R",
KyongHo Chob0b6ff02011-03-07 09:10:24 +0900734 .enable = exynos4_clk_ip_mfc_ctrl,
735 .ctrlbit = (1 << 2),
736 }
Changhwan Younc8bef142010-07-27 17:52:39 +0900737};
738
739static struct clk init_clocks[] = {
Jongpill Lee5a847b42010-08-27 16:50:47 +0900740 {
741 .name = "uart",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900742 .devname = "s5pv210-uart.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900743 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900744 .ctrlbit = (1 << 0),
745 }, {
746 .name = "uart",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900747 .devname = "s5pv210-uart.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900748 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900749 .ctrlbit = (1 << 1),
750 }, {
751 .name = "uart",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900752 .devname = "s5pv210-uart.2",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900753 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900754 .ctrlbit = (1 << 2),
755 }, {
756 .name = "uart",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900757 .devname = "s5pv210-uart.3",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900758 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900759 .ctrlbit = (1 << 3),
760 }, {
761 .name = "uart",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900762 .devname = "s5pv210-uart.4",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900763 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900764 .ctrlbit = (1 << 4),
765 }, {
766 .name = "uart",
Thomas Abrahambadc4f22011-06-14 19:12:27 +0900767 .devname = "s5pv210-uart.5",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +0900768 .enable = exynos4_clk_ip_peril_ctrl,
Jongpill Lee5a847b42010-08-27 16:50:47 +0900769 .ctrlbit = (1 << 5),
770 }
Changhwan Younc8bef142010-07-27 17:52:39 +0900771};
772
Thomas Abraham66fdb292011-10-24 14:01:03 +0200773static struct clk clk_pdma0 = {
774 .name = "dma",
775 .devname = "dma-pl330.0",
776 .enable = exynos4_clk_ip_fsys_ctrl,
777 .ctrlbit = (1 << 0),
778};
779
780static struct clk clk_pdma1 = {
781 .name = "dma",
782 .devname = "dma-pl330.1",
783 .enable = exynos4_clk_ip_fsys_ctrl,
784 .ctrlbit = (1 << 1),
785};
786
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900787struct clk *clkset_group_list[] = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900788 [0] = &clk_ext_xtal_mux,
789 [1] = &clk_xusbxti,
790 [2] = &clk_sclk_hdmi27m,
Jongpill Leeb99380e2010-08-18 22:16:45 +0900791 [3] = &clk_sclk_usbphy0,
792 [4] = &clk_sclk_usbphy1,
793 [5] = &clk_sclk_hdmiphy,
Changhwan Younc8bef142010-07-27 17:52:39 +0900794 [6] = &clk_mout_mpll.clk,
795 [7] = &clk_mout_epll.clk,
796 [8] = &clk_sclk_vpll.clk,
797};
798
Kukjin Kim2bc02c02011-08-24 17:25:09 +0900799struct clksrc_sources clkset_group = {
Changhwan Younc8bef142010-07-27 17:52:39 +0900800 .sources = clkset_group_list,
801 .nr_sources = ARRAY_SIZE(clkset_group_list),
802};
803
Jongpill Lee06cba8d2010-08-18 22:51:23 +0900804static struct clk *clkset_mout_g2d0_list[] = {
805 [0] = &clk_mout_mpll.clk,
806 [1] = &clk_sclk_apll.clk,
807};
808
809static struct clksrc_sources clkset_mout_g2d0 = {
810 .sources = clkset_mout_g2d0_list,
811 .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list),
812};
813
814static struct clksrc_clk clk_mout_g2d0 = {
815 .clk = {
816 .name = "mout_g2d0",
Jongpill Lee06cba8d2010-08-18 22:51:23 +0900817 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800818 .sources = &clkset_mout_g2d0,
819 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
Jongpill Lee06cba8d2010-08-18 22:51:23 +0900820};
821
822static struct clk *clkset_mout_g2d1_list[] = {
823 [0] = &clk_mout_epll.clk,
824 [1] = &clk_sclk_vpll.clk,
825};
826
827static struct clksrc_sources clkset_mout_g2d1 = {
828 .sources = clkset_mout_g2d1_list,
829 .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list),
830};
831
832static struct clksrc_clk clk_mout_g2d1 = {
833 .clk = {
834 .name = "mout_g2d1",
Jongpill Lee06cba8d2010-08-18 22:51:23 +0900835 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800836 .sources = &clkset_mout_g2d1,
837 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
Jongpill Lee06cba8d2010-08-18 22:51:23 +0900838};
839
840static struct clk *clkset_mout_g2d_list[] = {
841 [0] = &clk_mout_g2d0.clk,
842 [1] = &clk_mout_g2d1.clk,
843};
844
845static struct clksrc_sources clkset_mout_g2d = {
846 .sources = clkset_mout_g2d_list,
847 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
848};
849
Kamil Debski0f75a962011-07-21 16:42:30 +0900850static struct clk *clkset_mout_mfc0_list[] = {
851 [0] = &clk_mout_mpll.clk,
852 [1] = &clk_sclk_apll.clk,
853};
854
855static struct clksrc_sources clkset_mout_mfc0 = {
856 .sources = clkset_mout_mfc0_list,
857 .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list),
858};
859
860static struct clksrc_clk clk_mout_mfc0 = {
861 .clk = {
862 .name = "mout_mfc0",
863 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800864 .sources = &clkset_mout_mfc0,
865 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 },
Kamil Debski0f75a962011-07-21 16:42:30 +0900866};
867
868static struct clk *clkset_mout_mfc1_list[] = {
869 [0] = &clk_mout_epll.clk,
870 [1] = &clk_sclk_vpll.clk,
871};
872
873static struct clksrc_sources clkset_mout_mfc1 = {
874 .sources = clkset_mout_mfc1_list,
875 .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list),
876};
877
878static struct clksrc_clk clk_mout_mfc1 = {
879 .clk = {
880 .name = "mout_mfc1",
881 },
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800882 .sources = &clkset_mout_mfc1,
883 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 },
Kamil Debski0f75a962011-07-21 16:42:30 +0900884};
885
886static struct clk *clkset_mout_mfc_list[] = {
887 [0] = &clk_mout_mfc0.clk,
888 [1] = &clk_mout_mfc1.clk,
889};
890
891static struct clksrc_sources clkset_mout_mfc = {
892 .sources = clkset_mout_mfc_list,
893 .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list),
894};
895
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +0900896static struct clk *clkset_sclk_dac_list[] = {
897 [0] = &clk_sclk_vpll.clk,
898 [1] = &clk_sclk_hdmiphy,
899};
900
901static struct clksrc_sources clkset_sclk_dac = {
902 .sources = clkset_sclk_dac_list,
903 .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
904};
905
906static struct clksrc_clk clk_sclk_dac = {
907 .clk = {
908 .name = "sclk_dac",
909 .enable = exynos4_clksrc_mask_tv_ctrl,
910 .ctrlbit = (1 << 8),
911 },
912 .sources = &clkset_sclk_dac,
913 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 },
914};
915
916static struct clksrc_clk clk_sclk_pixel = {
917 .clk = {
918 .name = "sclk_pixel",
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800919 .parent = &clk_sclk_vpll.clk,
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +0900920 },
921 .reg_div = { .reg = S5P_CLKDIV_TV, .shift = 0, .size = 4 },
922};
923
924static struct clk *clkset_sclk_hdmi_list[] = {
925 [0] = &clk_sclk_pixel.clk,
926 [1] = &clk_sclk_hdmiphy,
927};
928
929static struct clksrc_sources clkset_sclk_hdmi = {
930 .sources = clkset_sclk_hdmi_list,
931 .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
932};
933
934static struct clksrc_clk clk_sclk_hdmi = {
935 .clk = {
936 .name = "sclk_hdmi",
937 .enable = exynos4_clksrc_mask_tv_ctrl,
938 .ctrlbit = (1 << 0),
939 },
940 .sources = &clkset_sclk_hdmi,
941 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 0, .size = 1 },
942};
943
944static struct clk *clkset_sclk_mixer_list[] = {
945 [0] = &clk_sclk_dac.clk,
946 [1] = &clk_sclk_hdmi.clk,
947};
948
949static struct clksrc_sources clkset_sclk_mixer = {
950 .sources = clkset_sclk_mixer_list,
951 .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list),
952};
953
954static struct clksrc_clk clk_sclk_mixer = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800955 .clk = {
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +0900956 .name = "sclk_mixer",
957 .enable = exynos4_clksrc_mask_tv_ctrl,
958 .ctrlbit = (1 << 4),
959 },
960 .sources = &clkset_sclk_mixer,
961 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 4, .size = 1 },
962};
963
964static struct clksrc_clk *sclk_tv[] = {
965 &clk_sclk_dac,
966 &clk_sclk_pixel,
967 &clk_sclk_hdmi,
968 &clk_sclk_mixer,
969};
970
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900971static struct clksrc_clk clk_dout_mmc0 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800972 .clk = {
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900973 .name = "dout_mmc0",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900974 },
975 .sources = &clkset_group,
976 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
977 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
978};
979
980static struct clksrc_clk clk_dout_mmc1 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800981 .clk = {
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900982 .name = "dout_mmc1",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900983 },
984 .sources = &clkset_group,
985 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
986 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
987};
988
989static struct clksrc_clk clk_dout_mmc2 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800990 .clk = {
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900991 .name = "dout_mmc2",
Jongpill Lee340ea1e2010-08-18 22:39:26 +0900992 },
993 .sources = &clkset_group,
994 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
995 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
996};
997
998static struct clksrc_clk clk_dout_mmc3 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -0800999 .clk = {
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001000 .name = "dout_mmc3",
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001001 },
1002 .sources = &clkset_group,
1003 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
1004 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1005};
1006
1007static struct clksrc_clk clk_dout_mmc4 = {
1008 .clk = {
1009 .name = "dout_mmc4",
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001010 },
1011 .sources = &clkset_group,
1012 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
1013 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1014};
1015
Changhwan Younc8bef142010-07-27 17:52:39 +09001016static struct clksrc_clk clksrcs[] = {
1017 {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001018 .clk = {
Changhwan Younc8bef142010-07-27 17:52:39 +09001019 .name = "sclk_pwm",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001020 .enable = exynos4_clksrc_mask_peril0_ctrl,
Changhwan Younc8bef142010-07-27 17:52:39 +09001021 .ctrlbit = (1 << 24),
1022 },
1023 .sources = &clkset_group,
1024 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1025 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001026 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001027 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001028 .name = "sclk_csis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001029 .devname = "s5p-mipi-csis.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001030 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001031 .ctrlbit = (1 << 24),
1032 },
1033 .sources = &clkset_group,
1034 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
1035 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
1036 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001037 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001038 .name = "sclk_csis",
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001039 .devname = "s5p-mipi-csis.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001040 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001041 .ctrlbit = (1 << 28),
1042 },
1043 .sources = &clkset_group,
1044 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
1045 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
1046 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001047 .clk = {
Sylwester Nawrocki00aaad22011-09-27 07:00:59 +09001048 .name = "sclk_cam0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001049 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001050 .ctrlbit = (1 << 16),
1051 },
1052 .sources = &clkset_group,
1053 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
1054 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
1055 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001056 .clk = {
Sylwester Nawrocki00aaad22011-09-27 07:00:59 +09001057 .name = "sclk_cam1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001058 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001059 .ctrlbit = (1 << 20),
1060 },
1061 .sources = &clkset_group,
1062 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
1063 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
1064 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001065 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001066 .name = "sclk_fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001067 .devname = "exynos4-fimc.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001068 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001069 .ctrlbit = (1 << 0),
1070 },
1071 .sources = &clkset_group,
1072 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
1073 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
1074 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001075 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001076 .name = "sclk_fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001077 .devname = "exynos4-fimc.1",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001078 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001079 .ctrlbit = (1 << 4),
1080 },
1081 .sources = &clkset_group,
1082 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
1083 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
1084 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001085 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001086 .name = "sclk_fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001087 .devname = "exynos4-fimc.2",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001088 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001089 .ctrlbit = (1 << 8),
1090 },
1091 .sources = &clkset_group,
1092 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
1093 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
1094 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001095 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001096 .name = "sclk_fimc",
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001097 .devname = "exynos4-fimc.3",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001098 .enable = exynos4_clksrc_mask_cam_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001099 .ctrlbit = (1 << 12),
1100 },
1101 .sources = &clkset_group,
1102 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
1103 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
1104 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001105 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001106 .name = "sclk_fimd",
Jingoo Han268a7ef2011-07-21 15:42:38 +09001107 .devname = "exynos4-fb.0",
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001108 .enable = exynos4_clksrc_mask_lcd0_ctrl,
Jongpill Lee33f469d2010-08-18 22:54:48 +09001109 .ctrlbit = (1 << 0),
1110 },
1111 .sources = &clkset_group,
1112 .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
1113 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
1114 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001115 .clk = {
Jongpill Lee33f469d2010-08-18 22:54:48 +09001116 .name = "sclk_fimg2d",
Jongpill Lee33f469d2010-08-18 22:54:48 +09001117 },
1118 .sources = &clkset_mout_g2d,
1119 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1120 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1121 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001122 .clk = {
Kamil Debski0f75a962011-07-21 16:42:30 +09001123 .name = "sclk_mfc",
1124 .devname = "s5p-mfc",
1125 },
1126 .sources = &clkset_mout_mfc,
1127 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 },
1128 .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 },
1129 }, {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001130 .clk = {
Thomas Abrahambadc4f22011-06-14 19:12:27 +09001131 .name = "sclk_dwmmc",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001132 .parent = &clk_dout_mmc4.clk,
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001133 .enable = exynos4_clksrc_mask_fsys_ctrl,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001134 .ctrlbit = (1 << 16),
1135 },
1136 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1137 }
Changhwan Younc8bef142010-07-27 17:52:39 +09001138};
1139
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001140static struct clksrc_clk clk_sclk_uart0 = {
1141 .clk = {
1142 .name = "uclk1",
1143 .devname = "exynos4210-uart.0",
1144 .enable = exynos4_clksrc_mask_peril0_ctrl,
1145 .ctrlbit = (1 << 0),
1146 },
1147 .sources = &clkset_group,
1148 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1149 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1150};
1151
1152static struct clksrc_clk clk_sclk_uart1 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001153 .clk = {
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001154 .name = "uclk1",
1155 .devname = "exynos4210-uart.1",
1156 .enable = exynos4_clksrc_mask_peril0_ctrl,
1157 .ctrlbit = (1 << 4),
1158 },
1159 .sources = &clkset_group,
1160 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1161 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1162};
1163
1164static struct clksrc_clk clk_sclk_uart2 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001165 .clk = {
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001166 .name = "uclk1",
1167 .devname = "exynos4210-uart.2",
1168 .enable = exynos4_clksrc_mask_peril0_ctrl,
1169 .ctrlbit = (1 << 8),
1170 },
1171 .sources = &clkset_group,
1172 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1173 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1174};
1175
1176static struct clksrc_clk clk_sclk_uart3 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001177 .clk = {
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001178 .name = "uclk1",
1179 .devname = "exynos4210-uart.3",
1180 .enable = exynos4_clksrc_mask_peril0_ctrl,
1181 .ctrlbit = (1 << 12),
1182 },
1183 .sources = &clkset_group,
1184 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1185 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1186};
1187
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001188static struct clksrc_clk clk_sclk_mmc0 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001189 .clk = {
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001190 .name = "sclk_mmc",
1191 .devname = "s3c-sdhci.0",
1192 .parent = &clk_dout_mmc0.clk,
1193 .enable = exynos4_clksrc_mask_fsys_ctrl,
1194 .ctrlbit = (1 << 0),
1195 },
1196 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1197};
1198
1199static struct clksrc_clk clk_sclk_mmc1 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001200 .clk = {
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001201 .name = "sclk_mmc",
1202 .devname = "s3c-sdhci.1",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001203 .parent = &clk_dout_mmc1.clk,
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001204 .enable = exynos4_clksrc_mask_fsys_ctrl,
1205 .ctrlbit = (1 << 4),
1206 },
1207 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1208};
1209
1210static struct clksrc_clk clk_sclk_mmc2 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001211 .clk = {
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001212 .name = "sclk_mmc",
1213 .devname = "s3c-sdhci.2",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001214 .parent = &clk_dout_mmc2.clk,
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001215 .enable = exynos4_clksrc_mask_fsys_ctrl,
1216 .ctrlbit = (1 << 8),
1217 },
1218 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1219};
1220
1221static struct clksrc_clk clk_sclk_mmc3 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001222 .clk = {
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001223 .name = "sclk_mmc",
1224 .devname = "s3c-sdhci.3",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001225 .parent = &clk_dout_mmc3.clk,
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001226 .enable = exynos4_clksrc_mask_fsys_ctrl,
1227 .ctrlbit = (1 << 12),
1228 },
1229 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1230};
1231
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001232static struct clksrc_clk clk_sclk_spi0 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001233 .clk = {
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001234 .name = "sclk_spi",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001235 .devname = "s3c64xx-spi.0",
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001236 .enable = exynos4_clksrc_mask_peril1_ctrl,
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001237 .ctrlbit = (1 << 16),
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001238 },
1239 .sources = &clkset_group,
1240 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1241 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1242};
1243
1244static struct clksrc_clk clk_sclk_spi1 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001245 .clk = {
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001246 .name = "sclk_spi",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001247 .devname = "s3c64xx-spi.1",
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001248 .enable = exynos4_clksrc_mask_peril1_ctrl,
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001249 .ctrlbit = (1 << 20),
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001250 },
1251 .sources = &clkset_group,
1252 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1253 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1254};
1255
1256static struct clksrc_clk clk_sclk_spi2 = {
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001257 .clk = {
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001258 .name = "sclk_spi",
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001259 .devname = "s3c64xx-spi.2",
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001260 .enable = exynos4_clksrc_mask_peril1_ctrl,
Kukjin Kimce9c00e2012-03-09 13:51:24 -08001261 .ctrlbit = (1 << 24),
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001262 },
1263 .sources = &clkset_group,
1264 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1265 .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1266};
1267
Changhwan Younc8bef142010-07-27 17:52:39 +09001268/* Clock initialization code */
1269static struct clksrc_clk *sysclks[] = {
1270 &clk_mout_apll,
Jongpill Lee3ff31022010-08-18 22:20:31 +09001271 &clk_sclk_apll,
Changhwan Younc8bef142010-07-27 17:52:39 +09001272 &clk_mout_epll,
1273 &clk_mout_mpll,
1274 &clk_moutcore,
1275 &clk_coreclk,
1276 &clk_armclk,
1277 &clk_aclk_corem0,
1278 &clk_aclk_cores,
1279 &clk_aclk_corem1,
1280 &clk_periphclk,
Changhwan Younc8bef142010-07-27 17:52:39 +09001281 &clk_mout_corebus,
1282 &clk_sclk_dmc,
1283 &clk_aclk_cored,
1284 &clk_aclk_corep,
1285 &clk_aclk_acp,
1286 &clk_pclk_acp,
1287 &clk_vpllsrc,
1288 &clk_sclk_vpll,
1289 &clk_aclk_200,
1290 &clk_aclk_100,
1291 &clk_aclk_160,
1292 &clk_aclk_133,
Jongpill Lee340ea1e2010-08-18 22:39:26 +09001293 &clk_dout_mmc0,
1294 &clk_dout_mmc1,
1295 &clk_dout_mmc2,
1296 &clk_dout_mmc3,
1297 &clk_dout_mmc4,
Kamil Debski0f75a962011-07-21 16:42:30 +09001298 &clk_mout_mfc0,
1299 &clk_mout_mfc1,
Changhwan Younc8bef142010-07-27 17:52:39 +09001300};
1301
Thomas Abraham66fdb292011-10-24 14:01:03 +02001302static struct clk *clk_cdev[] = {
1303 &clk_pdma0,
1304 &clk_pdma1,
1305};
1306
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001307static struct clksrc_clk *clksrc_cdev[] = {
1308 &clk_sclk_uart0,
1309 &clk_sclk_uart1,
1310 &clk_sclk_uart2,
1311 &clk_sclk_uart3,
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001312 &clk_sclk_mmc0,
1313 &clk_sclk_mmc1,
1314 &clk_sclk_mmc2,
1315 &clk_sclk_mmc3,
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001316 &clk_sclk_spi0,
1317 &clk_sclk_spi1,
1318 &clk_sclk_spi2,
1319
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001320};
1321
1322static struct clk_lookup exynos4_clk_lookup[] = {
1323 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &clk_sclk_uart0.clk),
1324 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &clk_sclk_uart1.clk),
1325 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &clk_sclk_uart2.clk),
1326 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &clk_sclk_uart3.clk),
Rajeshwari Shindea361d102011-10-24 17:05:58 +02001327 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1328 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1329 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1330 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
Thomas Abraham66fdb292011-10-24 14:01:03 +02001331 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
1332 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
Padmavathi Venna74ac23a2011-12-26 16:42:15 +09001333 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &clk_sclk_spi0.clk),
1334 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &clk_sclk_spi1.clk),
1335 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &clk_sclk_spi2.clk),
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001336};
1337
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001338static int xtal_rate;
1339
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001340static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001341{
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001342 if (soc_is_exynos4210())
1343 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0),
1344 pll_4508);
Changhwan Younb88b1cc2011-10-04 17:08:56 +09001345 else if (soc_is_exynos4212() || soc_is_exynos4412())
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001346 return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0));
1347 else
1348 return 0;
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001349}
1350
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001351static struct clk_ops exynos4_fout_apll_ops = {
1352 .get_rate = exynos4_fout_apll_get_rate,
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001353};
1354
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +09001355static u32 vpll_div[][8] = {
1356 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1357 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1358};
1359
1360static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1361{
1362 return clk->rate;
1363}
1364
1365static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1366{
1367 unsigned int vpll_con0, vpll_con1 = 0;
1368 unsigned int i;
1369
1370 /* Return if nothing changed */
1371 if (clk->rate == rate)
1372 return 0;
1373
1374 vpll_con0 = __raw_readl(S5P_VPLL_CON0);
1375 vpll_con0 &= ~(0x1 << 27 | \
1376 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1377 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1378 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1379
1380 vpll_con1 = __raw_readl(S5P_VPLL_CON1);
1381 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1382 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1383 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1384
1385 for (i = 0; i < ARRAY_SIZE(vpll_div); i++) {
1386 if (vpll_div[i][0] == rate) {
1387 vpll_con0 |= vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1388 vpll_con0 |= vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1389 vpll_con0 |= vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1390 vpll_con1 |= vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1391 vpll_con1 |= vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1392 vpll_con1 |= vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1393 vpll_con0 |= vpll_div[i][7] << 27;
1394 break;
1395 }
1396 }
1397
1398 if (i == ARRAY_SIZE(vpll_div)) {
1399 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1400 __func__);
1401 return -EINVAL;
1402 }
1403
1404 __raw_writel(vpll_con0, S5P_VPLL_CON0);
1405 __raw_writel(vpll_con1, S5P_VPLL_CON1);
1406
1407 /* Wait for VPLL lock */
1408 while (!(__raw_readl(S5P_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1409 continue;
1410
1411 clk->rate = rate;
1412 return 0;
1413}
1414
1415static struct clk_ops exynos4_vpll_ops = {
1416 .get_rate = exynos4_vpll_get_rate,
1417 .set_rate = exynos4_vpll_set_rate,
1418};
1419
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001420void __init_or_cpufreq exynos4_setup_clocks(void)
Changhwan Younc8bef142010-07-27 17:52:39 +09001421{
1422 struct clk *xtal_clk;
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001423 unsigned long apll = 0;
1424 unsigned long mpll = 0;
1425 unsigned long epll = 0;
1426 unsigned long vpll = 0;
Changhwan Younc8bef142010-07-27 17:52:39 +09001427 unsigned long vpllsrc;
1428 unsigned long xtal;
1429 unsigned long armclk;
Changhwan Younc8bef142010-07-27 17:52:39 +09001430 unsigned long sclk_dmc;
Jongpill Lee228ef982010-08-18 22:24:53 +09001431 unsigned long aclk_200;
1432 unsigned long aclk_100;
1433 unsigned long aclk_160;
1434 unsigned long aclk_133;
Changhwan Younc8bef142010-07-27 17:52:39 +09001435 unsigned int ptr;
1436
1437 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1438
1439 xtal_clk = clk_get(NULL, "xtal");
1440 BUG_ON(IS_ERR(xtal_clk));
1441
1442 xtal = clk_get_rate(xtal_clk);
Jaecheol Lee877d1b52010-12-23 14:25:31 +09001443
1444 xtal_rate = xtal;
1445
Changhwan Younc8bef142010-07-27 17:52:39 +09001446 clk_put(xtal_clk);
1447
1448 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1449
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001450 if (soc_is_exynos4210()) {
1451 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0),
1452 pll_4508);
1453 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0),
1454 pll_4508);
1455 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
1456 __raw_readl(S5P_EPLL_CON1), pll_4600);
Changhwan Younc8bef142010-07-27 17:52:39 +09001457
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001458 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1459 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1460 __raw_readl(S5P_VPLL_CON1), pll_4650c);
Changhwan Younb88b1cc2011-10-04 17:08:56 +09001461 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
Kukjin Kim2bc02c02011-08-24 17:25:09 +09001462 apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0));
1463 mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0));
1464 epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0),
1465 __raw_readl(S5P_EPLL_CON1));
1466
1467 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1468 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1469 __raw_readl(S5P_VPLL_CON1));
1470 } else {
1471 /* nothing */
1472 }
Changhwan Younc8bef142010-07-27 17:52:39 +09001473
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001474 clk_fout_apll.ops = &exynos4_fout_apll_ops;
Changhwan Younc8bef142010-07-27 17:52:39 +09001475 clk_fout_mpll.rate = mpll;
1476 clk_fout_epll.rate = epll;
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +09001477 clk_fout_vpll.ops = &exynos4_vpll_ops;
Changhwan Younc8bef142010-07-27 17:52:39 +09001478 clk_fout_vpll.rate = vpll;
1479
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001480 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
Changhwan Younc8bef142010-07-27 17:52:39 +09001481 apll, mpll, epll, vpll);
1482
1483 armclk = clk_get_rate(&clk_armclk.clk);
Changhwan Younc8bef142010-07-27 17:52:39 +09001484 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
Changhwan Younc8bef142010-07-27 17:52:39 +09001485
Jongpill Lee228ef982010-08-18 22:24:53 +09001486 aclk_200 = clk_get_rate(&clk_aclk_200.clk);
1487 aclk_100 = clk_get_rate(&clk_aclk_100.clk);
1488 aclk_160 = clk_get_rate(&clk_aclk_160.clk);
1489 aclk_133 = clk_get_rate(&clk_aclk_133.clk);
1490
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001491 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
Jongpill Lee228ef982010-08-18 22:24:53 +09001492 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1493 armclk, sclk_dmc, aclk_200,
1494 aclk_100, aclk_160, aclk_133);
Changhwan Younc8bef142010-07-27 17:52:39 +09001495
1496 clk_f.rate = armclk;
1497 clk_h.rate = sclk_dmc;
Jongpill Lee228ef982010-08-18 22:24:53 +09001498 clk_p.rate = aclk_100;
Changhwan Younc8bef142010-07-27 17:52:39 +09001499
1500 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1501 s3c_set_clksrc(&clksrcs[ptr], true);
1502}
1503
1504static struct clk *clks[] __initdata = {
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +09001505 &clk_sclk_hdmi27m,
1506 &clk_sclk_hdmiphy,
1507 &clk_sclk_usbphy0,
1508 &clk_sclk_usbphy1,
Changhwan Younc8bef142010-07-27 17:52:39 +09001509};
1510
Jonghwan Choiacd35612011-08-24 21:52:45 +09001511#ifdef CONFIG_PM_SLEEP
1512static int exynos4_clock_suspend(void)
1513{
1514 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1515 return 0;
1516}
1517
1518static void exynos4_clock_resume(void)
1519{
1520 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1521}
1522
1523#else
1524#define exynos4_clock_suspend NULL
1525#define exynos4_clock_resume NULL
1526#endif
1527
Kukjin Kime745e062012-01-21 10:47:14 +09001528static struct syscore_ops exynos4_clock_syscore_ops = {
Jonghwan Choiacd35612011-08-24 21:52:45 +09001529 .suspend = exynos4_clock_suspend,
1530 .resume = exynos4_clock_resume,
1531};
1532
Kukjin Kimb3ed3a12011-02-14 16:08:04 +09001533void __init exynos4_register_clocks(void)
Changhwan Younc8bef142010-07-27 17:52:39 +09001534{
Changhwan Younc8bef142010-07-27 17:52:39 +09001535 int ptr;
1536
Kukjin Kim957c4612011-01-04 17:58:22 +09001537 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
Changhwan Younc8bef142010-07-27 17:52:39 +09001538
1539 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1540 s3c_register_clksrc(sysclks[ptr], 1);
1541
Tomasz Stanislawskifbf05562011-09-19 16:44:42 +09001542 for (ptr = 0; ptr < ARRAY_SIZE(sclk_tv); ptr++)
1543 s3c_register_clksrc(sclk_tv[ptr], 1);
1544
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001545 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1546 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1547
Changhwan Younc8bef142010-07-27 17:52:39 +09001548 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1549 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1550
Thomas Abraham66fdb292011-10-24 14:01:03 +02001551 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1552 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1553 s3c_disable_clocks(clk_cdev[ptr], 1);
1554
Kukjin Kim957c4612011-01-04 17:58:22 +09001555 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1556 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001557 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
Changhwan Younc8bef142010-07-27 17:52:39 +09001558
Jonghwan Choiacd35612011-08-24 21:52:45 +09001559 register_syscore_ops(&exynos4_clock_syscore_ops);
Boojin Kimbf856fb2011-09-02 09:44:36 +09001560 s3c24xx_register_clock(&dummy_apb_pclk);
1561
Changhwan Younc8bef142010-07-27 17:52:39 +09001562 s3c_pwmclk_init();
1563}