blob: 306ae743ad728e997326847406d789940deda257 [file] [log] [blame]
Thomas Abrahama443a632010-05-14 16:27:28 +09001/* linux/arch/arm/mach-s5pc100/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PC100 - 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/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20
21#include <mach/map.h>
22
23#include <plat/cpu-freq.h>
24#include <mach/regs-clock.h>
25#include <plat/clock.h>
26#include <plat/cpu.h>
27#include <plat/pll.h>
28#include <plat/s5p-clock.h>
29#include <plat/clock-clksrc.h>
30#include <plat/s5pc100.h>
31
32static struct clk s5p_clk_otgphy = {
33 .name = "otg_phy",
34 .id = -1,
35};
36
37static struct clk *clk_src_mout_href_list[] = {
38 [0] = &s5p_clk_27m,
39 [1] = &clk_fin_hpll,
40};
41
42static struct clksrc_sources clk_src_mout_href = {
43 .sources = clk_src_mout_href_list,
44 .nr_sources = ARRAY_SIZE(clk_src_mout_href_list),
45};
46
47static struct clksrc_clk clk_mout_href = {
48 .clk = {
49 .name = "mout_href",
50 .id = -1,
51 },
52 .sources = &clk_src_mout_href,
53 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
54};
55
56static struct clk *clk_src_mout_48m_list[] = {
57 [0] = &clk_xusbxti,
58 [1] = &s5p_clk_otgphy,
59};
60
61static struct clksrc_sources clk_src_mout_48m = {
62 .sources = clk_src_mout_48m_list,
63 .nr_sources = ARRAY_SIZE(clk_src_mout_48m_list),
64};
65
66static struct clksrc_clk clk_mout_48m = {
67 .clk = {
68 .name = "mout_48m",
69 .id = -1,
70 },
71 .sources = &clk_src_mout_48m,
72 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 1 },
73};
74
75static struct clksrc_clk clk_mout_mpll = {
76 .clk = {
77 .name = "mout_mpll",
78 .id = -1,
79 },
80 .sources = &clk_src_mpll,
81 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
82};
83
84
85static struct clksrc_clk clk_mout_apll = {
86 .clk = {
87 .name = "mout_apll",
88 .id = -1,
89 },
90 .sources = &clk_src_apll,
91 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
92};
93
94static struct clksrc_clk clk_mout_epll = {
95 .clk = {
96 .name = "mout_epll",
97 .id = -1,
98 },
99 .sources = &clk_src_epll,
100 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
101};
102
103static struct clk *clk_src_mout_hpll_list[] = {
104 [0] = &s5p_clk_27m,
105};
106
107static struct clksrc_sources clk_src_mout_hpll = {
108 .sources = clk_src_mout_hpll_list,
109 .nr_sources = ARRAY_SIZE(clk_src_mout_hpll_list),
110};
111
112static struct clksrc_clk clk_mout_hpll = {
113 .clk = {
114 .name = "mout_hpll",
115 .id = -1,
116 },
117 .sources = &clk_src_mout_hpll,
118 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
119};
120
121static struct clksrc_clk clk_div_apll = {
122 .clk = {
123 .name = "div_apll",
124 .id = -1,
125 .parent = &clk_mout_apll.clk,
126 },
127 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 1 },
128};
129
130static struct clksrc_clk clk_div_arm = {
131 .clk = {
132 .name = "div_arm",
133 .id = -1,
134 .parent = &clk_div_apll.clk,
135 },
136 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
137};
138
139static struct clksrc_clk clk_div_d0_bus = {
140 .clk = {
141 .name = "div_d0_bus",
142 .id = -1,
143 .parent = &clk_div_arm.clk,
144 },
145 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
146};
147
148static struct clksrc_clk clk_div_pclkd0 = {
149 .clk = {
150 .name = "div_pclkd0",
151 .id = -1,
152 .parent = &clk_div_d0_bus.clk,
153 },
154 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
155};
156
157static struct clksrc_clk clk_div_secss = {
158 .clk = {
159 .name = "div_secss",
160 .id = -1,
161 .parent = &clk_div_d0_bus.clk,
162 },
163 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 3 },
164};
165
166static struct clksrc_clk clk_div_apll2 = {
167 .clk = {
168 .name = "div_apll2",
169 .id = -1,
170 .parent = &clk_mout_apll.clk,
171 },
172 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 3 },
173};
174
175static struct clk *clk_src_mout_am_list[] = {
176 [0] = &clk_mout_mpll.clk,
177 [1] = &clk_div_apll2.clk,
178};
179
180struct clksrc_sources clk_src_mout_am = {
181 .sources = clk_src_mout_am_list,
182 .nr_sources = ARRAY_SIZE(clk_src_mout_am_list),
183};
184
185static struct clksrc_clk clk_mout_am = {
186 .clk = {
187 .name = "mout_am",
188 .id = -1,
189 },
190 .sources = &clk_src_mout_am,
191 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
192};
193
194static struct clksrc_clk clk_div_d1_bus = {
195 .clk = {
196 .name = "div_d1_bus",
197 .id = -1,
198 .parent = &clk_mout_am.clk,
199 },
200 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 3 },
201};
202
203static struct clksrc_clk clk_div_mpll2 = {
204 .clk = {
205 .name = "div_mpll2",
206 .id = -1,
207 .parent = &clk_mout_am.clk,
208 },
209 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 1 },
210};
211
212static struct clksrc_clk clk_div_mpll = {
213 .clk = {
214 .name = "div_mpll",
215 .id = -1,
216 .parent = &clk_mout_am.clk,
217 },
218 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 2 },
219};
220
221static struct clk *clk_src_mout_onenand_list[] = {
222 [0] = &clk_div_d0_bus.clk,
223 [1] = &clk_div_d1_bus.clk,
224};
225
226struct clksrc_sources clk_src_mout_onenand = {
227 .sources = clk_src_mout_onenand_list,
228 .nr_sources = ARRAY_SIZE(clk_src_mout_onenand_list),
229};
230
231static struct clksrc_clk clk_mout_onenand = {
232 .clk = {
233 .name = "mout_onenand",
234 .id = -1,
235 },
236 .sources = &clk_src_mout_onenand,
237 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
238};
239
240static struct clksrc_clk clk_div_onenand = {
241 .clk = {
242 .name = "div_onenand",
243 .id = -1,
244 .parent = &clk_mout_onenand.clk,
245 },
246 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 2 },
247};
248
249static struct clksrc_clk clk_div_pclkd1 = {
250 .clk = {
251 .name = "div_pclkd1",
252 .id = -1,
253 .parent = &clk_div_d1_bus.clk,
254 },
255 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 3 },
256};
257
258static struct clksrc_clk clk_div_cam = {
259 .clk = {
260 .name = "div_cam",
261 .id = -1,
262 .parent = &clk_div_mpll2.clk,
263 },
264 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 24, .size = 5 },
265};
266
267static struct clksrc_clk clk_div_hdmi = {
268 .clk = {
269 .name = "div_hdmi",
270 .id = -1,
271 .parent = &clk_mout_hpll.clk,
272 },
273 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 },
274};
275
276static int s5pc100_epll_enable(struct clk *clk, int enable)
277{
278 unsigned int ctrlbit = clk->ctrlbit;
279 unsigned int epll_con = __raw_readl(S5P_EPLL_CON) & ~ctrlbit;
280
281 if (enable)
282 __raw_writel(epll_con | ctrlbit, S5P_EPLL_CON);
283 else
284 __raw_writel(epll_con, S5P_EPLL_CON);
285
286 return 0;
287}
288
289static unsigned long s5pc100_epll_get_rate(struct clk *clk)
290{
291 return clk->rate;
292}
293
294static u32 epll_div[][4] = {
295 { 32750000, 131, 3, 4 },
296 { 32768000, 131, 3, 4 },
297 { 36000000, 72, 3, 3 },
298 { 45000000, 90, 3, 3 },
299 { 45158000, 90, 3, 3 },
300 { 45158400, 90, 3, 3 },
301 { 48000000, 96, 3, 3 },
302 { 49125000, 131, 4, 3 },
303 { 49152000, 131, 4, 3 },
304 { 60000000, 120, 3, 3 },
305 { 67737600, 226, 5, 3 },
306 { 67738000, 226, 5, 3 },
307 { 73800000, 246, 5, 3 },
308 { 73728000, 246, 5, 3 },
309 { 72000000, 144, 3, 3 },
310 { 84000000, 168, 3, 3 },
311 { 96000000, 96, 3, 2 },
312 { 144000000, 144, 3, 2 },
313 { 192000000, 96, 3, 1 }
314};
315
316static int s5pc100_epll_set_rate(struct clk *clk, unsigned long rate)
317{
318 unsigned int epll_con;
319 unsigned int i;
320
321 if (clk->rate == rate) /* Return if nothing changed */
322 return 0;
323
324 epll_con = __raw_readl(S5P_EPLL_CON);
325
326 epll_con &= ~(PLL65XX_MDIV_MASK | PLL65XX_PDIV_MASK | PLL65XX_SDIV_MASK);
327
328 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
329 if (epll_div[i][0] == rate) {
330 epll_con |= (epll_div[i][1] << PLL65XX_MDIV_SHIFT) |
331 (epll_div[i][2] << PLL65XX_PDIV_SHIFT) |
332 (epll_div[i][3] << PLL65XX_SDIV_SHIFT);
333 break;
334 }
335 }
336
337 if (i == ARRAY_SIZE(epll_div)) {
338 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
339 return -EINVAL;
340 }
341
342 __raw_writel(epll_con, S5P_EPLL_CON);
343
344 clk->rate = rate;
345
346 return 0;
347}
348
349static struct clk_ops s5pc100_epll_ops = {
350 .get_rate = s5pc100_epll_get_rate,
351 .set_rate = s5pc100_epll_set_rate,
352};
353
354static int s5pc100_d0_0_ctrl(struct clk *clk, int enable)
355{
356 return s5p_gatectrl(S5P_CLKGATE_D00, clk, enable);
357}
358
359static int s5pc100_d0_1_ctrl(struct clk *clk, int enable)
360{
361 return s5p_gatectrl(S5P_CLKGATE_D01, clk, enable);
362}
363
364static int s5pc100_d0_2_ctrl(struct clk *clk, int enable)
365{
366 return s5p_gatectrl(S5P_CLKGATE_D02, clk, enable);
367}
368
369static int s5pc100_d1_0_ctrl(struct clk *clk, int enable)
370{
371 return s5p_gatectrl(S5P_CLKGATE_D10, clk, enable);
372}
373
374static int s5pc100_d1_1_ctrl(struct clk *clk, int enable)
375{
376 return s5p_gatectrl(S5P_CLKGATE_D11, clk, enable);
377}
378
379static int s5pc100_d1_2_ctrl(struct clk *clk, int enable)
380{
381 return s5p_gatectrl(S5P_CLKGATE_D12, clk, enable);
382}
383
384static int s5pc100_d1_3_ctrl(struct clk *clk, int enable)
385{
386 return s5p_gatectrl(S5P_CLKGATE_D13, clk, enable);
387}
388
389static int s5pc100_d1_4_ctrl(struct clk *clk, int enable)
390{
391 return s5p_gatectrl(S5P_CLKGATE_D14, clk, enable);
392}
393
394static int s5pc100_d1_5_ctrl(struct clk *clk, int enable)
395{
396 return s5p_gatectrl(S5P_CLKGATE_D15, clk, enable);
397}
398
399static int s5pc100_sclk0_ctrl(struct clk *clk, int enable)
400{
401 return s5p_gatectrl(S5P_CLKGATE_SCLK0, clk, enable);
402}
403
404static int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
405{
406 return s5p_gatectrl(S5P_CLKGATE_SCLK1, clk, enable);
407}
408
409/*
410 * The following clocks will be disabled during clock initialization. It is
411 * recommended to keep the following clocks disabled until the driver requests
412 * for enabling the clock.
413 */
414static struct clk init_clocks_disable[] = {
415 {
416 .name = "cssys",
417 .id = -1,
418 .parent = &clk_div_d0_bus.clk,
419 .enable = s5pc100_d0_0_ctrl,
420 .ctrlbit = (1 << 6),
421 }, {
422 .name = "secss",
423 .id = -1,
424 .parent = &clk_div_d0_bus.clk,
425 .enable = s5pc100_d0_0_ctrl,
426 .ctrlbit = (1 << 5),
427 }, {
428 .name = "g2d",
429 .id = -1,
430 .parent = &clk_div_d0_bus.clk,
431 .enable = s5pc100_d0_0_ctrl,
432 .ctrlbit = (1 << 4),
433 }, {
434 .name = "mdma",
435 .id = -1,
436 .parent = &clk_div_d0_bus.clk,
437 .enable = s5pc100_d0_0_ctrl,
438 .ctrlbit = (1 << 3),
439 }, {
440 .name = "cfcon",
441 .id = -1,
442 .parent = &clk_div_d0_bus.clk,
443 .enable = s5pc100_d0_0_ctrl,
444 .ctrlbit = (1 << 2),
445 }, {
446 .name = "nfcon",
447 .id = -1,
448 .parent = &clk_div_d0_bus.clk,
449 .enable = s5pc100_d0_1_ctrl,
450 .ctrlbit = (1 << 3),
451 }, {
452 .name = "onenandc",
453 .id = -1,
454 .parent = &clk_div_d0_bus.clk,
455 .enable = s5pc100_d0_1_ctrl,
456 .ctrlbit = (1 << 2),
457 }, {
458 .name = "sdm",
459 .id = -1,
460 .parent = &clk_div_d0_bus.clk,
461 .enable = s5pc100_d0_2_ctrl,
462 .ctrlbit = (1 << 2),
463 }, {
464 .name = "seckey",
465 .id = -1,
466 .parent = &clk_div_d0_bus.clk,
467 .enable = s5pc100_d0_2_ctrl,
468 .ctrlbit = (1 << 1),
469 }, {
470 .name = "hsmmc",
471 .id = 2,
472 .parent = &clk_div_d1_bus.clk,
473 .enable = s5pc100_d1_0_ctrl,
474 .ctrlbit = (1 << 7),
475 }, {
476 .name = "hsmmc",
477 .id = 1,
478 .parent = &clk_div_d1_bus.clk,
479 .enable = s5pc100_d1_0_ctrl,
480 .ctrlbit = (1 << 6),
481 }, {
482 .name = "hsmmc",
483 .id = 0,
484 .parent = &clk_div_d1_bus.clk,
485 .enable = s5pc100_d1_0_ctrl,
486 .ctrlbit = (1 << 5),
487 }, {
488 .name = "modemif",
489 .id = -1,
490 .parent = &clk_div_d1_bus.clk,
491 .enable = s5pc100_d1_0_ctrl,
492 .ctrlbit = (1 << 4),
493 }, {
494 .name = "otg",
495 .id = -1,
496 .parent = &clk_div_d1_bus.clk,
497 .enable = s5pc100_d1_0_ctrl,
498 .ctrlbit = (1 << 3),
499 }, {
500 .name = "usbhost",
501 .id = -1,
502 .parent = &clk_div_d1_bus.clk,
503 .enable = s5pc100_d1_0_ctrl,
504 .ctrlbit = (1 << 2),
505 }, {
506 .name = "pdma",
507 .id = 1,
508 .parent = &clk_div_d1_bus.clk,
509 .enable = s5pc100_d1_0_ctrl,
510 .ctrlbit = (1 << 1),
511 }, {
512 .name = "pdma",
513 .id = 0,
514 .parent = &clk_div_d1_bus.clk,
515 .enable = s5pc100_d1_0_ctrl,
516 .ctrlbit = (1 << 0),
517 }, {
518 .name = "lcd",
519 .id = -1,
520 .parent = &clk_div_d1_bus.clk,
521 .enable = s5pc100_d1_1_ctrl,
522 .ctrlbit = (1 << 0),
523 }, {
524 .name = "rotator",
525 .id = -1,
526 .parent = &clk_div_d1_bus.clk,
527 .enable = s5pc100_d1_1_ctrl,
528 .ctrlbit = (1 << 1),
529 }, {
530 .name = "fimc",
531 .id = 0,
532 .parent = &clk_div_d1_bus.clk,
533 .enable = s5pc100_d1_1_ctrl,
534 .ctrlbit = (1 << 2),
535 }, {
536 .name = "fimc",
537 .id = 1,
538 .parent = &clk_div_d1_bus.clk,
539 .enable = s5pc100_d1_1_ctrl,
540 .ctrlbit = (1 << 3),
541 }, {
542 .name = "fimc",
543 .id = 2,
544 .parent = &clk_div_d1_bus.clk,
545 .enable = s5pc100_d1_1_ctrl,
546 .ctrlbit = (1 << 4),
547 }, {
548 .name = "jpeg",
549 .id = -1,
550 .parent = &clk_div_d1_bus.clk,
551 .enable = s5pc100_d1_1_ctrl,
552 .ctrlbit = (1 << 5),
553 }, {
554 .name = "mipi-dsim",
555 .id = -1,
556 .parent = &clk_div_d1_bus.clk,
557 .enable = s5pc100_d1_1_ctrl,
558 .ctrlbit = (1 << 6),
559 }, {
560 .name = "mipi-csis",
561 .id = -1,
562 .parent = &clk_div_d1_bus.clk,
563 .enable = s5pc100_d1_1_ctrl,
564 .ctrlbit = (1 << 7),
565 }, {
566 .name = "g3d",
567 .id = 0,
568 .parent = &clk_div_d1_bus.clk,
569 .enable = s5pc100_d1_0_ctrl,
570 .ctrlbit = (1 << 8),
571 }, {
572 .name = "tv",
573 .id = -1,
574 .parent = &clk_div_d1_bus.clk,
575 .enable = s5pc100_d1_2_ctrl,
576 .ctrlbit = (1 << 0),
577 }, {
578 .name = "vp",
579 .id = -1,
580 .parent = &clk_div_d1_bus.clk,
581 .enable = s5pc100_d1_2_ctrl,
582 .ctrlbit = (1 << 1),
583 }, {
584 .name = "mixer",
585 .id = -1,
586 .parent = &clk_div_d1_bus.clk,
587 .enable = s5pc100_d1_2_ctrl,
588 .ctrlbit = (1 << 2),
589 }, {
590 .name = "hdmi",
591 .id = -1,
592 .parent = &clk_div_d1_bus.clk,
593 .enable = s5pc100_d1_2_ctrl,
594 .ctrlbit = (1 << 3),
595 }, {
596 .name = "mfc",
597 .id = -1,
598 .parent = &clk_div_d1_bus.clk,
599 .enable = s5pc100_d1_2_ctrl,
600 .ctrlbit = (1 << 4),
601 }, {
602 .name = "apc",
603 .id = -1,
604 .parent = &clk_div_d1_bus.clk,
605 .enable = s5pc100_d1_3_ctrl,
606 .ctrlbit = (1 << 2),
607 }, {
608 .name = "iec",
609 .id = -1,
610 .parent = &clk_div_d1_bus.clk,
611 .enable = s5pc100_d1_3_ctrl,
612 .ctrlbit = (1 << 3),
613 }, {
614 .name = "systimer",
615 .id = -1,
616 .parent = &clk_div_d1_bus.clk,
617 .enable = s5pc100_d1_3_ctrl,
618 .ctrlbit = (1 << 7),
619 }, {
620 .name = "watchdog",
621 .id = -1,
622 .parent = &clk_div_d1_bus.clk,
623 .enable = s5pc100_d1_3_ctrl,
624 .ctrlbit = (1 << 8),
625 }, {
626 .name = "rtc",
627 .id = -1,
628 .parent = &clk_div_d1_bus.clk,
629 .enable = s5pc100_d1_3_ctrl,
630 .ctrlbit = (1 << 9),
631 }, {
632 .name = "i2c",
633 .id = 0,
634 .parent = &clk_div_d1_bus.clk,
635 .enable = s5pc100_d1_4_ctrl,
636 .ctrlbit = (1 << 4),
637 }, {
638 .name = "i2c",
639 .id = 1,
640 .parent = &clk_div_d1_bus.clk,
641 .enable = s5pc100_d1_4_ctrl,
642 .ctrlbit = (1 << 5),
643 }, {
644 .name = "spi",
645 .id = 0,
646 .parent = &clk_div_d1_bus.clk,
647 .enable = s5pc100_d1_4_ctrl,
648 .ctrlbit = (1 << 6),
649 }, {
650 .name = "spi",
651 .id = 1,
652 .parent = &clk_div_d1_bus.clk,
653 .enable = s5pc100_d1_4_ctrl,
654 .ctrlbit = (1 << 7),
655 }, {
656 .name = "spi",
657 .id = 2,
658 .parent = &clk_div_d1_bus.clk,
659 .enable = s5pc100_d1_4_ctrl,
660 .ctrlbit = (1 << 8),
661 }, {
662 .name = "irda",
663 .id = -1,
664 .parent = &clk_div_d1_bus.clk,
665 .enable = s5pc100_d1_4_ctrl,
666 .ctrlbit = (1 << 9),
667 }, {
668 .name = "ccan",
669 .id = 0,
670 .parent = &clk_div_d1_bus.clk,
671 .enable = s5pc100_d1_4_ctrl,
672 .ctrlbit = (1 << 10),
673 }, {
674 .name = "ccan",
675 .id = 1,
676 .parent = &clk_div_d1_bus.clk,
677 .enable = s5pc100_d1_4_ctrl,
678 .ctrlbit = (1 << 11),
679 }, {
680 .name = "hsitx",
681 .id = -1,
682 .parent = &clk_div_d1_bus.clk,
683 .enable = s5pc100_d1_4_ctrl,
684 .ctrlbit = (1 << 12),
685 }, {
686 .name = "hsirx",
687 .id = -1,
688 .parent = &clk_div_d1_bus.clk,
689 .enable = s5pc100_d1_4_ctrl,
690 .ctrlbit = (1 << 13),
691 }, {
692 .name = "iis",
693 .id = 0,
694 .parent = &clk_div_d1_bus.clk,
695 .enable = s5pc100_d1_5_ctrl,
696 .ctrlbit = (1 << 0),
697 }, {
698 .name = "iis",
699 .id = 1,
700 .parent = &clk_div_d1_bus.clk,
701 .enable = s5pc100_d1_5_ctrl,
702 .ctrlbit = (1 << 1),
703 }, {
704 .name = "iis",
705 .id = 2,
706 .parent = &clk_div_d1_bus.clk,
707 .enable = s5pc100_d1_5_ctrl,
708 .ctrlbit = (1 << 2),
709 }, {
710 .name = "ac97",
711 .id = -1,
712 .parent = &clk_div_d1_bus.clk,
713 .enable = s5pc100_d1_5_ctrl,
714 .ctrlbit = (1 << 3),
715 }, {
716 .name = "pcm",
717 .id = 0,
718 .parent = &clk_div_d1_bus.clk,
719 .enable = s5pc100_d1_5_ctrl,
720 .ctrlbit = (1 << 4),
721 }, {
722 .name = "pcm",
723 .id = 1,
724 .parent = &clk_div_d1_bus.clk,
725 .enable = s5pc100_d1_5_ctrl,
726 .ctrlbit = (1 << 5),
727 }, {
728 .name = "spdif",
729 .id = -1,
730 .parent = &clk_div_d1_bus.clk,
731 .enable = s5pc100_d1_5_ctrl,
732 .ctrlbit = (1 << 6),
733 }, {
734 .name = "adc",
735 .id = -1,
736 .parent = &clk_div_d1_bus.clk,
737 .enable = s5pc100_d1_5_ctrl,
738 .ctrlbit = (1 << 7),
739 }, {
Naveen Krishna Ch32018a82010-06-04 10:41:44 +0530740 .name = "keypad",
Thomas Abrahama443a632010-05-14 16:27:28 +0900741 .id = -1,
742 .parent = &clk_div_d1_bus.clk,
743 .enable = s5pc100_d1_5_ctrl,
744 .ctrlbit = (1 << 8),
745 }, {
746 .name = "spi_48m",
747 .id = 0,
748 .parent = &clk_mout_48m.clk,
749 .enable = s5pc100_sclk0_ctrl,
750 .ctrlbit = (1 << 7),
751 }, {
752 .name = "spi_48m",
753 .id = 1,
754 .parent = &clk_mout_48m.clk,
755 .enable = s5pc100_sclk0_ctrl,
756 .ctrlbit = (1 << 8),
757 }, {
758 .name = "spi_48m",
759 .id = 2,
760 .parent = &clk_mout_48m.clk,
761 .enable = s5pc100_sclk0_ctrl,
762 .ctrlbit = (1 << 9),
763 }, {
764 .name = "mmc_48m",
765 .id = 0,
766 .parent = &clk_mout_48m.clk,
767 .enable = s5pc100_sclk0_ctrl,
768 .ctrlbit = (1 << 15),
769 }, {
770 .name = "mmc_48m",
771 .id = 1,
772 .parent = &clk_mout_48m.clk,
773 .enable = s5pc100_sclk0_ctrl,
774 .ctrlbit = (1 << 16),
775 }, {
776 .name = "mmc_48m",
777 .id = 2,
778 .parent = &clk_mout_48m.clk,
779 .enable = s5pc100_sclk0_ctrl,
780 .ctrlbit = (1 << 17),
781 },
782};
783
784static struct clk clk_vclk54m = {
785 .name = "vclk_54m",
786 .id = -1,
787 .rate = 54000000,
788};
789
790static struct clk clk_i2scdclk0 = {
791 .name = "i2s_cdclk0",
792 .id = -1,
793};
794
795static struct clk clk_i2scdclk1 = {
796 .name = "i2s_cdclk1",
797 .id = -1,
798};
799
800static struct clk clk_i2scdclk2 = {
801 .name = "i2s_cdclk2",
802 .id = -1,
803};
804
805static struct clk clk_pcmcdclk0 = {
806 .name = "pcm_cdclk0",
807 .id = -1,
808};
809
810static struct clk clk_pcmcdclk1 = {
811 .name = "pcm_cdclk1",
812 .id = -1,
813};
814
815static struct clk *clk_src_group1_list[] = {
816 [0] = &clk_mout_epll.clk,
817 [1] = &clk_div_mpll2.clk,
818 [2] = &clk_fin_epll,
819 [3] = &clk_mout_hpll.clk,
820};
821
822struct clksrc_sources clk_src_group1 = {
823 .sources = clk_src_group1_list,
824 .nr_sources = ARRAY_SIZE(clk_src_group1_list),
825};
826
827static struct clk *clk_src_group2_list[] = {
828 [0] = &clk_mout_epll.clk,
829 [1] = &clk_div_mpll.clk,
830};
831
832struct clksrc_sources clk_src_group2 = {
833 .sources = clk_src_group2_list,
834 .nr_sources = ARRAY_SIZE(clk_src_group2_list),
835};
836
837static struct clk *clk_src_group3_list[] = {
838 [0] = &clk_mout_epll.clk,
839 [1] = &clk_div_mpll.clk,
840 [2] = &clk_fin_epll,
841 [3] = &clk_i2scdclk0,
842 [4] = &clk_pcmcdclk0,
843 [5] = &clk_mout_hpll.clk,
844};
845
846struct clksrc_sources clk_src_group3 = {
847 .sources = clk_src_group3_list,
848 .nr_sources = ARRAY_SIZE(clk_src_group3_list),
849};
850
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +0900851static struct clksrc_clk clk_sclk_audio0 = {
852 .clk = {
853 .name = "sclk_audio",
854 .id = 0,
855 .ctrlbit = (1 << 8),
856 .enable = s5pc100_sclk1_ctrl,
857 },
858 .sources = &clk_src_group3,
859 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 3 },
860 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
861};
862
Thomas Abrahama443a632010-05-14 16:27:28 +0900863static struct clk *clk_src_group4_list[] = {
864 [0] = &clk_mout_epll.clk,
865 [1] = &clk_div_mpll.clk,
866 [2] = &clk_fin_epll,
867 [3] = &clk_i2scdclk1,
868 [4] = &clk_pcmcdclk1,
869 [5] = &clk_mout_hpll.clk,
870};
871
872struct clksrc_sources clk_src_group4 = {
873 .sources = clk_src_group4_list,
874 .nr_sources = ARRAY_SIZE(clk_src_group4_list),
875};
876
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +0900877static struct clksrc_clk clk_sclk_audio1 = {
878 .clk = {
879 .name = "sclk_audio",
880 .id = 1,
881 .ctrlbit = (1 << 9),
882 .enable = s5pc100_sclk1_ctrl,
883 },
884 .sources = &clk_src_group4,
885 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 3 },
886 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
887};
888
Thomas Abrahama443a632010-05-14 16:27:28 +0900889static struct clk *clk_src_group5_list[] = {
890 [0] = &clk_mout_epll.clk,
891 [1] = &clk_div_mpll.clk,
892 [2] = &clk_fin_epll,
893 [3] = &clk_i2scdclk2,
894 [4] = &clk_mout_hpll.clk,
895};
896
897struct clksrc_sources clk_src_group5 = {
898 .sources = clk_src_group5_list,
899 .nr_sources = ARRAY_SIZE(clk_src_group5_list),
900};
901
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +0900902static struct clksrc_clk clk_sclk_audio2 = {
903 .clk = {
904 .name = "sclk_audio",
905 .id = 2,
906 .ctrlbit = (1 << 10),
907 .enable = s5pc100_sclk1_ctrl,
908 },
909 .sources = &clk_src_group5,
910 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 3 },
911 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
912};
913
Thomas Abrahama443a632010-05-14 16:27:28 +0900914static struct clk *clk_src_group6_list[] = {
915 [0] = &s5p_clk_27m,
916 [1] = &clk_vclk54m,
917 [2] = &clk_div_hdmi.clk,
918};
919
920struct clksrc_sources clk_src_group6 = {
921 .sources = clk_src_group6_list,
922 .nr_sources = ARRAY_SIZE(clk_src_group6_list),
923};
924
925static struct clk *clk_src_group7_list[] = {
926 [0] = &clk_mout_epll.clk,
927 [1] = &clk_div_mpll.clk,
928 [2] = &clk_mout_hpll.clk,
929 [3] = &clk_vclk54m,
930};
931
932struct clksrc_sources clk_src_group7 = {
933 .sources = clk_src_group7_list,
934 .nr_sources = ARRAY_SIZE(clk_src_group7_list),
935};
936
937static struct clk *clk_src_mmc0_list[] = {
938 [0] = &clk_mout_epll.clk,
939 [1] = &clk_div_mpll.clk,
940 [2] = &clk_fin_epll,
941};
942
943struct clksrc_sources clk_src_mmc0 = {
944 .sources = clk_src_mmc0_list,
945 .nr_sources = ARRAY_SIZE(clk_src_mmc0_list),
946};
947
948static struct clk *clk_src_mmc12_list[] = {
949 [0] = &clk_mout_epll.clk,
950 [1] = &clk_div_mpll.clk,
951 [2] = &clk_fin_epll,
952 [3] = &clk_mout_hpll.clk,
953};
954
955struct clksrc_sources clk_src_mmc12 = {
956 .sources = clk_src_mmc12_list,
957 .nr_sources = ARRAY_SIZE(clk_src_mmc12_list),
958};
959
960static struct clk *clk_src_irda_usb_list[] = {
961 [0] = &clk_mout_epll.clk,
962 [1] = &clk_div_mpll.clk,
963 [2] = &clk_fin_epll,
964 [3] = &clk_mout_hpll.clk,
965};
966
967struct clksrc_sources clk_src_irda_usb = {
968 .sources = clk_src_irda_usb_list,
969 .nr_sources = ARRAY_SIZE(clk_src_irda_usb_list),
970};
971
972static struct clk *clk_src_pwi_list[] = {
973 [0] = &clk_fin_epll,
974 [1] = &clk_mout_epll.clk,
975 [2] = &clk_div_mpll.clk,
976};
977
978struct clksrc_sources clk_src_pwi = {
979 .sources = clk_src_pwi_list,
980 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
981};
982
Seungwhan Youn04a4fd02010-10-14 10:35:23 +0900983static struct clk *clk_sclk_spdif_list[] = {
984 [0] = &clk_sclk_audio0.clk,
985 [1] = &clk_sclk_audio1.clk,
986 [2] = &clk_sclk_audio2.clk,
987};
988
989struct clksrc_sources clk_src_sclk_spdif = {
990 .sources = clk_sclk_spdif_list,
991 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
992};
993
994static int s5pc100_spdif_set_rate(struct clk *clk, unsigned long rate)
995{
996 struct clk *pclk;
997 int ret;
998
999 pclk = clk_get_parent(clk);
1000 if (IS_ERR(pclk))
1001 return -EINVAL;
1002
1003 ret = pclk->ops->set_rate(pclk, rate);
1004 clk_put(pclk);
1005
1006 return ret;
1007}
1008
1009static unsigned long s5pc100_spdif_get_rate(struct clk *clk)
1010{
1011 struct clk *pclk;
1012 int rate;
1013
1014 pclk = clk_get_parent(clk);
1015 if (IS_ERR(pclk))
1016 return -EINVAL;
1017
1018 rate = pclk->ops->get_rate(clk);
1019 clk_put(pclk);
1020
1021 return rate;
1022}
1023
1024static struct clk_ops s5pc100_sclk_spdif_ops = {
1025 .set_rate = s5pc100_spdif_set_rate,
1026 .get_rate = s5pc100_spdif_get_rate,
1027};
1028
1029static struct clksrc_clk clk_sclk_spdif = {
1030 .clk = {
1031 .name = "sclk_spdif",
1032 .id = -1,
1033 .ctrlbit = (1 << 11),
1034 .enable = s5pc100_sclk1_ctrl,
1035 .ops = &s5pc100_sclk_spdif_ops,
1036 },
1037 .sources = &clk_src_sclk_spdif,
1038 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
1039};
1040
Thomas Abrahama443a632010-05-14 16:27:28 +09001041static struct clksrc_clk clksrcs[] = {
1042 {
1043 .clk = {
1044 .name = "sclk_spi",
1045 .id = 0,
1046 .ctrlbit = (1 << 4),
1047 .enable = s5pc100_sclk0_ctrl,
1048
1049 },
1050 .sources = &clk_src_group1,
1051 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 2 },
1052 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
1053 }, {
1054 .clk = {
1055 .name = "sclk_spi",
1056 .id = 1,
1057 .ctrlbit = (1 << 5),
1058 .enable = s5pc100_sclk0_ctrl,
1059
1060 },
1061 .sources = &clk_src_group1,
1062 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 2 },
1063 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 },
1064 }, {
1065 .clk = {
1066 .name = "sclk_spi",
1067 .id = 2,
1068 .ctrlbit = (1 << 6),
1069 .enable = s5pc100_sclk0_ctrl,
1070
1071 },
1072 .sources = &clk_src_group1,
1073 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 2 },
1074 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 12, .size = 4 },
1075 }, {
1076 .clk = {
1077 .name = "uclk1",
1078 .id = -1,
1079 .ctrlbit = (1 << 3),
1080 .enable = s5pc100_sclk0_ctrl,
1081
1082 },
1083 .sources = &clk_src_group2,
1084 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
1085 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
1086 }, {
1087 .clk = {
1088 .name = "sclk_mixer",
1089 .id = -1,
1090 .ctrlbit = (1 << 6),
1091 .enable = s5pc100_sclk0_ctrl,
1092
1093 },
1094 .sources = &clk_src_group6,
1095 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 28, .size = 2 },
1096 }, {
1097 .clk = {
Thomas Abrahama443a632010-05-14 16:27:28 +09001098 .name = "sclk_lcd",
1099 .id = -1,
1100 .ctrlbit = (1 << 0),
1101 .enable = s5pc100_sclk1_ctrl,
1102
1103 },
1104 .sources = &clk_src_group7,
1105 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 12, .size = 2 },
1106 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
1107 }, {
1108 .clk = {
1109 .name = "sclk_fimc",
1110 .id = 0,
1111 .ctrlbit = (1 << 1),
1112 .enable = s5pc100_sclk1_ctrl,
1113
1114 },
1115 .sources = &clk_src_group7,
1116 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 16, .size = 2 },
1117 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 },
1118 }, {
1119 .clk = {
1120 .name = "sclk_fimc",
1121 .id = 1,
1122 .ctrlbit = (1 << 2),
1123 .enable = s5pc100_sclk1_ctrl,
1124
1125 },
1126 .sources = &clk_src_group7,
1127 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 20, .size = 2 },
1128 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
1129 }, {
1130 .clk = {
1131 .name = "sclk_fimc",
1132 .id = 2,
1133 .ctrlbit = (1 << 3),
1134 .enable = s5pc100_sclk1_ctrl,
1135
1136 },
1137 .sources = &clk_src_group7,
1138 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 24, .size = 2 },
1139 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 24, .size = 4 },
1140 }, {
1141 .clk = {
Marek Szyprowskiaaeedff2010-08-05 18:22:27 +09001142 .name = "sclk_mmc",
Thomas Abrahama443a632010-05-14 16:27:28 +09001143 .id = 0,
1144 .ctrlbit = (1 << 12),
1145 .enable = s5pc100_sclk1_ctrl,
1146
1147 },
1148 .sources = &clk_src_mmc0,
1149 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 },
1150 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 0, .size = 4 },
1151 }, {
1152 .clk = {
Marek Szyprowskiaaeedff2010-08-05 18:22:27 +09001153 .name = "sclk_mmc",
Thomas Abrahama443a632010-05-14 16:27:28 +09001154 .id = 1,
1155 .ctrlbit = (1 << 13),
1156 .enable = s5pc100_sclk1_ctrl,
1157
1158 },
1159 .sources = &clk_src_mmc12,
1160 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 },
1161 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 4, .size = 4 },
1162 }, {
1163 .clk = {
Marek Szyprowskiaaeedff2010-08-05 18:22:27 +09001164 .name = "sclk_mmc",
Thomas Abrahama443a632010-05-14 16:27:28 +09001165 .id = 2,
1166 .ctrlbit = (1 << 14),
1167 .enable = s5pc100_sclk1_ctrl,
1168
1169 },
1170 .sources = &clk_src_mmc12,
1171 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1172 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1173 }, {
1174 .clk = {
1175 .name = "sclk_irda",
1176 .id = 2,
1177 .ctrlbit = (1 << 10),
1178 .enable = s5pc100_sclk0_ctrl,
1179
1180 },
1181 .sources = &clk_src_irda_usb,
1182 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1183 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1184 }, {
1185 .clk = {
1186 .name = "sclk_irda",
1187 .id = -1,
1188 .ctrlbit = (1 << 10),
1189 .enable = s5pc100_sclk0_ctrl,
1190
1191 },
1192 .sources = &clk_src_mmc12,
1193 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 2 },
1194 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 16, .size = 4 },
1195 }, {
1196 .clk = {
1197 .name = "sclk_pwi",
1198 .id = -1,
1199 .ctrlbit = (1 << 1),
1200 .enable = s5pc100_sclk0_ctrl,
1201
1202 },
1203 .sources = &clk_src_pwi,
1204 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 0, .size = 2 },
1205 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 3 },
1206 }, {
1207 .clk = {
1208 .name = "sclk_uhost",
1209 .id = -1,
1210 .ctrlbit = (1 << 11),
1211 .enable = s5pc100_sclk0_ctrl,
1212
1213 },
1214 .sources = &clk_src_irda_usb,
1215 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 2 },
1216 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 20, .size = 4 },
1217 },
1218};
1219
1220/* Clock initialisation code */
1221static struct clksrc_clk *sysclks[] = {
1222 &clk_mout_apll,
1223 &clk_mout_epll,
1224 &clk_mout_mpll,
1225 &clk_mout_hpll,
1226 &clk_mout_href,
1227 &clk_mout_48m,
1228 &clk_div_apll,
1229 &clk_div_arm,
1230 &clk_div_d0_bus,
1231 &clk_div_pclkd0,
1232 &clk_div_secss,
1233 &clk_div_apll2,
1234 &clk_mout_am,
1235 &clk_div_d1_bus,
1236 &clk_div_mpll2,
1237 &clk_div_mpll,
1238 &clk_mout_onenand,
1239 &clk_div_onenand,
1240 &clk_div_pclkd1,
1241 &clk_div_cam,
1242 &clk_div_hdmi,
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +09001243 &clk_sclk_audio0,
1244 &clk_sclk_audio1,
1245 &clk_sclk_audio2,
Seungwhan Youn04a4fd02010-10-14 10:35:23 +09001246 &clk_sclk_spdif,
Thomas Abrahama443a632010-05-14 16:27:28 +09001247};
1248
1249void __init_or_cpufreq s5pc100_setup_clocks(void)
1250{
1251 unsigned long xtal;
1252 unsigned long arm;
1253 unsigned long hclkd0;
1254 unsigned long hclkd1;
1255 unsigned long pclkd0;
1256 unsigned long pclkd1;
1257 unsigned long apll;
1258 unsigned long mpll;
1259 unsigned long epll;
1260 unsigned long hpll;
1261 unsigned int ptr;
1262
1263 /* Set S5PC100 functions for clk_fout_epll */
1264 clk_fout_epll.enable = s5pc100_epll_enable;
1265 clk_fout_epll.ops = &s5pc100_epll_ops;
1266
1267 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1268
1269 xtal = clk_get_rate(&clk_xtal);
1270
1271 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1272
1273 apll = s5p_get_pll65xx(xtal, __raw_readl(S5P_APLL_CON));
1274 mpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_MPLL_CON));
1275 epll = s5p_get_pll65xx(xtal, __raw_readl(S5P_EPLL_CON));
1276 hpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_HPLL_CON));
1277
1278 printk(KERN_INFO "S5PC100: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz, E=%ld.%ldMHz, H=%ld.%ldMHz\n",
1279 print_mhz(apll), print_mhz(mpll), print_mhz(epll), print_mhz(hpll));
1280
1281 clk_fout_apll.rate = apll;
1282 clk_fout_mpll.rate = mpll;
1283 clk_fout_epll.rate = epll;
1284 clk_mout_hpll.clk.rate = hpll;
1285
1286 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1287 s3c_set_clksrc(&clksrcs[ptr], true);
1288
1289 arm = clk_get_rate(&clk_div_arm.clk);
1290 hclkd0 = clk_get_rate(&clk_div_d0_bus.clk);
1291 pclkd0 = clk_get_rate(&clk_div_pclkd0.clk);
1292 hclkd1 = clk_get_rate(&clk_div_d1_bus.clk);
1293 pclkd1 = clk_get_rate(&clk_div_pclkd1.clk);
1294
1295 printk(KERN_INFO "S5PC100: HCLKD0=%ld.%ldMHz, HCLKD1=%ld.%ldMHz, PCLKD0=%ld.%ldMHz, PCLKD1=%ld.%ldMHz\n",
1296 print_mhz(hclkd0), print_mhz(hclkd1), print_mhz(pclkd0), print_mhz(pclkd1));
1297
1298 clk_f.rate = arm;
1299 clk_h.rate = hclkd1;
1300 clk_p.rate = pclkd1;
1301}
1302
1303/*
1304 * The following clocks will be enabled during clock initialization.
1305 */
1306static struct clk init_clocks[] = {
1307 {
1308 .name = "tzic",
1309 .id = -1,
1310 .parent = &clk_div_d0_bus.clk,
1311 .enable = s5pc100_d0_0_ctrl,
1312 .ctrlbit = (1 << 1),
1313 }, {
1314 .name = "intc",
1315 .id = -1,
1316 .parent = &clk_div_d0_bus.clk,
1317 .enable = s5pc100_d0_0_ctrl,
1318 .ctrlbit = (1 << 0),
1319 }, {
1320 .name = "ebi",
1321 .id = -1,
1322 .parent = &clk_div_d0_bus.clk,
1323 .enable = s5pc100_d0_1_ctrl,
1324 .ctrlbit = (1 << 5),
1325 }, {
1326 .name = "intmem",
1327 .id = -1,
1328 .parent = &clk_div_d0_bus.clk,
1329 .enable = s5pc100_d0_1_ctrl,
1330 .ctrlbit = (1 << 4),
1331 }, {
1332 .name = "sromc",
1333 .id = -1,
1334 .parent = &clk_div_d0_bus.clk,
1335 .enable = s5pc100_d0_1_ctrl,
1336 .ctrlbit = (1 << 1),
1337 }, {
1338 .name = "dmc",
1339 .id = -1,
1340 .parent = &clk_div_d0_bus.clk,
1341 .enable = s5pc100_d0_1_ctrl,
1342 .ctrlbit = (1 << 0),
1343 }, {
1344 .name = "chipid",
1345 .id = -1,
1346 .parent = &clk_div_d0_bus.clk,
1347 .enable = s5pc100_d0_1_ctrl,
1348 .ctrlbit = (1 << 0),
1349 }, {
1350 .name = "gpio",
1351 .id = -1,
1352 .parent = &clk_div_d1_bus.clk,
1353 .enable = s5pc100_d1_3_ctrl,
1354 .ctrlbit = (1 << 1),
1355 }, {
1356 .name = "uart",
1357 .id = 0,
1358 .parent = &clk_div_d1_bus.clk,
1359 .enable = s5pc100_d1_4_ctrl,
1360 .ctrlbit = (1 << 0),
1361 }, {
1362 .name = "uart",
1363 .id = 1,
1364 .parent = &clk_div_d1_bus.clk,
1365 .enable = s5pc100_d1_4_ctrl,
1366 .ctrlbit = (1 << 1),
1367 }, {
1368 .name = "uart",
1369 .id = 2,
1370 .parent = &clk_div_d1_bus.clk,
1371 .enable = s5pc100_d1_4_ctrl,
1372 .ctrlbit = (1 << 2),
1373 }, {
1374 .name = "uart",
1375 .id = 3,
1376 .parent = &clk_div_d1_bus.clk,
1377 .enable = s5pc100_d1_4_ctrl,
1378 .ctrlbit = (1 << 3),
1379 }, {
1380 .name = "timers",
1381 .id = -1,
1382 .parent = &clk_div_d1_bus.clk,
1383 .enable = s5pc100_d1_3_ctrl,
1384 .ctrlbit = (1 << 6),
1385 },
1386};
1387
1388static struct clk *clks[] __initdata = {
1389 &clk_ext,
1390 &clk_i2scdclk0,
1391 &clk_i2scdclk1,
1392 &clk_i2scdclk2,
1393 &clk_pcmcdclk0,
1394 &clk_pcmcdclk1,
1395};
1396
1397void __init s5pc100_register_clocks(void)
1398{
1399 struct clk *clkp;
1400 int ret;
1401 int ptr;
1402
1403 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1404
1405 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1406 s3c_register_clksrc(sysclks[ptr], 1);
1407
1408 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1409 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1410
1411 clkp = init_clocks_disable;
1412 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
1413
1414 ret = s3c24xx_register_clock(clkp);
1415 if (ret < 0) {
1416 printk(KERN_ERR "Failed to register clock %s (%d)\n",
1417 clkp->name, ret);
1418 }
1419 (clkp->enable)(clkp, 0);
1420 }
1421
1422 s3c_pwmclk_init();
1423}