blob: d8b20ee8cc8cf635fbe1d874ae4380dfb9ade19b [file] [log] [blame]
Kukjin Kim3109e552010-09-01 15:35:30 +09001/* linux/arch/arm/mach-s5p64x0/clock-s5p6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6450 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/sysdev.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26#include <mach/s5p64x0-clock.h>
27
28#include <plat/cpu-freq.h>
29#include <plat/clock.h>
30#include <plat/cpu.h>
31#include <plat/pll.h>
32#include <plat/s5p-clock.h>
33#include <plat/clock-clksrc.h>
34#include <plat/s5p6450.h>
35
36static struct clksrc_clk clk_mout_dpll = {
37 .clk = {
38 .name = "mout_dpll",
39 .id = -1,
40 },
41 .sources = &clk_src_dpll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 5, .size = 1 },
43};
44
45static u32 epll_div[][5] = {
46 { 133000000, 27307, 55, 2, 2 },
47 { 100000000, 43691, 41, 2, 2 },
48 { 480000000, 0, 80, 2, 0 },
49};
50
51static int s5p6450_epll_set_rate(struct clk *clk, unsigned long rate)
52{
53 unsigned int epll_con, epll_con_k;
54 unsigned int i;
55
56 if (clk->rate == rate) /* Return if nothing changed */
57 return 0;
58
59 epll_con = __raw_readl(S5P64X0_EPLL_CON);
60 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
61
62 epll_con_k &= ~(PLL90XX_KDIV_MASK);
63 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
64
65 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
66 if (epll_div[i][0] == rate) {
67 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
68 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
69 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
70 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
71 break;
72 }
73 }
74
75 if (i == ARRAY_SIZE(epll_div)) {
76 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
77 return -EINVAL;
78 }
79
80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82
Seungwhan Youn96166742010-10-14 10:39:33 +090083 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
84 clk->rate, rate);
85
Kukjin Kim3109e552010-09-01 15:35:30 +090086 clk->rate = rate;
87
88 return 0;
89}
90
91static struct clk_ops s5p6450_epll_ops = {
Seungwhan Yound4b34c62010-10-14 10:39:08 +090092 .get_rate = s5p_epll_get_rate,
Kukjin Kim3109e552010-09-01 15:35:30 +090093 .set_rate = s5p6450_epll_set_rate,
94};
95
96static struct clksrc_clk clk_dout_epll = {
97 .clk = {
98 .name = "dout_epll",
99 .id = -1,
100 .parent = &clk_mout_epll.clk,
101 },
102 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 24, .size = 4 },
103};
104
105static struct clksrc_clk clk_mout_hclk_sel = {
106 .clk = {
107 .name = "mout_hclk_sel",
108 .id = -1,
109 },
110 .sources = &clkset_hclk_low,
111 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 15, .size = 1 },
112};
113
114static struct clk *clkset_hclk_list[] = {
115 &clk_mout_hclk_sel.clk,
116 &clk_armclk.clk,
117};
118
119static struct clksrc_sources clkset_hclk = {
120 .sources = clkset_hclk_list,
121 .nr_sources = ARRAY_SIZE(clkset_hclk_list),
122};
123
124static struct clksrc_clk clk_hclk = {
125 .clk = {
126 .name = "clk_hclk",
127 .id = -1,
128 },
129 .sources = &clkset_hclk,
130 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 14, .size = 1 },
131 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
132};
133
134static struct clksrc_clk clk_pclk = {
135 .clk = {
136 .name = "clk_pclk",
137 .id = -1,
138 .parent = &clk_hclk.clk,
139 },
140 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
141};
142static struct clksrc_clk clk_dout_pwm_ratio0 = {
143 .clk = {
144 .name = "clk_dout_pwm_ratio0",
145 .id = -1,
146 .parent = &clk_mout_hclk_sel.clk,
147 },
148 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 16, .size = 4 },
149};
150
151static struct clksrc_clk clk_pclk_to_wdt_pwm = {
152 .clk = {
153 .name = "clk_pclk_to_wdt_pwm",
154 .id = -1,
155 .parent = &clk_dout_pwm_ratio0.clk,
156 },
157 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 20, .size = 4 },
158};
159
160static struct clksrc_clk clk_hclk_low = {
161 .clk = {
162 .name = "clk_hclk_low",
163 .id = -1,
164 },
165 .sources = &clkset_hclk_low,
166 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 6, .size = 1 },
167 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
168};
169
170static struct clksrc_clk clk_pclk_low = {
171 .clk = {
172 .name = "clk_pclk_low",
173 .id = -1,
174 .parent = &clk_hclk_low.clk,
175 },
176 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
177};
178
179/*
180 * The following clocks will be disabled during clock initialization. It is
181 * recommended to keep the following clocks disabled until the driver requests
182 * for enabling the clock.
183 */
184static struct clk init_clocks_disable[] = {
185 {
186 .name = "usbhost",
187 .id = -1,
188 .parent = &clk_hclk_low.clk,
189 .enable = s5p64x0_hclk0_ctrl,
190 .ctrlbit = (1 << 3),
191 }, {
Seungwhan Younb05d8532010-10-19 18:13:11 +0900192 .name = "pdma",
193 .id = -1,
194 .parent = &clk_hclk_low.clk,
195 .enable = s5p64x0_hclk0_ctrl,
196 .ctrlbit = (1 << 12),
197 }, {
Kukjin Kim3109e552010-09-01 15:35:30 +0900198 .name = "hsmmc",
199 .id = 0,
200 .parent = &clk_hclk_low.clk,
201 .enable = s5p64x0_hclk0_ctrl,
202 .ctrlbit = (1 << 17),
203 }, {
204 .name = "hsmmc",
205 .id = 1,
206 .parent = &clk_hclk_low.clk,
207 .enable = s5p64x0_hclk0_ctrl,
208 .ctrlbit = (1 << 18),
209 }, {
210 .name = "hsmmc",
211 .id = 2,
212 .parent = &clk_hclk_low.clk,
213 .enable = s5p64x0_hclk0_ctrl,
214 .ctrlbit = (1 << 19),
215 }, {
216 .name = "usbotg",
217 .id = -1,
218 .parent = &clk_hclk_low.clk,
219 .enable = s5p64x0_hclk0_ctrl,
220 .ctrlbit = (1 << 20),
221 }, {
222 .name = "lcd",
223 .id = -1,
224 .parent = &clk_h,
225 .enable = s5p64x0_hclk1_ctrl,
226 .ctrlbit = (1 << 1),
227 }, {
228 .name = "watchdog",
229 .id = -1,
230 .parent = &clk_pclk_low.clk,
231 .enable = s5p64x0_pclk_ctrl,
232 .ctrlbit = (1 << 5),
233 }, {
234 .name = "adc",
235 .id = -1,
236 .parent = &clk_pclk_low.clk,
237 .enable = s5p64x0_pclk_ctrl,
238 .ctrlbit = (1 << 12),
239 }, {
240 .name = "i2c",
241 .id = 0,
242 .parent = &clk_pclk_low.clk,
243 .enable = s5p64x0_pclk_ctrl,
244 .ctrlbit = (1 << 17),
245 }, {
246 .name = "spi",
247 .id = 0,
248 .parent = &clk_pclk_low.clk,
249 .enable = s5p64x0_pclk_ctrl,
250 .ctrlbit = (1 << 21),
251 }, {
252 .name = "spi",
253 .id = 1,
254 .parent = &clk_pclk_low.clk,
255 .enable = s5p64x0_pclk_ctrl,
256 .ctrlbit = (1 << 22),
257 }, {
258 .name = "iis",
Jassi Brard9a93c32010-11-19 08:49:44 +0900259 .id = 0,
Kukjin Kim3109e552010-09-01 15:35:30 +0900260 .parent = &clk_pclk_low.clk,
261 .enable = s5p64x0_pclk_ctrl,
262 .ctrlbit = (1 << 26),
263 }, {
Jassi Brar6cb26da2010-12-21 09:44:36 +0900264 .name = "iis",
265 .id = 1,
266 .parent = &clk_pclk_low.clk,
267 .enable = s5p64x0_pclk_ctrl,
268 .ctrlbit = (1 << 15),
269 }, {
270 .name = "iis",
271 .id = 2,
272 .parent = &clk_pclk_low.clk,
273 .enable = s5p64x0_pclk_ctrl,
274 .ctrlbit = (1 << 16),
275 }, {
Kukjin Kim3109e552010-09-01 15:35:30 +0900276 .name = "i2c",
277 .id = 1,
278 .parent = &clk_pclk_low.clk,
279 .enable = s5p64x0_pclk_ctrl,
280 .ctrlbit = (1 << 27),
281 }, {
282 .name = "dmc0",
283 .id = -1,
284 .parent = &clk_pclk.clk,
285 .enable = s5p64x0_pclk_ctrl,
286 .ctrlbit = (1 << 30),
287 }
288};
289
290/*
291 * The following clocks will be enabled during clock initialization.
292 */
293static struct clk init_clocks[] = {
294 {
295 .name = "intc",
296 .id = -1,
297 .parent = &clk_hclk.clk,
298 .enable = s5p64x0_hclk0_ctrl,
299 .ctrlbit = (1 << 1),
300 }, {
301 .name = "mem",
302 .id = -1,
303 .parent = &clk_hclk.clk,
304 .enable = s5p64x0_hclk0_ctrl,
305 .ctrlbit = (1 << 21),
306 }, {
Kukjin Kim3109e552010-09-01 15:35:30 +0900307 .name = "uart",
308 .id = 0,
309 .parent = &clk_pclk_low.clk,
310 .enable = s5p64x0_pclk_ctrl,
311 .ctrlbit = (1 << 1),
312 }, {
313 .name = "uart",
314 .id = 1,
315 .parent = &clk_pclk_low.clk,
316 .enable = s5p64x0_pclk_ctrl,
317 .ctrlbit = (1 << 2),
318 }, {
319 .name = "uart",
320 .id = 2,
321 .parent = &clk_pclk_low.clk,
322 .enable = s5p64x0_pclk_ctrl,
323 .ctrlbit = (1 << 3),
324 }, {
325 .name = "uart",
326 .id = 3,
327 .parent = &clk_pclk_low.clk,
328 .enable = s5p64x0_pclk_ctrl,
329 .ctrlbit = (1 << 4),
330 }, {
331 .name = "timers",
332 .id = -1,
333 .parent = &clk_pclk_to_wdt_pwm.clk,
334 .enable = s5p64x0_pclk_ctrl,
335 .ctrlbit = (1 << 7),
336 }, {
337 .name = "gpio",
338 .id = -1,
339 .parent = &clk_pclk_low.clk,
340 .enable = s5p64x0_pclk_ctrl,
341 .ctrlbit = (1 << 18),
342 },
343};
344
345static struct clk *clkset_uart_list[] = {
346 &clk_dout_epll.clk,
347 &clk_dout_mpll.clk,
348};
349
350static struct clksrc_sources clkset_uart = {
351 .sources = clkset_uart_list,
352 .nr_sources = ARRAY_SIZE(clkset_uart_list),
353};
354
355static struct clk *clkset_mali_list[] = {
356 &clk_mout_epll.clk,
357 &clk_mout_apll.clk,
358 &clk_mout_mpll.clk,
359};
360
361static struct clksrc_sources clkset_mali = {
362 .sources = clkset_mali_list,
363 .nr_sources = ARRAY_SIZE(clkset_mali_list),
364};
365
366static struct clk *clkset_group2_list[] = {
367 &clk_dout_epll.clk,
368 &clk_dout_mpll.clk,
369 &clk_ext_xtal_mux,
370};
371
372static struct clksrc_sources clkset_group2 = {
373 .sources = clkset_group2_list,
374 .nr_sources = ARRAY_SIZE(clkset_group2_list),
375};
376
377static struct clk *clkset_dispcon_list[] = {
378 &clk_dout_epll.clk,
379 &clk_dout_mpll.clk,
380 &clk_ext_xtal_mux,
381 &clk_mout_dpll.clk,
382};
383
384static struct clksrc_sources clkset_dispcon = {
385 .sources = clkset_dispcon_list,
386 .nr_sources = ARRAY_SIZE(clkset_dispcon_list),
387};
388
389static struct clk *clkset_hsmmc44_list[] = {
390 &clk_dout_epll.clk,
391 &clk_dout_mpll.clk,
392 &clk_ext_xtal_mux,
393 &s5p_clk_27m,
394 &clk_48m,
395};
396
397static struct clksrc_sources clkset_hsmmc44 = {
398 .sources = clkset_hsmmc44_list,
399 .nr_sources = ARRAY_SIZE(clkset_hsmmc44_list),
400};
401
402static struct clk *clkset_sclk_audio0_list[] = {
403 [0] = &clk_dout_epll.clk,
404 [1] = &clk_dout_mpll.clk,
405 [2] = &clk_ext_xtal_mux,
406 [3] = NULL,
407 [4] = NULL,
408};
409
410static struct clksrc_sources clkset_sclk_audio0 = {
411 .sources = clkset_sclk_audio0_list,
412 .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list),
413};
414
415static struct clksrc_clk clk_sclk_audio0 = {
416 .clk = {
417 .name = "audio-bus",
418 .id = -1,
419 .enable = s5p64x0_sclk_ctrl,
420 .ctrlbit = (1 << 8),
421 .parent = &clk_dout_epll.clk,
422 },
423 .sources = &clkset_sclk_audio0,
424 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 10, .size = 3 },
425 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 8, .size = 4 },
426};
427
428static struct clksrc_clk clksrcs[] = {
429 {
430 .clk = {
431 .name = "sclk_mmc",
432 .id = 0,
433 .ctrlbit = (1 << 24),
434 .enable = s5p64x0_sclk_ctrl,
435 },
436 .sources = &clkset_group2,
437 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
438 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
439 }, {
440 .clk = {
441 .name = "sclk_mmc",
442 .id = 1,
443 .ctrlbit = (1 << 25),
444 .enable = s5p64x0_sclk_ctrl,
445 },
446 .sources = &clkset_group2,
447 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
448 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
449 }, {
450 .clk = {
451 .name = "sclk_mmc",
452 .id = 2,
453 .ctrlbit = (1 << 26),
454 .enable = s5p64x0_sclk_ctrl,
455 },
456 .sources = &clkset_group2,
457 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
458 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
459 }, {
460 .clk = {
461 .name = "uclk1",
462 .id = -1,
463 .ctrlbit = (1 << 5),
464 .enable = s5p64x0_sclk_ctrl,
465 },
466 .sources = &clkset_uart,
467 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
468 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
469 }, {
470 .clk = {
471 .name = "sclk_spi",
472 .id = 0,
473 .ctrlbit = (1 << 20),
474 .enable = s5p64x0_sclk_ctrl,
475 },
476 .sources = &clkset_group2,
477 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
478 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
479 }, {
480 .clk = {
481 .name = "sclk_spi",
482 .id = 1,
483 .ctrlbit = (1 << 21),
484 .enable = s5p64x0_sclk_ctrl,
485 },
486 .sources = &clkset_group2,
487 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
488 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
489 }, {
490 .clk = {
491 .name = "sclk_fimc",
492 .id = -1,
493 .ctrlbit = (1 << 10),
494 .enable = s5p64x0_sclk_ctrl,
495 },
496 .sources = &clkset_group2,
497 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
498 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
499 }, {
500 .clk = {
501 .name = "aclk_mali",
502 .id = -1,
503 .ctrlbit = (1 << 2),
504 .enable = s5p64x0_sclk1_ctrl,
505 },
506 .sources = &clkset_mali,
507 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
508 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
509 }, {
510 .clk = {
511 .name = "sclk_2d",
512 .id = -1,
513 .ctrlbit = (1 << 12),
514 .enable = s5p64x0_sclk_ctrl,
515 },
516 .sources = &clkset_mali,
517 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 30, .size = 2 },
518 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 20, .size = 4 },
519 }, {
520 .clk = {
521 .name = "sclk_usi",
522 .id = -1,
523 .ctrlbit = (1 << 7),
524 .enable = s5p64x0_sclk_ctrl,
525 },
526 .sources = &clkset_group2,
527 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 10, .size = 2 },
528 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 16, .size = 4 },
529 }, {
530 .clk = {
531 .name = "sclk_camif",
532 .id = -1,
533 .ctrlbit = (1 << 6),
534 .enable = s5p64x0_sclk_ctrl,
535 },
536 .sources = &clkset_group2,
537 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 28, .size = 2 },
538 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 20, .size = 4 },
539 }, {
540 .clk = {
541 .name = "sclk_dispcon",
542 .id = -1,
543 .ctrlbit = (1 << 1),
544 .enable = s5p64x0_sclk1_ctrl,
545 },
546 .sources = &clkset_dispcon,
547 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
548 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
549 }, {
550 .clk = {
551 .name = "sclk_hsmmc44",
552 .id = -1,
553 .ctrlbit = (1 << 30),
554 .enable = s5p64x0_sclk_ctrl,
555 },
556 .sources = &clkset_hsmmc44,
557 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 6, .size = 3 },
558 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 28, .size = 4 },
559 },
560};
561
562/* Clock initialization code */
563static struct clksrc_clk *sysclks[] = {
564 &clk_mout_apll,
565 &clk_mout_epll,
566 &clk_dout_epll,
567 &clk_mout_mpll,
568 &clk_dout_mpll,
569 &clk_armclk,
570 &clk_mout_hclk_sel,
571 &clk_dout_pwm_ratio0,
572 &clk_pclk_to_wdt_pwm,
573 &clk_hclk,
574 &clk_pclk,
575 &clk_hclk_low,
576 &clk_pclk_low,
577 &clk_sclk_audio0,
578};
579
580void __init_or_cpufreq s5p6450_setup_clocks(void)
581{
582 struct clk *xtal_clk;
583
584 unsigned long xtal;
585 unsigned long fclk;
586 unsigned long hclk;
587 unsigned long hclk_low;
588 unsigned long pclk;
589 unsigned long pclk_low;
590
591 unsigned long apll;
592 unsigned long mpll;
593 unsigned long epll;
594 unsigned long dpll;
595 unsigned int ptr;
596
597 /* Set S5P6450 functions for clk_fout_epll */
598
Seungwhan Yound4b34c62010-10-14 10:39:08 +0900599 clk_fout_epll.enable = s5p_epll_enable;
Kukjin Kim3109e552010-09-01 15:35:30 +0900600 clk_fout_epll.ops = &s5p6450_epll_ops;
601
602 clk_48m.enable = s5p64x0_clk48m_ctrl;
603
604 xtal_clk = clk_get(NULL, "ext_xtal");
605 BUG_ON(IS_ERR(xtal_clk));
606
607 xtal = clk_get_rate(xtal_clk);
608 clk_put(xtal_clk);
609
610 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
611 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
612 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
613 __raw_readl(S5P64X0_EPLL_CON_K));
614 dpll = s5p_get_pll46xx(xtal, __raw_readl(S5P6450_DPLL_CON),
615 __raw_readl(S5P6450_DPLL_CON_K), pll_4650c);
616
617 clk_fout_apll.rate = apll;
618 clk_fout_mpll.rate = mpll;
619 clk_fout_epll.rate = epll;
620 clk_fout_dpll.rate = dpll;
621
622 printk(KERN_INFO "S5P6450: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
623 " E=%ld.%ldMHz, D=%ld.%ldMHz\n",
624 print_mhz(apll), print_mhz(mpll), print_mhz(epll),
625 print_mhz(dpll));
626
627 fclk = clk_get_rate(&clk_armclk.clk);
628 hclk = clk_get_rate(&clk_hclk.clk);
629 pclk = clk_get_rate(&clk_pclk.clk);
630 hclk_low = clk_get_rate(&clk_hclk_low.clk);
631 pclk_low = clk_get_rate(&clk_pclk_low.clk);
632
633 printk(KERN_INFO "S5P6450: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
634 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
635 print_mhz(hclk), print_mhz(hclk_low),
636 print_mhz(pclk), print_mhz(pclk_low));
637
638 clk_f.rate = fclk;
639 clk_h.rate = hclk;
640 clk_p.rate = pclk;
641
642 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
643 s3c_set_clksrc(&clksrcs[ptr], true);
644}
645
646void __init s5p6450_register_clocks(void)
647{
648 struct clk *clkp;
649 int ret;
650 int ptr;
651
652 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
653 s3c_register_clksrc(sysclks[ptr], 1);
654
655 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
656 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
657
658 clkp = init_clocks_disable;
659 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
660
661 ret = s3c24xx_register_clock(clkp);
662 if (ret < 0) {
663 printk(KERN_ERR "Failed to register clock %s (%d)\n",
664 clkp->name, ret);
665 }
666 (clkp->enable)(clkp, 0);
667 }
668
669 s3c_pwmclk_init();
670}