blob: c1bcc4a6d3a805603f2a60ae1c5cb87a642d4c77 [file] [log] [blame]
Ben Dooks4b31d8b2008-10-21 14:07:00 +01001/* linux/arch/arm/plat-s3c64xx/clock.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX Base clock support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
Ben Dooks62acb2f82010-01-26 14:53:19 +090019#include <linux/clk.h>
20#include <linux/err.h>
Ben Dooks4b31d8b2008-10-21 14:07:00 +010021#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25
Ben Dooks3501c9a2010-01-26 10:45:40 +090026#include <mach/regs-clock.h>
Ben Dooksf7be9ab2010-01-26 13:41:30 +090027
Ben Dooks4b31d8b2008-10-21 14:07:00 +010028#include <plat/cpu.h>
29#include <plat/devs.h>
Ben Dooks62acb2f82010-01-26 14:53:19 +090030#include <plat/cpu-freq.h>
Ben Dooks4b31d8b2008-10-21 14:07:00 +010031#include <plat/clock.h>
Ben Dooks62acb2f82010-01-26 14:53:19 +090032#include <plat/clock-clksrc.h>
Kukjin Kim52e329e2011-10-04 19:41:43 +090033#include <plat/pll.h>
Ben Dooks62acb2f82010-01-26 14:53:19 +090034
Kukjin Kimf2bfd172013-01-02 13:31:15 -080035#include "regs-sys.h"
36
Ben Dooks62acb2f82010-01-26 14:53:19 +090037/* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
38 * ext_xtal_mux for want of an actual name from the manual.
39*/
40
41static struct clk clk_ext_xtal_mux = {
42 .name = "ext_xtal",
Ben Dooks62acb2f82010-01-26 14:53:19 +090043};
44
45#define clk_fin_apll clk_ext_xtal_mux
46#define clk_fin_mpll clk_ext_xtal_mux
47#define clk_fin_epll clk_ext_xtal_mux
48
49#define clk_fout_mpll clk_mpll
50#define clk_fout_epll clk_epll
Ben Dooks4b31d8b2008-10-21 14:07:00 +010051
Werner Almesbergera03f7da2009-03-05 11:43:13 +080052struct clk clk_h2 = {
53 .name = "hclk2",
Werner Almesbergera03f7da2009-03-05 11:43:13 +080054 .rate = 0,
55};
56
Ben Dooks4b31d8b2008-10-21 14:07:00 +010057struct clk clk_27m = {
58 .name = "clk_27m",
Ben Dooks4b31d8b2008-10-21 14:07:00 +010059 .rate = 27000000,
60};
61
Ben Dooks3627379f2008-10-31 16:14:36 +000062static int clk_48m_ctrl(struct clk *clk, int enable)
63{
64 unsigned long flags;
65 u32 val;
66
67 /* can't rely on clock lock, this register has other usages */
68 local_irq_save(flags);
69
70 val = __raw_readl(S3C64XX_OTHERS);
71 if (enable)
72 val |= S3C64XX_OTHERS_USBMASK;
73 else
74 val &= ~S3C64XX_OTHERS_USBMASK;
75
76 __raw_writel(val, S3C64XX_OTHERS);
77 local_irq_restore(flags);
78
79 return 0;
80}
81
Ben Dooks4b31d8b2008-10-21 14:07:00 +010082struct clk clk_48m = {
83 .name = "clk_48m",
Ben Dooks4b31d8b2008-10-21 14:07:00 +010084 .rate = 48000000,
Ben Dooks3627379f2008-10-31 16:14:36 +000085 .enable = clk_48m_ctrl,
Ben Dooks4b31d8b2008-10-21 14:07:00 +010086};
87
Maurus Cuelenaere05e021f2010-05-17 20:17:42 +020088struct clk clk_xusbxti = {
89 .name = "xusbxti",
Maurus Cuelenaere05e021f2010-05-17 20:17:42 +020090 .rate = 48000000,
91};
92
Ben Dooks4b31d8b2008-10-21 14:07:00 +010093static int inline s3c64xx_gate(void __iomem *reg,
94 struct clk *clk,
95 int enable)
96{
97 unsigned int ctrlbit = clk->ctrlbit;
98 u32 con;
99
100 con = __raw_readl(reg);
101
102 if (enable)
103 con |= ctrlbit;
104 else
105 con &= ~ctrlbit;
106
107 __raw_writel(con, reg);
108 return 0;
109}
110
111static int s3c64xx_pclk_ctrl(struct clk *clk, int enable)
112{
113 return s3c64xx_gate(S3C_PCLK_GATE, clk, enable);
114}
115
116static int s3c64xx_hclk_ctrl(struct clk *clk, int enable)
117{
118 return s3c64xx_gate(S3C_HCLK_GATE, clk, enable);
119}
120
Ben Dookscf18acf2008-10-21 14:07:02 +0100121int s3c64xx_sclk_ctrl(struct clk *clk, int enable)
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100122{
123 return s3c64xx_gate(S3C_SCLK_GATE, clk, enable);
124}
125
Kukjin Kimcdb216d2011-01-04 18:27:18 +0900126static struct clk init_clocks_off[] = {
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100127 {
128 .name = "nand",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100129 .parent = &clk_h,
130 }, {
Atul Dahiya32fc7fb2010-07-15 11:56:15 +0530131 .name = "rtc",
Atul Dahiya32fc7fb2010-07-15 11:56:15 +0530132 .parent = &clk_p,
133 .enable = s3c64xx_pclk_ctrl,
134 .ctrlbit = S3C_CLKCON_PCLK_RTC,
135 }, {
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100136 .name = "adc",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100137 .parent = &clk_p,
138 .enable = s3c64xx_pclk_ctrl,
139 .ctrlbit = S3C_CLKCON_PCLK_TSADC,
140 }, {
141 .name = "i2c",
Mark Brown5d3a2192012-01-27 14:43:44 +0900142 .devname = "s3c2440-i2c.0",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100143 .parent = &clk_p,
144 .enable = s3c64xx_pclk_ctrl,
145 .ctrlbit = S3C_CLKCON_PCLK_IIC,
146 }, {
Ben Dooks400b11a2011-03-04 07:55:44 +0900147 .name = "i2c",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900148 .devname = "s3c2440-i2c.1",
Ben Dooks400b11a2011-03-04 07:55:44 +0900149 .parent = &clk_p,
150 .enable = s3c64xx_pclk_ctrl,
151 .ctrlbit = S3C6410_CLKCON_PCLK_I2C1,
152 }, {
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900153 .name = "keypad",
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900154 .parent = &clk_p,
155 .enable = s3c64xx_pclk_ctrl,
156 .ctrlbit = S3C_CLKCON_PCLK_KEYPAD,
157 }, {
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100158 .name = "spi",
Thomas Abrahama5238e32012-07-13 07:15:14 +0900159 .devname = "s3c6410-spi.0",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100160 .parent = &clk_p,
161 .enable = s3c64xx_pclk_ctrl,
162 .ctrlbit = S3C_CLKCON_PCLK_SPI0,
163 }, {
164 .name = "spi",
Thomas Abrahama5238e32012-07-13 07:15:14 +0900165 .devname = "s3c6410-spi.1",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100166 .parent = &clk_p,
167 .enable = s3c64xx_pclk_ctrl,
168 .ctrlbit = S3C_CLKCON_PCLK_SPI1,
169 }, {
170 .name = "48m",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900171 .devname = "s3c-sdhci.0",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100172 .parent = &clk_48m,
173 .enable = s3c64xx_sclk_ctrl,
174 .ctrlbit = S3C_CLKCON_SCLK_MMC0_48,
175 }, {
176 .name = "48m",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900177 .devname = "s3c-sdhci.1",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100178 .parent = &clk_48m,
179 .enable = s3c64xx_sclk_ctrl,
180 .ctrlbit = S3C_CLKCON_SCLK_MMC1_48,
181 }, {
182 .name = "48m",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900183 .devname = "s3c-sdhci.2",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100184 .parent = &clk_48m,
185 .enable = s3c64xx_sclk_ctrl,
186 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48,
Mark Brown8f1ecf12009-04-28 16:06:24 +0100187 }, {
Mark Browned8d8aa2012-01-12 10:41:35 +0900188 .name = "ac97",
189 .parent = &clk_p,
190 .ctrlbit = S3C_CLKCON_PCLK_AC97,
191 }, {
192 .name = "cfcon",
193 .parent = &clk_h,
194 .enable = s3c64xx_hclk_ctrl,
195 .ctrlbit = S3C_CLKCON_HCLK_IHOST,
196 }, {
Mark Brown8f1ecf12009-04-28 16:06:24 +0100197 .name = "dma0",
Mark Brown8f1ecf12009-04-28 16:06:24 +0100198 .parent = &clk_h,
199 .enable = s3c64xx_hclk_ctrl,
200 .ctrlbit = S3C_CLKCON_HCLK_DMA0,
201 }, {
202 .name = "dma1",
Mark Brown8f1ecf12009-04-28 16:06:24 +0100203 .parent = &clk_h,
204 .enable = s3c64xx_hclk_ctrl,
205 .ctrlbit = S3C_CLKCON_HCLK_DMA1,
Mark Brown8942ad82012-01-27 14:42:19 +0900206 }, {
207 .name = "3dse",
208 .parent = &clk_h,
209 .enable = s3c64xx_hclk_ctrl,
210 .ctrlbit = S3C_CLKCON_HCLK_3DSE,
211 }, {
212 .name = "hclk_secur",
213 .parent = &clk_h,
214 .enable = s3c64xx_hclk_ctrl,
215 .ctrlbit = S3C_CLKCON_HCLK_SECUR,
216 }, {
217 .name = "sdma1",
218 .parent = &clk_h,
219 .enable = s3c64xx_hclk_ctrl,
220 .ctrlbit = S3C_CLKCON_HCLK_SDMA1,
221 }, {
222 .name = "sdma0",
223 .parent = &clk_h,
224 .enable = s3c64xx_hclk_ctrl,
225 .ctrlbit = S3C_CLKCON_HCLK_SDMA0,
226 }, {
227 .name = "hclk_jpeg",
228 .parent = &clk_h,
229 .enable = s3c64xx_hclk_ctrl,
230 .ctrlbit = S3C_CLKCON_HCLK_JPEG,
231 }, {
232 .name = "camif",
233 .parent = &clk_h,
234 .enable = s3c64xx_hclk_ctrl,
235 .ctrlbit = S3C_CLKCON_HCLK_CAMIF,
236 }, {
237 .name = "hclk_scaler",
238 .parent = &clk_h,
239 .enable = s3c64xx_hclk_ctrl,
240 .ctrlbit = S3C_CLKCON_HCLK_SCALER,
241 }, {
242 .name = "2d",
243 .parent = &clk_h,
244 .enable = s3c64xx_hclk_ctrl,
245 .ctrlbit = S3C_CLKCON_HCLK_2D,
246 }, {
247 .name = "tv",
248 .parent = &clk_h,
249 .enable = s3c64xx_hclk_ctrl,
250 .ctrlbit = S3C_CLKCON_HCLK_TV,
251 }, {
252 .name = "post0",
253 .parent = &clk_h,
254 .enable = s3c64xx_hclk_ctrl,
255 .ctrlbit = S3C_CLKCON_HCLK_POST0,
256 }, {
257 .name = "rot",
258 .parent = &clk_h,
259 .enable = s3c64xx_hclk_ctrl,
260 .ctrlbit = S3C_CLKCON_HCLK_ROT,
261 }, {
262 .name = "hclk_mfc",
263 .parent = &clk_h,
264 .enable = s3c64xx_hclk_ctrl,
265 .ctrlbit = S3C_CLKCON_HCLK_MFC,
266 }, {
267 .name = "pclk_mfc",
268 .parent = &clk_p,
269 .enable = s3c64xx_pclk_ctrl,
270 .ctrlbit = S3C_CLKCON_PCLK_MFC,
271 }, {
272 .name = "dac27",
273 .enable = s3c64xx_sclk_ctrl,
274 .ctrlbit = S3C_CLKCON_SCLK_DAC27,
275 }, {
276 .name = "tv27",
277 .enable = s3c64xx_sclk_ctrl,
278 .ctrlbit = S3C_CLKCON_SCLK_TV27,
279 }, {
280 .name = "scaler27",
281 .enable = s3c64xx_sclk_ctrl,
282 .ctrlbit = S3C_CLKCON_SCLK_SCALER27,
283 }, {
284 .name = "sclk_scaler",
285 .enable = s3c64xx_sclk_ctrl,
286 .ctrlbit = S3C_CLKCON_SCLK_SCALER,
287 }, {
288 .name = "post0_27",
289 .enable = s3c64xx_sclk_ctrl,
290 .ctrlbit = S3C_CLKCON_SCLK_POST0_27,
291 }, {
292 .name = "secur",
293 .enable = s3c64xx_sclk_ctrl,
294 .ctrlbit = S3C_CLKCON_SCLK_SECUR,
295 }, {
296 .name = "sclk_mfc",
297 .enable = s3c64xx_sclk_ctrl,
298 .ctrlbit = S3C_CLKCON_SCLK_MFC,
299 }, {
Mark Brown8942ad82012-01-27 14:42:19 +0900300 .name = "sclk_jpeg",
301 .enable = s3c64xx_sclk_ctrl,
302 .ctrlbit = S3C_CLKCON_SCLK_JPEG,
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100303 },
304};
305
Padmavathi Vennaba479172011-11-02 20:04:08 +0900306static struct clk clk_48m_spi0 = {
307 .name = "spi_48m",
Thomas Abrahama5238e32012-07-13 07:15:14 +0900308 .devname = "s3c6410-spi.0",
Padmavathi Vennaba479172011-11-02 20:04:08 +0900309 .parent = &clk_48m,
310 .enable = s3c64xx_sclk_ctrl,
311 .ctrlbit = S3C_CLKCON_SCLK_SPI0_48,
312};
313
314static struct clk clk_48m_spi1 = {
315 .name = "spi_48m",
Thomas Abrahama5238e32012-07-13 07:15:14 +0900316 .devname = "s3c6410-spi.1",
Padmavathi Vennaba479172011-11-02 20:04:08 +0900317 .parent = &clk_48m,
318 .enable = s3c64xx_sclk_ctrl,
319 .ctrlbit = S3C_CLKCON_SCLK_SPI1_48,
320};
321
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800322static struct clk clk_i2s0 = {
323 .name = "iis",
324 .devname = "samsung-i2s.0",
325 .parent = &clk_p,
326 .enable = s3c64xx_pclk_ctrl,
327 .ctrlbit = S3C_CLKCON_PCLK_IIS0,
328};
329
330static struct clk clk_i2s1 = {
331 .name = "iis",
332 .devname = "samsung-i2s.1",
333 .parent = &clk_p,
334 .enable = s3c64xx_pclk_ctrl,
335 .ctrlbit = S3C_CLKCON_PCLK_IIS1,
336};
337
338#ifdef CONFIG_CPU_S3C6410
339static struct clk clk_i2s2 = {
340 .name = "iis",
341 .devname = "samsung-i2s.2",
342 .parent = &clk_p,
343 .enable = s3c64xx_pclk_ctrl,
344 .ctrlbit = S3C6410_CLKCON_PCLK_IIS2,
345};
346#endif
347
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100348static struct clk init_clocks[] = {
349 {
350 .name = "lcd",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100351 .parent = &clk_h,
352 .enable = s3c64xx_hclk_ctrl,
353 .ctrlbit = S3C_CLKCON_HCLK_LCD,
354 }, {
355 .name = "gpio",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100356 .parent = &clk_p,
357 .enable = s3c64xx_pclk_ctrl,
358 .ctrlbit = S3C_CLKCON_PCLK_GPIO,
359 }, {
360 .name = "usb-host",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100361 .parent = &clk_h,
362 .enable = s3c64xx_hclk_ctrl,
Peter Korsgaard386f4352009-06-18 23:54:44 +0200363 .ctrlbit = S3C_CLKCON_HCLK_UHOST,
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100364 }, {
Thomas Abraham5f4c5b22010-05-28 11:41:14 +0900365 .name = "otg",
Thomas Abraham5f4c5b22010-05-28 11:41:14 +0900366 .parent = &clk_h,
367 .enable = s3c64xx_hclk_ctrl,
368 .ctrlbit = S3C_CLKCON_HCLK_USB,
369 }, {
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100370 .name = "timers",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100371 .parent = &clk_p,
372 .enable = s3c64xx_pclk_ctrl,
373 .ctrlbit = S3C_CLKCON_PCLK_PWM,
374 }, {
375 .name = "uart",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900376 .devname = "s3c6400-uart.0",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100377 .parent = &clk_p,
378 .enable = s3c64xx_pclk_ctrl,
379 .ctrlbit = S3C_CLKCON_PCLK_UART0,
380 }, {
381 .name = "uart",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900382 .devname = "s3c6400-uart.1",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100383 .parent = &clk_p,
384 .enable = s3c64xx_pclk_ctrl,
385 .ctrlbit = S3C_CLKCON_PCLK_UART1,
386 }, {
387 .name = "uart",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900388 .devname = "s3c6400-uart.2",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100389 .parent = &clk_p,
390 .enable = s3c64xx_pclk_ctrl,
391 .ctrlbit = S3C_CLKCON_PCLK_UART2,
392 }, {
393 .name = "uart",
Thomas Abraham226e85f2011-06-14 19:12:26 +0900394 .devname = "s3c6400-uart.3",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100395 .parent = &clk_p,
396 .enable = s3c64xx_pclk_ctrl,
397 .ctrlbit = S3C_CLKCON_PCLK_UART3,
398 }, {
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100399 .name = "watchdog",
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100400 .parent = &clk_p,
401 .ctrlbit = S3C_CLKCON_PCLK_WDT,
Mark Browned8d8aa2012-01-12 10:41:35 +0900402 },
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100403};
404
Rajeshwari Shindea361d102011-10-24 17:05:58 +0200405static struct clk clk_hsmmc0 = {
406 .name = "hsmmc",
407 .devname = "s3c-sdhci.0",
408 .parent = &clk_h,
409 .enable = s3c64xx_hclk_ctrl,
410 .ctrlbit = S3C_CLKCON_HCLK_HSMMC0,
411};
412
413static struct clk clk_hsmmc1 = {
414 .name = "hsmmc",
415 .devname = "s3c-sdhci.1",
416 .parent = &clk_h,
417 .enable = s3c64xx_hclk_ctrl,
418 .ctrlbit = S3C_CLKCON_HCLK_HSMMC1,
419};
420
421static struct clk clk_hsmmc2 = {
422 .name = "hsmmc",
423 .devname = "s3c-sdhci.2",
424 .parent = &clk_h,
425 .enable = s3c64xx_hclk_ctrl,
426 .ctrlbit = S3C_CLKCON_HCLK_HSMMC2,
427};
Ben Dooks62acb2f82010-01-26 14:53:19 +0900428
429static struct clk clk_fout_apll = {
430 .name = "fout_apll",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900431};
432
433static struct clk *clk_src_apll_list[] = {
434 [0] = &clk_fin_apll,
435 [1] = &clk_fout_apll,
436};
437
438static struct clksrc_sources clk_src_apll = {
439 .sources = clk_src_apll_list,
440 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
441};
442
443static struct clksrc_clk clk_mout_apll = {
444 .clk = {
445 .name = "mout_apll",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900446 },
447 .reg_src = { .reg = S3C_CLK_SRC, .shift = 0, .size = 1 },
448 .sources = &clk_src_apll,
449};
450
451static struct clk *clk_src_epll_list[] = {
452 [0] = &clk_fin_epll,
453 [1] = &clk_fout_epll,
454};
455
456static struct clksrc_sources clk_src_epll = {
457 .sources = clk_src_epll_list,
458 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
459};
460
461static struct clksrc_clk clk_mout_epll = {
462 .clk = {
463 .name = "mout_epll",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900464 },
465 .reg_src = { .reg = S3C_CLK_SRC, .shift = 2, .size = 1 },
466 .sources = &clk_src_epll,
467};
468
469static struct clk *clk_src_mpll_list[] = {
470 [0] = &clk_fin_mpll,
471 [1] = &clk_fout_mpll,
472};
473
474static struct clksrc_sources clk_src_mpll = {
475 .sources = clk_src_mpll_list,
476 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
477};
478
479static struct clksrc_clk clk_mout_mpll = {
480 .clk = {
481 .name = "mout_mpll",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900482 },
483 .reg_src = { .reg = S3C_CLK_SRC, .shift = 1, .size = 1 },
484 .sources = &clk_src_mpll,
485};
486
487static unsigned int armclk_mask;
488
489static unsigned long s3c64xx_clk_arm_get_rate(struct clk *clk)
490{
491 unsigned long rate = clk_get_rate(clk->parent);
492 u32 clkdiv;
493
494 /* divisor mask starts at bit0, so no need to shift */
495 clkdiv = __raw_readl(S3C_CLK_DIV0) & armclk_mask;
496
497 return rate / (clkdiv + 1);
498}
499
500static unsigned long s3c64xx_clk_arm_round_rate(struct clk *clk,
501 unsigned long rate)
502{
503 unsigned long parent = clk_get_rate(clk->parent);
504 u32 div;
505
506 if (parent < rate)
507 return parent;
508
509 div = (parent / rate) - 1;
510 if (div > armclk_mask)
511 div = armclk_mask;
512
513 return parent / (div + 1);
514}
515
516static int s3c64xx_clk_arm_set_rate(struct clk *clk, unsigned long rate)
517{
518 unsigned long parent = clk_get_rate(clk->parent);
519 u32 div;
520 u32 val;
521
522 if (rate < parent / (armclk_mask + 1))
523 return -EINVAL;
524
525 rate = clk_round_rate(clk, rate);
526 div = clk_get_rate(clk->parent) / rate;
527
528 val = __raw_readl(S3C_CLK_DIV0);
529 val &= ~armclk_mask;
530 val |= (div - 1);
531 __raw_writel(val, S3C_CLK_DIV0);
532
533 return 0;
534
535}
536
537static struct clk clk_arm = {
538 .name = "armclk",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900539 .parent = &clk_mout_apll.clk,
540 .ops = &(struct clk_ops) {
541 .get_rate = s3c64xx_clk_arm_get_rate,
542 .set_rate = s3c64xx_clk_arm_set_rate,
543 .round_rate = s3c64xx_clk_arm_round_rate,
544 },
545};
546
547static unsigned long s3c64xx_clk_doutmpll_get_rate(struct clk *clk)
548{
549 unsigned long rate = clk_get_rate(clk->parent);
550
551 printk(KERN_DEBUG "%s: parent is %ld\n", __func__, rate);
552
553 if (__raw_readl(S3C_CLK_DIV0) & S3C6400_CLKDIV0_MPLL_MASK)
554 rate /= 2;
555
556 return rate;
557}
558
559static struct clk_ops clk_dout_ops = {
560 .get_rate = s3c64xx_clk_doutmpll_get_rate,
561};
562
563static struct clk clk_dout_mpll = {
564 .name = "dout_mpll",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900565 .parent = &clk_mout_mpll.clk,
566 .ops = &clk_dout_ops,
567};
568
569static struct clk *clkset_spi_mmc_list[] = {
570 &clk_mout_epll.clk,
571 &clk_dout_mpll,
572 &clk_fin_epll,
573 &clk_27m,
574};
575
576static struct clksrc_sources clkset_spi_mmc = {
577 .sources = clkset_spi_mmc_list,
578 .nr_sources = ARRAY_SIZE(clkset_spi_mmc_list),
579};
580
581static struct clk *clkset_irda_list[] = {
582 &clk_mout_epll.clk,
583 &clk_dout_mpll,
584 NULL,
585 &clk_27m,
586};
587
588static struct clksrc_sources clkset_irda = {
589 .sources = clkset_irda_list,
590 .nr_sources = ARRAY_SIZE(clkset_irda_list),
591};
592
593static struct clk *clkset_uart_list[] = {
594 &clk_mout_epll.clk,
595 &clk_dout_mpll,
596 NULL,
597 NULL
598};
599
600static struct clksrc_sources clkset_uart = {
601 .sources = clkset_uart_list,
602 .nr_sources = ARRAY_SIZE(clkset_uart_list),
603};
604
605static struct clk *clkset_uhost_list[] = {
606 &clk_48m,
607 &clk_mout_epll.clk,
608 &clk_dout_mpll,
609 &clk_fin_epll,
610};
611
612static struct clksrc_sources clkset_uhost = {
613 .sources = clkset_uhost_list,
614 .nr_sources = ARRAY_SIZE(clkset_uhost_list),
615};
616
617/* The peripheral clocks are all controlled via clocksource followed
618 * by an optional divider and gate stage. We currently roll this into
619 * one clock which hides the intermediate clock from the mux.
620 *
621 * Note, the JPEG clock can only be an even divider...
622 *
623 * The scaler and LCD clocks depend on the S3C64XX version, and also
624 * have a common parent divisor so are not included here.
625 */
626
627/* clocks that feed other parts of the clock source tree */
628
629static struct clk clk_iis_cd0 = {
630 .name = "iis_cdclk0",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900631};
632
633static struct clk clk_iis_cd1 = {
634 .name = "iis_cdclk1",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900635};
636
Jassi Brarbc8eb1e2010-03-09 15:10:32 +0900637static struct clk clk_iisv4_cd = {
638 .name = "iis_cdclk_v4",
Jassi Brarbc8eb1e2010-03-09 15:10:32 +0900639};
640
Ben Dooks62acb2f82010-01-26 14:53:19 +0900641static struct clk clk_pcm_cd = {
642 .name = "pcm_cdclk",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900643};
644
645static struct clk *clkset_audio0_list[] = {
646 [0] = &clk_mout_epll.clk,
647 [1] = &clk_dout_mpll,
648 [2] = &clk_fin_epll,
649 [3] = &clk_iis_cd0,
650 [4] = &clk_pcm_cd,
651};
652
653static struct clksrc_sources clkset_audio0 = {
654 .sources = clkset_audio0_list,
655 .nr_sources = ARRAY_SIZE(clkset_audio0_list),
656};
657
658static struct clk *clkset_audio1_list[] = {
659 [0] = &clk_mout_epll.clk,
660 [1] = &clk_dout_mpll,
661 [2] = &clk_fin_epll,
662 [3] = &clk_iis_cd1,
663 [4] = &clk_pcm_cd,
664};
665
666static struct clksrc_sources clkset_audio1 = {
667 .sources = clkset_audio1_list,
668 .nr_sources = ARRAY_SIZE(clkset_audio1_list),
669};
670
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800671#ifdef CONFIG_CPU_S3C6410
Jassi Brar1aede2e2010-03-09 15:10:33 +0900672static struct clk *clkset_audio2_list[] = {
673 [0] = &clk_mout_epll.clk,
674 [1] = &clk_dout_mpll,
675 [2] = &clk_fin_epll,
676 [3] = &clk_iisv4_cd,
677 [4] = &clk_pcm_cd,
678};
679
680static struct clksrc_sources clkset_audio2 = {
681 .sources = clkset_audio2_list,
682 .nr_sources = ARRAY_SIZE(clkset_audio2_list),
683};
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800684#endif
Jassi Brar1aede2e2010-03-09 15:10:33 +0900685
Ben Dooks62acb2f82010-01-26 14:53:19 +0900686static struct clksrc_clk clksrcs[] = {
687 {
688 .clk = {
Ben Dooks62acb2f82010-01-26 14:53:19 +0900689 .name = "usb-bus-host",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900690 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
691 .enable = s3c64xx_sclk_ctrl,
692 },
693 .reg_src = { .reg = S3C_CLK_SRC, .shift = 5, .size = 2 },
694 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 20, .size = 4 },
695 .sources = &clkset_uhost,
696 }, {
697 .clk = {
Ben Dooks62acb2f82010-01-26 14:53:19 +0900698 .name = "irda-bus",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900699 .ctrlbit = S3C_CLKCON_SCLK_IRDA,
700 .enable = s3c64xx_sclk_ctrl,
701 },
702 .reg_src = { .reg = S3C_CLK_SRC, .shift = 24, .size = 2 },
703 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 20, .size = 4 },
704 .sources = &clkset_irda,
705 }, {
706 .clk = {
707 .name = "camera",
Ben Dooks62acb2f82010-01-26 14:53:19 +0900708 .ctrlbit = S3C_CLKCON_SCLK_CAM,
709 .enable = s3c64xx_sclk_ctrl,
Andrey Gusakov9213c502012-11-12 13:19:23 +0900710 .parent = &clk_h2,
Ben Dooks62acb2f82010-01-26 14:53:19 +0900711 },
712 .reg_div = { .reg = S3C_CLK_DIV0, .shift = 20, .size = 4 },
Ben Dooks62acb2f82010-01-26 14:53:19 +0900713 },
714};
715
Thomas Abraham0cfb26e2011-10-24 12:08:42 +0200716/* Where does UCLK0 come from? */
717static struct clksrc_clk clk_sclk_uclk = {
718 .clk = {
719 .name = "uclk1",
720 .ctrlbit = S3C_CLKCON_SCLK_UART,
721 .enable = s3c64xx_sclk_ctrl,
722 },
723 .reg_src = { .reg = S3C_CLK_SRC, .shift = 13, .size = 1 },
724 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 16, .size = 4 },
725 .sources = &clkset_uart,
726};
727
Rajeshwari Shindea361d102011-10-24 17:05:58 +0200728static struct clksrc_clk clk_sclk_mmc0 = {
729 .clk = {
730 .name = "mmc_bus",
731 .devname = "s3c-sdhci.0",
732 .ctrlbit = S3C_CLKCON_SCLK_MMC0,
733 .enable = s3c64xx_sclk_ctrl,
734 },
735 .reg_src = { .reg = S3C_CLK_SRC, .shift = 18, .size = 2 },
736 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 0, .size = 4 },
737 .sources = &clkset_spi_mmc,
738};
739
740static struct clksrc_clk clk_sclk_mmc1 = {
741 .clk = {
742 .name = "mmc_bus",
743 .devname = "s3c-sdhci.1",
744 .ctrlbit = S3C_CLKCON_SCLK_MMC1,
745 .enable = s3c64xx_sclk_ctrl,
746 },
747 .reg_src = { .reg = S3C_CLK_SRC, .shift = 20, .size = 2 },
748 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 4, .size = 4 },
749 .sources = &clkset_spi_mmc,
750};
751
752static struct clksrc_clk clk_sclk_mmc2 = {
753 .clk = {
754 .name = "mmc_bus",
755 .devname = "s3c-sdhci.2",
756 .ctrlbit = S3C_CLKCON_SCLK_MMC2,
757 .enable = s3c64xx_sclk_ctrl,
758 },
759 .reg_src = { .reg = S3C_CLK_SRC, .shift = 22, .size = 2 },
760 .reg_div = { .reg = S3C_CLK_DIV1, .shift = 8, .size = 4 },
761 .sources = &clkset_spi_mmc,
762};
763
Padmavathi Vennaba479172011-11-02 20:04:08 +0900764static struct clksrc_clk clk_sclk_spi0 = {
765 .clk = {
766 .name = "spi-bus",
Thomas Abrahama5238e32012-07-13 07:15:14 +0900767 .devname = "s3c6410-spi.0",
Padmavathi Vennaba479172011-11-02 20:04:08 +0900768 .ctrlbit = S3C_CLKCON_SCLK_SPI0,
769 .enable = s3c64xx_sclk_ctrl,
770 },
771 .reg_src = { .reg = S3C_CLK_SRC, .shift = 14, .size = 2 },
772 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 0, .size = 4 },
773 .sources = &clkset_spi_mmc,
774};
775
776static struct clksrc_clk clk_sclk_spi1 = {
777 .clk = {
778 .name = "spi-bus",
Thomas Abrahama5238e32012-07-13 07:15:14 +0900779 .devname = "s3c6410-spi.1",
Padmavathi Vennaba479172011-11-02 20:04:08 +0900780 .ctrlbit = S3C_CLKCON_SCLK_SPI1,
781 .enable = s3c64xx_sclk_ctrl,
782 },
783 .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 },
784 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 4, .size = 4 },
785 .sources = &clkset_spi_mmc,
786};
787
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800788static struct clksrc_clk clk_audio_bus0 = {
789 .clk = {
790 .name = "audio-bus",
791 .devname = "samsung-i2s.0",
792 .ctrlbit = S3C_CLKCON_SCLK_AUDIO0,
793 .enable = s3c64xx_sclk_ctrl,
794 },
795 .reg_src = { .reg = S3C_CLK_SRC, .shift = 7, .size = 3 },
796 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 8, .size = 4 },
797 .sources = &clkset_audio0,
798};
799
800static struct clksrc_clk clk_audio_bus1 = {
801 .clk = {
802 .name = "audio-bus",
803 .devname = "samsung-i2s.1",
804 .ctrlbit = S3C_CLKCON_SCLK_AUDIO1,
805 .enable = s3c64xx_sclk_ctrl,
806 },
807 .reg_src = { .reg = S3C_CLK_SRC, .shift = 10, .size = 3 },
808 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 12, .size = 4 },
809 .sources = &clkset_audio1,
810};
811
812#ifdef CONFIG_CPU_S3C6410
813static struct clksrc_clk clk_audio_bus2 = {
814 .clk = {
815 .name = "audio-bus",
816 .devname = "samsung-i2s.2",
817 .ctrlbit = S3C6410_CLKCON_SCLK_AUDIO2,
818 .enable = s3c64xx_sclk_ctrl,
819 },
820 .reg_src = { .reg = S3C6410_CLK_SRC2, .shift = 0, .size = 3 },
821 .reg_div = { .reg = S3C_CLK_DIV2, .shift = 24, .size = 4 },
822 .sources = &clkset_audio2,
823};
824#endif
Ben Dooks62acb2f82010-01-26 14:53:19 +0900825/* Clock initialisation code */
826
827static struct clksrc_clk *init_parents[] = {
828 &clk_mout_apll,
829 &clk_mout_epll,
830 &clk_mout_mpll,
831};
832
Thomas Abraham0cfb26e2011-10-24 12:08:42 +0200833static struct clksrc_clk *clksrc_cdev[] = {
834 &clk_sclk_uclk,
Rajeshwari Shindea361d102011-10-24 17:05:58 +0200835 &clk_sclk_mmc0,
836 &clk_sclk_mmc1,
837 &clk_sclk_mmc2,
Padmavathi Vennaba479172011-11-02 20:04:08 +0900838 &clk_sclk_spi0,
839 &clk_sclk_spi1,
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800840 &clk_audio_bus0,
841 &clk_audio_bus1,
Rajeshwari Shindea361d102011-10-24 17:05:58 +0200842};
843
844static struct clk *clk_cdev[] = {
845 &clk_hsmmc0,
846 &clk_hsmmc1,
847 &clk_hsmmc2,
Padmavathi Vennaba479172011-11-02 20:04:08 +0900848 &clk_48m_spi0,
849 &clk_48m_spi1,
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800850 &clk_i2s0,
851 &clk_i2s1,
Thomas Abraham0cfb26e2011-10-24 12:08:42 +0200852};
853
854static struct clk_lookup s3c64xx_clk_lookup[] = {
855 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
856 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
Rajeshwari Shindea361d102011-10-24 17:05:58 +0200857 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &clk_hsmmc0),
858 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &clk_hsmmc1),
859 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.0", &clk_hsmmc2),
860 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
861 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
862 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
Padmavathi Vennaba479172011-11-02 20:04:08 +0900863 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
Thomas Abrahama5238e32012-07-13 07:15:14 +0900864 CLKDEV_INIT("s3c6410-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
865 CLKDEV_INIT("s3c6410-spi.0", "spi_busclk2", &clk_48m_spi0),
866 CLKDEV_INIT("s3c6410-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
867 CLKDEV_INIT("s3c6410-spi.1", "spi_busclk2", &clk_48m_spi1),
Padmavathi Vennadb7af962012-12-19 09:49:29 -0800868 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
869 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &clk_audio_bus0.clk),
870 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk0", &clk_i2s1),
871 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk1", &clk_audio_bus1.clk),
872#ifdef CONFIG_CPU_S3C6410
873 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk0", &clk_i2s2),
874 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk1", &clk_audio_bus2.clk),
875#endif
Thomas Abraham0cfb26e2011-10-24 12:08:42 +0200876};
877
Ben Dooks62acb2f82010-01-26 14:53:19 +0900878#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
879
Kukjin Kimb024043b2011-12-22 23:27:42 +0100880void __init_or_cpufreq s3c64xx_setup_clocks(void)
Ben Dooks62acb2f82010-01-26 14:53:19 +0900881{
882 struct clk *xtal_clk;
883 unsigned long xtal;
884 unsigned long fclk;
885 unsigned long hclk;
886 unsigned long hclk2;
887 unsigned long pclk;
888 unsigned long epll;
889 unsigned long apll;
890 unsigned long mpll;
891 unsigned int ptr;
892 u32 clkdiv0;
893
894 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
895
896 clkdiv0 = __raw_readl(S3C_CLK_DIV0);
897 printk(KERN_DEBUG "%s: clkdiv0 = %08x\n", __func__, clkdiv0);
898
899 xtal_clk = clk_get(NULL, "xtal");
900 BUG_ON(IS_ERR(xtal_clk));
901
902 xtal = clk_get_rate(xtal_clk);
903 clk_put(xtal_clk);
904
905 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
906
907 /* For now assume the mux always selects the crystal */
908 clk_ext_xtal_mux.parent = xtal_clk;
909
Kukjin Kim52e329e2011-10-04 19:41:43 +0900910 epll = s3c_get_pll6553x(xtal, __raw_readl(S3C_EPLL_CON0),
911 __raw_readl(S3C_EPLL_CON1));
Ben Dooks62acb2f82010-01-26 14:53:19 +0900912 mpll = s3c6400_get_pll(xtal, __raw_readl(S3C_MPLL_CON));
913 apll = s3c6400_get_pll(xtal, __raw_readl(S3C_APLL_CON));
914
915 fclk = mpll;
916
917 printk(KERN_INFO "S3C64XX: PLL settings, A=%ld, M=%ld, E=%ld\n",
918 apll, mpll, epll);
919
Tomasz Figafb5d3752011-08-19 11:54:31 +0200920 if(__raw_readl(S3C64XX_OTHERS) & S3C64XX_OTHERS_SYNCMUXSEL)
921 /* Synchronous mode */
922 hclk2 = apll / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK2);
923 else
924 /* Asynchronous mode */
925 hclk2 = mpll / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK2);
926
Ben Dooks62acb2f82010-01-26 14:53:19 +0900927 hclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_HCLK);
928 pclk = hclk2 / GET_DIV(clkdiv0, S3C6400_CLKDIV0_PCLK);
929
930 printk(KERN_INFO "S3C64XX: HCLK2=%ld, HCLK=%ld, PCLK=%ld\n",
931 hclk2, hclk, pclk);
932
933 clk_fout_mpll.rate = mpll;
934 clk_fout_epll.rate = epll;
935 clk_fout_apll.rate = apll;
936
937 clk_h2.rate = hclk2;
938 clk_h.rate = hclk;
939 clk_p.rate = pclk;
940 clk_f.rate = fclk;
941
942 for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++)
943 s3c_set_clksrc(init_parents[ptr], true);
944
945 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
946 s3c_set_clksrc(&clksrcs[ptr], true);
947}
948
949static struct clk *clks1[] __initdata = {
950 &clk_ext_xtal_mux,
951 &clk_iis_cd0,
952 &clk_iis_cd1,
Jassi Brarbc8eb1e2010-03-09 15:10:32 +0900953 &clk_iisv4_cd,
Ben Dooks62acb2f82010-01-26 14:53:19 +0900954 &clk_pcm_cd,
955 &clk_mout_epll.clk,
956 &clk_mout_mpll.clk,
957 &clk_dout_mpll,
958 &clk_arm,
959};
960
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100961static struct clk *clks[] __initdata = {
962 &clk_ext,
963 &clk_epll,
964 &clk_27m,
965 &clk_48m,
Werner Almesbergera03f7da2009-03-05 11:43:13 +0800966 &clk_h2,
Maurus Cuelenaere05e021f2010-05-17 20:17:42 +0200967 &clk_xusbxti,
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100968};
969
Ben Dooks55bf9262010-01-26 15:10:38 +0900970/**
971 * s3c64xx_register_clocks - register clocks for s3c6400 and s3c6410
972 * @xtal: The rate for the clock crystal feeding the PLLs.
973 * @armclk_divlimit: Divisor mask for ARMCLK.
974 *
975 * Register the clocks for the S3C6400 and S3C6410 SoC range, such
976 * as ARMCLK as well as the necessary parent clocks.
977 *
978 * This call does not setup the clocks, which is left to the
Kukjin Kimb024043b2011-12-22 23:27:42 +0100979 * s3c64xx_setup_clocks() call which may be needed by the cpufreq
Ben Dooks55bf9262010-01-26 15:10:38 +0900980 * or resume code to re-set the clocks if the bootloader has changed
981 * them.
982 */
983void __init s3c64xx_register_clocks(unsigned long xtal,
984 unsigned armclk_divlimit)
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100985{
Thomas Abraham0cfb26e2011-10-24 12:08:42 +0200986 unsigned int cnt;
987
Ben Dooks55bf9262010-01-26 15:10:38 +0900988 armclk_mask = armclk_divlimit;
989
990 s3c24xx_register_baseclocks(xtal);
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100991 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
Ben Dooks55bf9262010-01-26 15:10:38 +0900992
Ben Dooks1d9f13c2010-01-06 01:21:38 +0900993 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
Ben Dooks4b31d8b2008-10-21 14:07:00 +0100994
Kukjin Kimcdb216d2011-01-04 18:27:18 +0900995 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
996 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
Ben Dooks9d325f22008-11-21 10:36:05 +0000997
Rajeshwari Shindea361d102011-10-24 17:05:58 +0200998 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
999 for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++)
1000 s3c_disable_clocks(clk_cdev[cnt], 1);
1001
Ben Dooks55bf9262010-01-26 15:10:38 +09001002 s3c24xx_register_clocks(clks1, ARRAY_SIZE(clks1));
1003 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
Thomas Abraham0cfb26e2011-10-24 12:08:42 +02001004 for (cnt = 0; cnt < ARRAY_SIZE(clksrc_cdev); cnt++)
1005 s3c_register_clksrc(clksrc_cdev[cnt], 1);
1006 clkdev_add_table(s3c64xx_clk_lookup, ARRAY_SIZE(s3c64xx_clk_lookup));
Ben Dooks4b31d8b2008-10-21 14:07:00 +01001007}