blob: 42c2636ca3ac5e6308d10dff6ff27aa4601c8f72 [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
Thomas Abrahama443a632010-05-14 16:27:28 +0900276static u32 epll_div[][4] = {
277 { 32750000, 131, 3, 4 },
278 { 32768000, 131, 3, 4 },
279 { 36000000, 72, 3, 3 },
280 { 45000000, 90, 3, 3 },
281 { 45158000, 90, 3, 3 },
282 { 45158400, 90, 3, 3 },
283 { 48000000, 96, 3, 3 },
284 { 49125000, 131, 4, 3 },
285 { 49152000, 131, 4, 3 },
286 { 60000000, 120, 3, 3 },
287 { 67737600, 226, 5, 3 },
288 { 67738000, 226, 5, 3 },
289 { 73800000, 246, 5, 3 },
290 { 73728000, 246, 5, 3 },
291 { 72000000, 144, 3, 3 },
292 { 84000000, 168, 3, 3 },
293 { 96000000, 96, 3, 2 },
294 { 144000000, 144, 3, 2 },
295 { 192000000, 96, 3, 1 }
296};
297
298static int s5pc100_epll_set_rate(struct clk *clk, unsigned long rate)
299{
300 unsigned int epll_con;
301 unsigned int i;
302
303 if (clk->rate == rate) /* Return if nothing changed */
304 return 0;
305
306 epll_con = __raw_readl(S5P_EPLL_CON);
307
308 epll_con &= ~(PLL65XX_MDIV_MASK | PLL65XX_PDIV_MASK | PLL65XX_SDIV_MASK);
309
310 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
311 if (epll_div[i][0] == rate) {
312 epll_con |= (epll_div[i][1] << PLL65XX_MDIV_SHIFT) |
313 (epll_div[i][2] << PLL65XX_PDIV_SHIFT) |
314 (epll_div[i][3] << PLL65XX_SDIV_SHIFT);
315 break;
316 }
317 }
318
319 if (i == ARRAY_SIZE(epll_div)) {
320 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
321 return -EINVAL;
322 }
323
324 __raw_writel(epll_con, S5P_EPLL_CON);
325
326 clk->rate = rate;
327
328 return 0;
329}
330
331static struct clk_ops s5pc100_epll_ops = {
Seungwhan Yound4b34c62010-10-14 10:39:08 +0900332 .get_rate = s5p_epll_get_rate,
Thomas Abrahama443a632010-05-14 16:27:28 +0900333 .set_rate = s5pc100_epll_set_rate,
334};
335
336static int s5pc100_d0_0_ctrl(struct clk *clk, int enable)
337{
338 return s5p_gatectrl(S5P_CLKGATE_D00, clk, enable);
339}
340
341static int s5pc100_d0_1_ctrl(struct clk *clk, int enable)
342{
343 return s5p_gatectrl(S5P_CLKGATE_D01, clk, enable);
344}
345
346static int s5pc100_d0_2_ctrl(struct clk *clk, int enable)
347{
348 return s5p_gatectrl(S5P_CLKGATE_D02, clk, enable);
349}
350
351static int s5pc100_d1_0_ctrl(struct clk *clk, int enable)
352{
353 return s5p_gatectrl(S5P_CLKGATE_D10, clk, enable);
354}
355
356static int s5pc100_d1_1_ctrl(struct clk *clk, int enable)
357{
358 return s5p_gatectrl(S5P_CLKGATE_D11, clk, enable);
359}
360
361static int s5pc100_d1_2_ctrl(struct clk *clk, int enable)
362{
363 return s5p_gatectrl(S5P_CLKGATE_D12, clk, enable);
364}
365
366static int s5pc100_d1_3_ctrl(struct clk *clk, int enable)
367{
368 return s5p_gatectrl(S5P_CLKGATE_D13, clk, enable);
369}
370
371static int s5pc100_d1_4_ctrl(struct clk *clk, int enable)
372{
373 return s5p_gatectrl(S5P_CLKGATE_D14, clk, enable);
374}
375
376static int s5pc100_d1_5_ctrl(struct clk *clk, int enable)
377{
378 return s5p_gatectrl(S5P_CLKGATE_D15, clk, enable);
379}
380
381static int s5pc100_sclk0_ctrl(struct clk *clk, int enable)
382{
383 return s5p_gatectrl(S5P_CLKGATE_SCLK0, clk, enable);
384}
385
386static int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
387{
388 return s5p_gatectrl(S5P_CLKGATE_SCLK1, clk, enable);
389}
390
391/*
392 * The following clocks will be disabled during clock initialization. It is
393 * recommended to keep the following clocks disabled until the driver requests
394 * for enabling the clock.
395 */
396static struct clk init_clocks_disable[] = {
397 {
398 .name = "cssys",
399 .id = -1,
400 .parent = &clk_div_d0_bus.clk,
401 .enable = s5pc100_d0_0_ctrl,
402 .ctrlbit = (1 << 6),
403 }, {
404 .name = "secss",
405 .id = -1,
406 .parent = &clk_div_d0_bus.clk,
407 .enable = s5pc100_d0_0_ctrl,
408 .ctrlbit = (1 << 5),
409 }, {
410 .name = "g2d",
411 .id = -1,
412 .parent = &clk_div_d0_bus.clk,
413 .enable = s5pc100_d0_0_ctrl,
414 .ctrlbit = (1 << 4),
415 }, {
416 .name = "mdma",
417 .id = -1,
418 .parent = &clk_div_d0_bus.clk,
419 .enable = s5pc100_d0_0_ctrl,
420 .ctrlbit = (1 << 3),
421 }, {
422 .name = "cfcon",
423 .id = -1,
424 .parent = &clk_div_d0_bus.clk,
425 .enable = s5pc100_d0_0_ctrl,
426 .ctrlbit = (1 << 2),
427 }, {
428 .name = "nfcon",
429 .id = -1,
430 .parent = &clk_div_d0_bus.clk,
431 .enable = s5pc100_d0_1_ctrl,
432 .ctrlbit = (1 << 3),
433 }, {
434 .name = "onenandc",
435 .id = -1,
436 .parent = &clk_div_d0_bus.clk,
437 .enable = s5pc100_d0_1_ctrl,
438 .ctrlbit = (1 << 2),
439 }, {
440 .name = "sdm",
441 .id = -1,
442 .parent = &clk_div_d0_bus.clk,
443 .enable = s5pc100_d0_2_ctrl,
444 .ctrlbit = (1 << 2),
445 }, {
446 .name = "seckey",
447 .id = -1,
448 .parent = &clk_div_d0_bus.clk,
449 .enable = s5pc100_d0_2_ctrl,
450 .ctrlbit = (1 << 1),
451 }, {
452 .name = "hsmmc",
453 .id = 2,
454 .parent = &clk_div_d1_bus.clk,
455 .enable = s5pc100_d1_0_ctrl,
456 .ctrlbit = (1 << 7),
457 }, {
458 .name = "hsmmc",
459 .id = 1,
460 .parent = &clk_div_d1_bus.clk,
461 .enable = s5pc100_d1_0_ctrl,
462 .ctrlbit = (1 << 6),
463 }, {
464 .name = "hsmmc",
465 .id = 0,
466 .parent = &clk_div_d1_bus.clk,
467 .enable = s5pc100_d1_0_ctrl,
468 .ctrlbit = (1 << 5),
469 }, {
470 .name = "modemif",
471 .id = -1,
472 .parent = &clk_div_d1_bus.clk,
473 .enable = s5pc100_d1_0_ctrl,
474 .ctrlbit = (1 << 4),
475 }, {
476 .name = "otg",
477 .id = -1,
478 .parent = &clk_div_d1_bus.clk,
479 .enable = s5pc100_d1_0_ctrl,
480 .ctrlbit = (1 << 3),
481 }, {
482 .name = "usbhost",
483 .id = -1,
484 .parent = &clk_div_d1_bus.clk,
485 .enable = s5pc100_d1_0_ctrl,
486 .ctrlbit = (1 << 2),
487 }, {
488 .name = "pdma",
489 .id = 1,
490 .parent = &clk_div_d1_bus.clk,
491 .enable = s5pc100_d1_0_ctrl,
492 .ctrlbit = (1 << 1),
493 }, {
494 .name = "pdma",
495 .id = 0,
496 .parent = &clk_div_d1_bus.clk,
497 .enable = s5pc100_d1_0_ctrl,
498 .ctrlbit = (1 << 0),
499 }, {
500 .name = "lcd",
501 .id = -1,
502 .parent = &clk_div_d1_bus.clk,
503 .enable = s5pc100_d1_1_ctrl,
504 .ctrlbit = (1 << 0),
505 }, {
506 .name = "rotator",
507 .id = -1,
508 .parent = &clk_div_d1_bus.clk,
509 .enable = s5pc100_d1_1_ctrl,
510 .ctrlbit = (1 << 1),
511 }, {
512 .name = "fimc",
513 .id = 0,
514 .parent = &clk_div_d1_bus.clk,
515 .enable = s5pc100_d1_1_ctrl,
516 .ctrlbit = (1 << 2),
517 }, {
518 .name = "fimc",
519 .id = 1,
520 .parent = &clk_div_d1_bus.clk,
521 .enable = s5pc100_d1_1_ctrl,
522 .ctrlbit = (1 << 3),
523 }, {
524 .name = "fimc",
525 .id = 2,
526 .parent = &clk_div_d1_bus.clk,
527 .enable = s5pc100_d1_1_ctrl,
528 .ctrlbit = (1 << 4),
529 }, {
530 .name = "jpeg",
531 .id = -1,
532 .parent = &clk_div_d1_bus.clk,
533 .enable = s5pc100_d1_1_ctrl,
534 .ctrlbit = (1 << 5),
535 }, {
536 .name = "mipi-dsim",
537 .id = -1,
538 .parent = &clk_div_d1_bus.clk,
539 .enable = s5pc100_d1_1_ctrl,
540 .ctrlbit = (1 << 6),
541 }, {
542 .name = "mipi-csis",
543 .id = -1,
544 .parent = &clk_div_d1_bus.clk,
545 .enable = s5pc100_d1_1_ctrl,
546 .ctrlbit = (1 << 7),
547 }, {
548 .name = "g3d",
549 .id = 0,
550 .parent = &clk_div_d1_bus.clk,
551 .enable = s5pc100_d1_0_ctrl,
552 .ctrlbit = (1 << 8),
553 }, {
554 .name = "tv",
555 .id = -1,
556 .parent = &clk_div_d1_bus.clk,
557 .enable = s5pc100_d1_2_ctrl,
558 .ctrlbit = (1 << 0),
559 }, {
560 .name = "vp",
561 .id = -1,
562 .parent = &clk_div_d1_bus.clk,
563 .enable = s5pc100_d1_2_ctrl,
564 .ctrlbit = (1 << 1),
565 }, {
566 .name = "mixer",
567 .id = -1,
568 .parent = &clk_div_d1_bus.clk,
569 .enable = s5pc100_d1_2_ctrl,
570 .ctrlbit = (1 << 2),
571 }, {
572 .name = "hdmi",
573 .id = -1,
574 .parent = &clk_div_d1_bus.clk,
575 .enable = s5pc100_d1_2_ctrl,
576 .ctrlbit = (1 << 3),
577 }, {
578 .name = "mfc",
579 .id = -1,
580 .parent = &clk_div_d1_bus.clk,
581 .enable = s5pc100_d1_2_ctrl,
582 .ctrlbit = (1 << 4),
583 }, {
584 .name = "apc",
585 .id = -1,
586 .parent = &clk_div_d1_bus.clk,
587 .enable = s5pc100_d1_3_ctrl,
588 .ctrlbit = (1 << 2),
589 }, {
590 .name = "iec",
591 .id = -1,
592 .parent = &clk_div_d1_bus.clk,
593 .enable = s5pc100_d1_3_ctrl,
594 .ctrlbit = (1 << 3),
595 }, {
596 .name = "systimer",
597 .id = -1,
598 .parent = &clk_div_d1_bus.clk,
599 .enable = s5pc100_d1_3_ctrl,
600 .ctrlbit = (1 << 7),
601 }, {
602 .name = "watchdog",
603 .id = -1,
604 .parent = &clk_div_d1_bus.clk,
605 .enable = s5pc100_d1_3_ctrl,
606 .ctrlbit = (1 << 8),
607 }, {
608 .name = "rtc",
609 .id = -1,
610 .parent = &clk_div_d1_bus.clk,
611 .enable = s5pc100_d1_3_ctrl,
612 .ctrlbit = (1 << 9),
613 }, {
614 .name = "i2c",
615 .id = 0,
616 .parent = &clk_div_d1_bus.clk,
617 .enable = s5pc100_d1_4_ctrl,
618 .ctrlbit = (1 << 4),
619 }, {
620 .name = "i2c",
621 .id = 1,
622 .parent = &clk_div_d1_bus.clk,
623 .enable = s5pc100_d1_4_ctrl,
624 .ctrlbit = (1 << 5),
625 }, {
626 .name = "spi",
627 .id = 0,
628 .parent = &clk_div_d1_bus.clk,
629 .enable = s5pc100_d1_4_ctrl,
630 .ctrlbit = (1 << 6),
631 }, {
632 .name = "spi",
633 .id = 1,
634 .parent = &clk_div_d1_bus.clk,
635 .enable = s5pc100_d1_4_ctrl,
636 .ctrlbit = (1 << 7),
637 }, {
638 .name = "spi",
639 .id = 2,
640 .parent = &clk_div_d1_bus.clk,
641 .enable = s5pc100_d1_4_ctrl,
642 .ctrlbit = (1 << 8),
643 }, {
644 .name = "irda",
645 .id = -1,
646 .parent = &clk_div_d1_bus.clk,
647 .enable = s5pc100_d1_4_ctrl,
648 .ctrlbit = (1 << 9),
649 }, {
650 .name = "ccan",
651 .id = 0,
652 .parent = &clk_div_d1_bus.clk,
653 .enable = s5pc100_d1_4_ctrl,
654 .ctrlbit = (1 << 10),
655 }, {
656 .name = "ccan",
657 .id = 1,
658 .parent = &clk_div_d1_bus.clk,
659 .enable = s5pc100_d1_4_ctrl,
660 .ctrlbit = (1 << 11),
661 }, {
662 .name = "hsitx",
663 .id = -1,
664 .parent = &clk_div_d1_bus.clk,
665 .enable = s5pc100_d1_4_ctrl,
666 .ctrlbit = (1 << 12),
667 }, {
668 .name = "hsirx",
669 .id = -1,
670 .parent = &clk_div_d1_bus.clk,
671 .enable = s5pc100_d1_4_ctrl,
672 .ctrlbit = (1 << 13),
673 }, {
674 .name = "iis",
675 .id = 0,
676 .parent = &clk_div_d1_bus.clk,
677 .enable = s5pc100_d1_5_ctrl,
678 .ctrlbit = (1 << 0),
679 }, {
680 .name = "iis",
681 .id = 1,
682 .parent = &clk_div_d1_bus.clk,
683 .enable = s5pc100_d1_5_ctrl,
684 .ctrlbit = (1 << 1),
685 }, {
686 .name = "iis",
687 .id = 2,
688 .parent = &clk_div_d1_bus.clk,
689 .enable = s5pc100_d1_5_ctrl,
690 .ctrlbit = (1 << 2),
691 }, {
692 .name = "ac97",
693 .id = -1,
694 .parent = &clk_div_d1_bus.clk,
695 .enable = s5pc100_d1_5_ctrl,
696 .ctrlbit = (1 << 3),
697 }, {
698 .name = "pcm",
699 .id = 0,
700 .parent = &clk_div_d1_bus.clk,
701 .enable = s5pc100_d1_5_ctrl,
702 .ctrlbit = (1 << 4),
703 }, {
704 .name = "pcm",
705 .id = 1,
706 .parent = &clk_div_d1_bus.clk,
707 .enable = s5pc100_d1_5_ctrl,
708 .ctrlbit = (1 << 5),
709 }, {
710 .name = "spdif",
711 .id = -1,
712 .parent = &clk_div_d1_bus.clk,
713 .enable = s5pc100_d1_5_ctrl,
714 .ctrlbit = (1 << 6),
715 }, {
716 .name = "adc",
717 .id = -1,
718 .parent = &clk_div_d1_bus.clk,
719 .enable = s5pc100_d1_5_ctrl,
720 .ctrlbit = (1 << 7),
721 }, {
Naveen Krishna Ch32018a82010-06-04 10:41:44 +0530722 .name = "keypad",
Thomas Abrahama443a632010-05-14 16:27:28 +0900723 .id = -1,
724 .parent = &clk_div_d1_bus.clk,
725 .enable = s5pc100_d1_5_ctrl,
726 .ctrlbit = (1 << 8),
727 }, {
728 .name = "spi_48m",
729 .id = 0,
730 .parent = &clk_mout_48m.clk,
731 .enable = s5pc100_sclk0_ctrl,
732 .ctrlbit = (1 << 7),
733 }, {
734 .name = "spi_48m",
735 .id = 1,
736 .parent = &clk_mout_48m.clk,
737 .enable = s5pc100_sclk0_ctrl,
738 .ctrlbit = (1 << 8),
739 }, {
740 .name = "spi_48m",
741 .id = 2,
742 .parent = &clk_mout_48m.clk,
743 .enable = s5pc100_sclk0_ctrl,
744 .ctrlbit = (1 << 9),
745 }, {
746 .name = "mmc_48m",
747 .id = 0,
748 .parent = &clk_mout_48m.clk,
749 .enable = s5pc100_sclk0_ctrl,
750 .ctrlbit = (1 << 15),
751 }, {
752 .name = "mmc_48m",
753 .id = 1,
754 .parent = &clk_mout_48m.clk,
755 .enable = s5pc100_sclk0_ctrl,
756 .ctrlbit = (1 << 16),
757 }, {
758 .name = "mmc_48m",
759 .id = 2,
760 .parent = &clk_mout_48m.clk,
761 .enable = s5pc100_sclk0_ctrl,
762 .ctrlbit = (1 << 17),
763 },
764};
765
766static struct clk clk_vclk54m = {
767 .name = "vclk_54m",
768 .id = -1,
769 .rate = 54000000,
770};
771
772static struct clk clk_i2scdclk0 = {
773 .name = "i2s_cdclk0",
774 .id = -1,
775};
776
777static struct clk clk_i2scdclk1 = {
778 .name = "i2s_cdclk1",
779 .id = -1,
780};
781
782static struct clk clk_i2scdclk2 = {
783 .name = "i2s_cdclk2",
784 .id = -1,
785};
786
787static struct clk clk_pcmcdclk0 = {
788 .name = "pcm_cdclk0",
789 .id = -1,
790};
791
792static struct clk clk_pcmcdclk1 = {
793 .name = "pcm_cdclk1",
794 .id = -1,
795};
796
797static struct clk *clk_src_group1_list[] = {
798 [0] = &clk_mout_epll.clk,
799 [1] = &clk_div_mpll2.clk,
800 [2] = &clk_fin_epll,
801 [3] = &clk_mout_hpll.clk,
802};
803
804struct clksrc_sources clk_src_group1 = {
805 .sources = clk_src_group1_list,
806 .nr_sources = ARRAY_SIZE(clk_src_group1_list),
807};
808
809static struct clk *clk_src_group2_list[] = {
810 [0] = &clk_mout_epll.clk,
811 [1] = &clk_div_mpll.clk,
812};
813
814struct clksrc_sources clk_src_group2 = {
815 .sources = clk_src_group2_list,
816 .nr_sources = ARRAY_SIZE(clk_src_group2_list),
817};
818
819static struct clk *clk_src_group3_list[] = {
820 [0] = &clk_mout_epll.clk,
821 [1] = &clk_div_mpll.clk,
822 [2] = &clk_fin_epll,
823 [3] = &clk_i2scdclk0,
824 [4] = &clk_pcmcdclk0,
825 [5] = &clk_mout_hpll.clk,
826};
827
828struct clksrc_sources clk_src_group3 = {
829 .sources = clk_src_group3_list,
830 .nr_sources = ARRAY_SIZE(clk_src_group3_list),
831};
832
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +0900833static struct clksrc_clk clk_sclk_audio0 = {
834 .clk = {
835 .name = "sclk_audio",
836 .id = 0,
837 .ctrlbit = (1 << 8),
838 .enable = s5pc100_sclk1_ctrl,
839 },
840 .sources = &clk_src_group3,
841 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 3 },
842 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
843};
844
Thomas Abrahama443a632010-05-14 16:27:28 +0900845static struct clk *clk_src_group4_list[] = {
846 [0] = &clk_mout_epll.clk,
847 [1] = &clk_div_mpll.clk,
848 [2] = &clk_fin_epll,
849 [3] = &clk_i2scdclk1,
850 [4] = &clk_pcmcdclk1,
851 [5] = &clk_mout_hpll.clk,
852};
853
854struct clksrc_sources clk_src_group4 = {
855 .sources = clk_src_group4_list,
856 .nr_sources = ARRAY_SIZE(clk_src_group4_list),
857};
858
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +0900859static struct clksrc_clk clk_sclk_audio1 = {
860 .clk = {
861 .name = "sclk_audio",
862 .id = 1,
863 .ctrlbit = (1 << 9),
864 .enable = s5pc100_sclk1_ctrl,
865 },
866 .sources = &clk_src_group4,
867 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 3 },
868 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
869};
870
Thomas Abrahama443a632010-05-14 16:27:28 +0900871static struct clk *clk_src_group5_list[] = {
872 [0] = &clk_mout_epll.clk,
873 [1] = &clk_div_mpll.clk,
874 [2] = &clk_fin_epll,
875 [3] = &clk_i2scdclk2,
876 [4] = &clk_mout_hpll.clk,
877};
878
879struct clksrc_sources clk_src_group5 = {
880 .sources = clk_src_group5_list,
881 .nr_sources = ARRAY_SIZE(clk_src_group5_list),
882};
883
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +0900884static struct clksrc_clk clk_sclk_audio2 = {
885 .clk = {
886 .name = "sclk_audio",
887 .id = 2,
888 .ctrlbit = (1 << 10),
889 .enable = s5pc100_sclk1_ctrl,
890 },
891 .sources = &clk_src_group5,
892 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 3 },
893 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
894};
895
Thomas Abrahama443a632010-05-14 16:27:28 +0900896static struct clk *clk_src_group6_list[] = {
897 [0] = &s5p_clk_27m,
898 [1] = &clk_vclk54m,
899 [2] = &clk_div_hdmi.clk,
900};
901
902struct clksrc_sources clk_src_group6 = {
903 .sources = clk_src_group6_list,
904 .nr_sources = ARRAY_SIZE(clk_src_group6_list),
905};
906
907static struct clk *clk_src_group7_list[] = {
908 [0] = &clk_mout_epll.clk,
909 [1] = &clk_div_mpll.clk,
910 [2] = &clk_mout_hpll.clk,
911 [3] = &clk_vclk54m,
912};
913
914struct clksrc_sources clk_src_group7 = {
915 .sources = clk_src_group7_list,
916 .nr_sources = ARRAY_SIZE(clk_src_group7_list),
917};
918
919static struct clk *clk_src_mmc0_list[] = {
920 [0] = &clk_mout_epll.clk,
921 [1] = &clk_div_mpll.clk,
922 [2] = &clk_fin_epll,
923};
924
925struct clksrc_sources clk_src_mmc0 = {
926 .sources = clk_src_mmc0_list,
927 .nr_sources = ARRAY_SIZE(clk_src_mmc0_list),
928};
929
930static struct clk *clk_src_mmc12_list[] = {
931 [0] = &clk_mout_epll.clk,
932 [1] = &clk_div_mpll.clk,
933 [2] = &clk_fin_epll,
934 [3] = &clk_mout_hpll.clk,
935};
936
937struct clksrc_sources clk_src_mmc12 = {
938 .sources = clk_src_mmc12_list,
939 .nr_sources = ARRAY_SIZE(clk_src_mmc12_list),
940};
941
942static struct clk *clk_src_irda_usb_list[] = {
943 [0] = &clk_mout_epll.clk,
944 [1] = &clk_div_mpll.clk,
945 [2] = &clk_fin_epll,
946 [3] = &clk_mout_hpll.clk,
947};
948
949struct clksrc_sources clk_src_irda_usb = {
950 .sources = clk_src_irda_usb_list,
951 .nr_sources = ARRAY_SIZE(clk_src_irda_usb_list),
952};
953
954static struct clk *clk_src_pwi_list[] = {
955 [0] = &clk_fin_epll,
956 [1] = &clk_mout_epll.clk,
957 [2] = &clk_div_mpll.clk,
958};
959
960struct clksrc_sources clk_src_pwi = {
961 .sources = clk_src_pwi_list,
962 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
963};
964
Seungwhan Youn04a4fd02010-10-14 10:35:23 +0900965static struct clk *clk_sclk_spdif_list[] = {
966 [0] = &clk_sclk_audio0.clk,
967 [1] = &clk_sclk_audio1.clk,
968 [2] = &clk_sclk_audio2.clk,
969};
970
971struct clksrc_sources clk_src_sclk_spdif = {
972 .sources = clk_sclk_spdif_list,
973 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
974};
975
976static int s5pc100_spdif_set_rate(struct clk *clk, unsigned long rate)
977{
978 struct clk *pclk;
979 int ret;
980
981 pclk = clk_get_parent(clk);
982 if (IS_ERR(pclk))
983 return -EINVAL;
984
985 ret = pclk->ops->set_rate(pclk, rate);
986 clk_put(pclk);
987
988 return ret;
989}
990
991static unsigned long s5pc100_spdif_get_rate(struct clk *clk)
992{
993 struct clk *pclk;
994 int rate;
995
996 pclk = clk_get_parent(clk);
997 if (IS_ERR(pclk))
998 return -EINVAL;
999
1000 rate = pclk->ops->get_rate(clk);
1001 clk_put(pclk);
1002
1003 return rate;
1004}
1005
1006static struct clk_ops s5pc100_sclk_spdif_ops = {
1007 .set_rate = s5pc100_spdif_set_rate,
1008 .get_rate = s5pc100_spdif_get_rate,
1009};
1010
1011static struct clksrc_clk clk_sclk_spdif = {
1012 .clk = {
1013 .name = "sclk_spdif",
1014 .id = -1,
1015 .ctrlbit = (1 << 11),
1016 .enable = s5pc100_sclk1_ctrl,
1017 .ops = &s5pc100_sclk_spdif_ops,
1018 },
1019 .sources = &clk_src_sclk_spdif,
1020 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
1021};
1022
Thomas Abrahama443a632010-05-14 16:27:28 +09001023static struct clksrc_clk clksrcs[] = {
1024 {
1025 .clk = {
1026 .name = "sclk_spi",
1027 .id = 0,
1028 .ctrlbit = (1 << 4),
1029 .enable = s5pc100_sclk0_ctrl,
1030
1031 },
1032 .sources = &clk_src_group1,
1033 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 2 },
1034 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
1035 }, {
1036 .clk = {
1037 .name = "sclk_spi",
1038 .id = 1,
1039 .ctrlbit = (1 << 5),
1040 .enable = s5pc100_sclk0_ctrl,
1041
1042 },
1043 .sources = &clk_src_group1,
1044 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 2 },
1045 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 },
1046 }, {
1047 .clk = {
1048 .name = "sclk_spi",
1049 .id = 2,
1050 .ctrlbit = (1 << 6),
1051 .enable = s5pc100_sclk0_ctrl,
1052
1053 },
1054 .sources = &clk_src_group1,
1055 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 2 },
1056 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 12, .size = 4 },
1057 }, {
1058 .clk = {
1059 .name = "uclk1",
1060 .id = -1,
1061 .ctrlbit = (1 << 3),
1062 .enable = s5pc100_sclk0_ctrl,
1063
1064 },
1065 .sources = &clk_src_group2,
1066 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
1067 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
1068 }, {
1069 .clk = {
1070 .name = "sclk_mixer",
1071 .id = -1,
1072 .ctrlbit = (1 << 6),
1073 .enable = s5pc100_sclk0_ctrl,
1074
1075 },
1076 .sources = &clk_src_group6,
1077 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 28, .size = 2 },
1078 }, {
1079 .clk = {
Thomas Abrahama443a632010-05-14 16:27:28 +09001080 .name = "sclk_lcd",
1081 .id = -1,
1082 .ctrlbit = (1 << 0),
1083 .enable = s5pc100_sclk1_ctrl,
1084
1085 },
1086 .sources = &clk_src_group7,
1087 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 12, .size = 2 },
1088 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
1089 }, {
1090 .clk = {
1091 .name = "sclk_fimc",
1092 .id = 0,
1093 .ctrlbit = (1 << 1),
1094 .enable = s5pc100_sclk1_ctrl,
1095
1096 },
1097 .sources = &clk_src_group7,
1098 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 16, .size = 2 },
1099 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 },
1100 }, {
1101 .clk = {
1102 .name = "sclk_fimc",
1103 .id = 1,
1104 .ctrlbit = (1 << 2),
1105 .enable = s5pc100_sclk1_ctrl,
1106
1107 },
1108 .sources = &clk_src_group7,
1109 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 20, .size = 2 },
1110 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
1111 }, {
1112 .clk = {
1113 .name = "sclk_fimc",
1114 .id = 2,
1115 .ctrlbit = (1 << 3),
1116 .enable = s5pc100_sclk1_ctrl,
1117
1118 },
1119 .sources = &clk_src_group7,
1120 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 24, .size = 2 },
1121 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 24, .size = 4 },
1122 }, {
1123 .clk = {
Marek Szyprowskiaaeedff2010-08-05 18:22:27 +09001124 .name = "sclk_mmc",
Thomas Abrahama443a632010-05-14 16:27:28 +09001125 .id = 0,
1126 .ctrlbit = (1 << 12),
1127 .enable = s5pc100_sclk1_ctrl,
1128
1129 },
1130 .sources = &clk_src_mmc0,
1131 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 },
1132 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 0, .size = 4 },
1133 }, {
1134 .clk = {
Marek Szyprowskiaaeedff2010-08-05 18:22:27 +09001135 .name = "sclk_mmc",
Thomas Abrahama443a632010-05-14 16:27:28 +09001136 .id = 1,
1137 .ctrlbit = (1 << 13),
1138 .enable = s5pc100_sclk1_ctrl,
1139
1140 },
1141 .sources = &clk_src_mmc12,
1142 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 },
1143 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 4, .size = 4 },
1144 }, {
1145 .clk = {
Marek Szyprowskiaaeedff2010-08-05 18:22:27 +09001146 .name = "sclk_mmc",
Thomas Abrahama443a632010-05-14 16:27:28 +09001147 .id = 2,
1148 .ctrlbit = (1 << 14),
1149 .enable = s5pc100_sclk1_ctrl,
1150
1151 },
1152 .sources = &clk_src_mmc12,
1153 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1154 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1155 }, {
1156 .clk = {
1157 .name = "sclk_irda",
1158 .id = 2,
1159 .ctrlbit = (1 << 10),
1160 .enable = s5pc100_sclk0_ctrl,
1161
1162 },
1163 .sources = &clk_src_irda_usb,
1164 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1165 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1166 }, {
1167 .clk = {
1168 .name = "sclk_irda",
1169 .id = -1,
1170 .ctrlbit = (1 << 10),
1171 .enable = s5pc100_sclk0_ctrl,
1172
1173 },
1174 .sources = &clk_src_mmc12,
1175 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 2 },
1176 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 16, .size = 4 },
1177 }, {
1178 .clk = {
1179 .name = "sclk_pwi",
1180 .id = -1,
1181 .ctrlbit = (1 << 1),
1182 .enable = s5pc100_sclk0_ctrl,
1183
1184 },
1185 .sources = &clk_src_pwi,
1186 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 0, .size = 2 },
1187 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 3 },
1188 }, {
1189 .clk = {
1190 .name = "sclk_uhost",
1191 .id = -1,
1192 .ctrlbit = (1 << 11),
1193 .enable = s5pc100_sclk0_ctrl,
1194
1195 },
1196 .sources = &clk_src_irda_usb,
1197 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 2 },
1198 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 20, .size = 4 },
1199 },
1200};
1201
1202/* Clock initialisation code */
1203static struct clksrc_clk *sysclks[] = {
1204 &clk_mout_apll,
1205 &clk_mout_epll,
1206 &clk_mout_mpll,
1207 &clk_mout_hpll,
1208 &clk_mout_href,
1209 &clk_mout_48m,
1210 &clk_div_apll,
1211 &clk_div_arm,
1212 &clk_div_d0_bus,
1213 &clk_div_pclkd0,
1214 &clk_div_secss,
1215 &clk_div_apll2,
1216 &clk_mout_am,
1217 &clk_div_d1_bus,
1218 &clk_div_mpll2,
1219 &clk_div_mpll,
1220 &clk_mout_onenand,
1221 &clk_div_onenand,
1222 &clk_div_pclkd1,
1223 &clk_div_cam,
1224 &clk_div_hdmi,
Seungwhan Youn4cfd9c22010-10-14 10:35:23 +09001225 &clk_sclk_audio0,
1226 &clk_sclk_audio1,
1227 &clk_sclk_audio2,
Seungwhan Youn04a4fd02010-10-14 10:35:23 +09001228 &clk_sclk_spdif,
Thomas Abrahama443a632010-05-14 16:27:28 +09001229};
1230
1231void __init_or_cpufreq s5pc100_setup_clocks(void)
1232{
1233 unsigned long xtal;
1234 unsigned long arm;
1235 unsigned long hclkd0;
1236 unsigned long hclkd1;
1237 unsigned long pclkd0;
1238 unsigned long pclkd1;
1239 unsigned long apll;
1240 unsigned long mpll;
1241 unsigned long epll;
1242 unsigned long hpll;
1243 unsigned int ptr;
1244
1245 /* Set S5PC100 functions for clk_fout_epll */
Seungwhan Yound4b34c62010-10-14 10:39:08 +09001246 clk_fout_epll.enable = s5p_epll_enable;
Thomas Abrahama443a632010-05-14 16:27:28 +09001247 clk_fout_epll.ops = &s5pc100_epll_ops;
1248
1249 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1250
1251 xtal = clk_get_rate(&clk_xtal);
1252
1253 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1254
1255 apll = s5p_get_pll65xx(xtal, __raw_readl(S5P_APLL_CON));
1256 mpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_MPLL_CON));
1257 epll = s5p_get_pll65xx(xtal, __raw_readl(S5P_EPLL_CON));
1258 hpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_HPLL_CON));
1259
1260 printk(KERN_INFO "S5PC100: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz, E=%ld.%ldMHz, H=%ld.%ldMHz\n",
1261 print_mhz(apll), print_mhz(mpll), print_mhz(epll), print_mhz(hpll));
1262
1263 clk_fout_apll.rate = apll;
1264 clk_fout_mpll.rate = mpll;
1265 clk_fout_epll.rate = epll;
1266 clk_mout_hpll.clk.rate = hpll;
1267
1268 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1269 s3c_set_clksrc(&clksrcs[ptr], true);
1270
1271 arm = clk_get_rate(&clk_div_arm.clk);
1272 hclkd0 = clk_get_rate(&clk_div_d0_bus.clk);
1273 pclkd0 = clk_get_rate(&clk_div_pclkd0.clk);
1274 hclkd1 = clk_get_rate(&clk_div_d1_bus.clk);
1275 pclkd1 = clk_get_rate(&clk_div_pclkd1.clk);
1276
1277 printk(KERN_INFO "S5PC100: HCLKD0=%ld.%ldMHz, HCLKD1=%ld.%ldMHz, PCLKD0=%ld.%ldMHz, PCLKD1=%ld.%ldMHz\n",
1278 print_mhz(hclkd0), print_mhz(hclkd1), print_mhz(pclkd0), print_mhz(pclkd1));
1279
1280 clk_f.rate = arm;
1281 clk_h.rate = hclkd1;
1282 clk_p.rate = pclkd1;
1283}
1284
1285/*
1286 * The following clocks will be enabled during clock initialization.
1287 */
1288static struct clk init_clocks[] = {
1289 {
1290 .name = "tzic",
1291 .id = -1,
1292 .parent = &clk_div_d0_bus.clk,
1293 .enable = s5pc100_d0_0_ctrl,
1294 .ctrlbit = (1 << 1),
1295 }, {
1296 .name = "intc",
1297 .id = -1,
1298 .parent = &clk_div_d0_bus.clk,
1299 .enable = s5pc100_d0_0_ctrl,
1300 .ctrlbit = (1 << 0),
1301 }, {
1302 .name = "ebi",
1303 .id = -1,
1304 .parent = &clk_div_d0_bus.clk,
1305 .enable = s5pc100_d0_1_ctrl,
1306 .ctrlbit = (1 << 5),
1307 }, {
1308 .name = "intmem",
1309 .id = -1,
1310 .parent = &clk_div_d0_bus.clk,
1311 .enable = s5pc100_d0_1_ctrl,
1312 .ctrlbit = (1 << 4),
1313 }, {
1314 .name = "sromc",
1315 .id = -1,
1316 .parent = &clk_div_d0_bus.clk,
1317 .enable = s5pc100_d0_1_ctrl,
1318 .ctrlbit = (1 << 1),
1319 }, {
1320 .name = "dmc",
1321 .id = -1,
1322 .parent = &clk_div_d0_bus.clk,
1323 .enable = s5pc100_d0_1_ctrl,
1324 .ctrlbit = (1 << 0),
1325 }, {
1326 .name = "chipid",
1327 .id = -1,
1328 .parent = &clk_div_d0_bus.clk,
1329 .enable = s5pc100_d0_1_ctrl,
1330 .ctrlbit = (1 << 0),
1331 }, {
1332 .name = "gpio",
1333 .id = -1,
1334 .parent = &clk_div_d1_bus.clk,
1335 .enable = s5pc100_d1_3_ctrl,
1336 .ctrlbit = (1 << 1),
1337 }, {
1338 .name = "uart",
1339 .id = 0,
1340 .parent = &clk_div_d1_bus.clk,
1341 .enable = s5pc100_d1_4_ctrl,
1342 .ctrlbit = (1 << 0),
1343 }, {
1344 .name = "uart",
1345 .id = 1,
1346 .parent = &clk_div_d1_bus.clk,
1347 .enable = s5pc100_d1_4_ctrl,
1348 .ctrlbit = (1 << 1),
1349 }, {
1350 .name = "uart",
1351 .id = 2,
1352 .parent = &clk_div_d1_bus.clk,
1353 .enable = s5pc100_d1_4_ctrl,
1354 .ctrlbit = (1 << 2),
1355 }, {
1356 .name = "uart",
1357 .id = 3,
1358 .parent = &clk_div_d1_bus.clk,
1359 .enable = s5pc100_d1_4_ctrl,
1360 .ctrlbit = (1 << 3),
1361 }, {
1362 .name = "timers",
1363 .id = -1,
1364 .parent = &clk_div_d1_bus.clk,
1365 .enable = s5pc100_d1_3_ctrl,
1366 .ctrlbit = (1 << 6),
1367 },
1368};
1369
1370static struct clk *clks[] __initdata = {
1371 &clk_ext,
1372 &clk_i2scdclk0,
1373 &clk_i2scdclk1,
1374 &clk_i2scdclk2,
1375 &clk_pcmcdclk0,
1376 &clk_pcmcdclk1,
1377};
1378
1379void __init s5pc100_register_clocks(void)
1380{
1381 struct clk *clkp;
1382 int ret;
1383 int ptr;
1384
1385 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1386
1387 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1388 s3c_register_clksrc(sysclks[ptr], 1);
1389
1390 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1391 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1392
1393 clkp = init_clocks_disable;
1394 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
1395
1396 ret = s3c24xx_register_clock(clkp);
1397 if (ret < 0) {
1398 printk(KERN_ERR "Failed to register clock %s (%d)\n",
1399 clkp->name, ret);
1400 }
1401 (clkp->enable)(clkp, 0);
1402 }
1403
1404 s3c_pwmclk_init();
1405}