aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s5p6440
diff options
context:
space:
mode:
authorThomas Abraham <thomas.ab@samsung.com>2010-05-12 20:27:29 -0400
committerBen Dooks <ben-linux@fluff.org>2010-05-12 21:42:47 -0400
commit697f8a9fe7835ba24f2da855c5de4ddbe27aa554 (patch)
tree54b2ee7584aa14156d701e265fc890c3998c6e9b /arch/arm/mach-s5p6440
parent93ad94db5509ccac65a57f6fc599d61a61767efc (diff)
ARM: S5P6440: Remove usage of clk_p_low and add clk_pclk_low clock
The pclk_low clock is of type 'struct clk' whereas on S5P6440, the pclk_low clock is more suitable to be of type 'struct clksrc_clk' (since pclk_low clock is a divided clock of hclk_low clock). This patch modifies the following. 1. Removes the definition and usage of clk_p_clk clock. 2. Adds the clk_pclk_low clock of type 'struct clksrc_clk' clock. 3. Adds clk_pclk_low to the list of system clocks. 4. The clock rate of pclk_low is derived from the clk_pclk_low clock. Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s5p6440')
-rw-r--r--arch/arm/mach-s5p6440/clock.c55
1 files changed, 24 insertions, 31 deletions
diff --git a/arch/arm/mach-s5p6440/clock.c b/arch/arm/mach-s5p6440/clock.c
index c70b3a4075e9..80d18f54ee70 100644
--- a/arch/arm/mach-s5p6440/clock.c
+++ b/arch/arm/mach-s5p6440/clock.c
@@ -134,15 +134,6 @@ static struct clksrc_clk clk_mout_mpll = {
134 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 }, 134 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 },
135}; 135};
136 136
137static struct clk clk_p_low = {
138 .name = "pclk_low",
139 .id = -1,
140 .rate = 0,
141 .parent = NULL,
142 .ctrlbit = 0,
143 .ops = &clk_ops_def_setrate,
144};
145
146enum perf_level { 137enum perf_level {
147 L0 = 532*1000, 138 L0 = 532*1000,
148 L1 = 266*1000, 139 L1 = 266*1000,
@@ -295,6 +286,15 @@ static struct clksrc_clk clk_hclk_low = {
295 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 }, 286 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
296}; 287};
297 288
289static struct clksrc_clk clk_pclk_low = {
290 .clk = {
291 .name = "pclk_low",
292 .id = -1,
293 .parent = &clk_hclk_low.clk,
294 },
295 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
296};
297
298int s5p6440_clk48m_ctrl(struct clk *clk, int enable) 298int s5p6440_clk48m_ctrl(struct clk *clk, int enable)
299{ 299{
300 unsigned long flags; 300 unsigned long flags;
@@ -356,31 +356,31 @@ static struct clk init_clocks_disable[] = {
356 }, { 356 }, {
357 .name = "adc", 357 .name = "adc",
358 .id = -1, 358 .id = -1,
359 .parent = &clk_p_low, 359 .parent = &clk_pclk_low.clk,
360 .enable = s5p6440_pclk_ctrl, 360 .enable = s5p6440_pclk_ctrl,
361 .ctrlbit = S5P_CLKCON_PCLK_TSADC, 361 .ctrlbit = S5P_CLKCON_PCLK_TSADC,
362 }, { 362 }, {
363 .name = "i2c", 363 .name = "i2c",
364 .id = -1, 364 .id = -1,
365 .parent = &clk_p_low, 365 .parent = &clk_pclk_low.clk,
366 .enable = s5p6440_pclk_ctrl, 366 .enable = s5p6440_pclk_ctrl,
367 .ctrlbit = S5P_CLKCON_PCLK_IIC0, 367 .ctrlbit = S5P_CLKCON_PCLK_IIC0,
368 }, { 368 }, {
369 .name = "i2s_v40", 369 .name = "i2s_v40",
370 .id = 0, 370 .id = 0,
371 .parent = &clk_p_low, 371 .parent = &clk_pclk_low.clk,
372 .enable = s5p6440_pclk_ctrl, 372 .enable = s5p6440_pclk_ctrl,
373 .ctrlbit = S5P_CLKCON_PCLK_IIS2, 373 .ctrlbit = S5P_CLKCON_PCLK_IIS2,
374 }, { 374 }, {
375 .name = "spi", 375 .name = "spi",
376 .id = 0, 376 .id = 0,
377 .parent = &clk_p_low, 377 .parent = &clk_pclk_low.clk,
378 .enable = s5p6440_pclk_ctrl, 378 .enable = s5p6440_pclk_ctrl,
379 .ctrlbit = S5P_CLKCON_PCLK_SPI0, 379 .ctrlbit = S5P_CLKCON_PCLK_SPI0,
380 }, { 380 }, {
381 .name = "spi", 381 .name = "spi",
382 .id = 1, 382 .id = 1,
383 .parent = &clk_p_low, 383 .parent = &clk_pclk_low.clk,
384 .enable = s5p6440_pclk_ctrl, 384 .enable = s5p6440_pclk_ctrl,
385 .ctrlbit = S5P_CLKCON_PCLK_SPI1, 385 .ctrlbit = S5P_CLKCON_PCLK_SPI1,
386 }, { 386 }, {
@@ -452,19 +452,19 @@ static struct clk init_clocks_disable[] = {
452 }, { 452 }, {
453 .name = "rtc", 453 .name = "rtc",
454 .id = -1, 454 .id = -1,
455 .parent = &clk_p_low, 455 .parent = &clk_pclk_low.clk,
456 .enable = s5p6440_pclk_ctrl, 456 .enable = s5p6440_pclk_ctrl,
457 .ctrlbit = S5P_CLKCON_PCLK_RTC, 457 .ctrlbit = S5P_CLKCON_PCLK_RTC,
458 }, { 458 }, {
459 .name = "watchdog", 459 .name = "watchdog",
460 .id = -1, 460 .id = -1,
461 .parent = &clk_p_low, 461 .parent = &clk_pclk_low.clk,
462 .enable = s5p6440_pclk_ctrl, 462 .enable = s5p6440_pclk_ctrl,
463 .ctrlbit = S5P_CLKCON_PCLK_WDT, 463 .ctrlbit = S5P_CLKCON_PCLK_WDT,
464 }, { 464 }, {
465 .name = "timers", 465 .name = "timers",
466 .id = -1, 466 .id = -1,
467 .parent = &clk_p_low, 467 .parent = &clk_pclk_low.clk,
468 .enable = s5p6440_pclk_ctrl, 468 .enable = s5p6440_pclk_ctrl,
469 .ctrlbit = S5P_CLKCON_PCLK_PWM, 469 .ctrlbit = S5P_CLKCON_PCLK_PWM,
470 } 470 }
@@ -477,31 +477,31 @@ static struct clk init_clocks[] = {
477 { 477 {
478 .name = "gpio", 478 .name = "gpio",
479 .id = -1, 479 .id = -1,
480 .parent = &clk_p_low, 480 .parent = &clk_pclk_low.clk,
481 .enable = s5p6440_pclk_ctrl, 481 .enable = s5p6440_pclk_ctrl,
482 .ctrlbit = S5P_CLKCON_PCLK_GPIO, 482 .ctrlbit = S5P_CLKCON_PCLK_GPIO,
483 }, { 483 }, {
484 .name = "uart", 484 .name = "uart",
485 .id = 0, 485 .id = 0,
486 .parent = &clk_p_low, 486 .parent = &clk_pclk_low.clk,
487 .enable = s5p6440_pclk_ctrl, 487 .enable = s5p6440_pclk_ctrl,
488 .ctrlbit = S5P_CLKCON_PCLK_UART0, 488 .ctrlbit = S5P_CLKCON_PCLK_UART0,
489 }, { 489 }, {
490 .name = "uart", 490 .name = "uart",
491 .id = 1, 491 .id = 1,
492 .parent = &clk_p_low, 492 .parent = &clk_pclk_low.clk,
493 .enable = s5p6440_pclk_ctrl, 493 .enable = s5p6440_pclk_ctrl,
494 .ctrlbit = S5P_CLKCON_PCLK_UART1, 494 .ctrlbit = S5P_CLKCON_PCLK_UART1,
495 }, { 495 }, {
496 .name = "uart", 496 .name = "uart",
497 .id = 2, 497 .id = 2,
498 .parent = &clk_p_low, 498 .parent = &clk_pclk_low.clk,
499 .enable = s5p6440_pclk_ctrl, 499 .enable = s5p6440_pclk_ctrl,
500 .ctrlbit = S5P_CLKCON_PCLK_UART2, 500 .ctrlbit = S5P_CLKCON_PCLK_UART2,
501 }, { 501 }, {
502 .name = "uart", 502 .name = "uart",
503 .id = 3, 503 .id = 3,
504 .parent = &clk_p_low, 504 .parent = &clk_pclk_low.clk,
505 .enable = s5p6440_pclk_ctrl, 505 .enable = s5p6440_pclk_ctrl,
506 .ctrlbit = S5P_CLKCON_PCLK_UART3, 506 .ctrlbit = S5P_CLKCON_PCLK_UART3,
507 } 507 }
@@ -612,6 +612,7 @@ static struct clksrc_clk *sysclks[] = {
612 &clk_hclk, 612 &clk_hclk,
613 &clk_pclk, 613 &clk_pclk,
614 &clk_hclk_low, 614 &clk_hclk_low,
615 &clk_pclk_low,
615}; 616};
616 617
617void __init_or_cpufreq s5p6440_setup_clocks(void) 618void __init_or_cpufreq s5p6440_setup_clocks(void)
@@ -627,19 +628,13 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
627 unsigned long apll; 628 unsigned long apll;
628 unsigned long mpll; 629 unsigned long mpll;
629 unsigned int ptr; 630 unsigned int ptr;
630 u32 clkdiv0;
631 u32 clkdiv3;
632 631
633 /* Set S5P6440 functions for clk_fout_epll */ 632 /* Set S5P6440 functions for clk_fout_epll */
634 clk_fout_epll.enable = s5p6440_epll_enable; 633 clk_fout_epll.enable = s5p6440_epll_enable;
635 clk_fout_epll.ops = &s5p6440_epll_ops; 634 clk_fout_epll.ops = &s5p6440_epll_ops;
636 635
637 /* Set S5P6440 functions for arm clock */
638 clk_48m.enable = s5p6440_clk48m_ctrl; 636 clk_48m.enable = s5p6440_clk48m_ctrl;
639 637
640 clkdiv0 = __raw_readl(S5P_CLK_DIV0);
641 clkdiv3 = __raw_readl(S5P_CLK_DIV3);
642
643 xtal_clk = clk_get(NULL, "ext_xtal"); 638 xtal_clk = clk_get(NULL, "ext_xtal");
644 BUG_ON(IS_ERR(xtal_clk)); 639 BUG_ON(IS_ERR(xtal_clk));
645 640
@@ -663,7 +658,7 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
663 hclk = clk_get_rate(&clk_hclk.clk); 658 hclk = clk_get_rate(&clk_hclk.clk);
664 pclk = clk_get_rate(&clk_pclk.clk); 659 pclk = clk_get_rate(&clk_pclk.clk);
665 hclk_low = clk_get_rate(&clk_hclk_low.clk); 660 hclk_low = clk_get_rate(&clk_hclk_low.clk);
666 pclk_low = hclk_low / GET_DIV(clkdiv3, S5P_CLKDIV3_PCLK_LOW); 661 pclk_low = clk_get_rate(&clk_pclk_low.clk);
667 662
668 printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \ 663 printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
669 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n", 664 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
@@ -673,7 +668,6 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
673 clk_f.rate = fclk; 668 clk_f.rate = fclk;
674 clk_h.rate = hclk; 669 clk_h.rate = hclk;
675 clk_p.rate = pclk; 670 clk_p.rate = pclk;
676 clk_p_low.rate = pclk_low;
677 671
678 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 672 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
679 s3c_set_clksrc(&clksrcs[ptr], true); 673 s3c_set_clksrc(&clksrcs[ptr], true);
@@ -683,7 +677,6 @@ static struct clk *clks[] __initdata = {
683 &clk_ext, 677 &clk_ext,
684 &clk_iis_cd_v40, 678 &clk_iis_cd_v40,
685 &clk_pcm_cd, 679 &clk_pcm_cd,
686 &clk_p_low,
687}; 680};
688 681
689void __init s5p6440_register_clocks(void) 682void __init s5p6440_register_clocks(void)