aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s5p6440/clock.c
diff options
context:
space:
mode:
authorThomas Abraham <thomas.ab@samsung.com>2010-05-12 20:27:04 -0400
committerBen Dooks <ben-linux@fluff.org>2010-05-12 21:14:48 -0400
commit9c72d016e2b556e7d8f739b21404f32333fbc5e4 (patch)
tree1560ceaf7a0a639dde91bf7b0fe7d0564aa1cc60 /arch/arm/mach-s5p6440/clock.c
parent30d58349608c3a31dbea0cc9238f6d8edc21e299 (diff)
ARM: S5P6440: Remove usage of clk_arm and add clk_armclk clock
The clk_arm clock is of type 'struct clk' whereas on S5P6440, the arm clock is more suitable to be of type 'struct clksrc_clk' (since arm clock is divided version of apll clock). This patch modifies the following. 1. Removes the usage of clk_arm clock (defined in plat-s5p) and defines the new clock 'clk_armclk' of type 'struct clksrc_clk'. 2. Rearranges the assignment of clock rate for the fout_a/m/epll clocks. This will help in calculating the clock rate of fclk from clk_armclk clock and setup the clock rate for fout_m/epll for subsequent patches which depend on it. 3. Modifies the clock rate calculation of fclk to be based on the newly added clk_armclk 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/clock.c')
-rw-r--r--arch/arm/mach-s5p6440/clock.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/arch/arm/mach-s5p6440/clock.c b/arch/arm/mach-s5p6440/clock.c
index 8bd6f15a2ac1..2c6dd544ff62 100644
--- a/arch/arm/mach-s5p6440/clock.c
+++ b/arch/arm/mach-s5p6440/clock.c
@@ -247,6 +247,16 @@ static struct clk_ops s5p6440_clkarm_ops = {
247 .round_rate = s5p6440_armclk_round_rate, 247 .round_rate = s5p6440_armclk_round_rate,
248}; 248};
249 249
250static struct clksrc_clk clk_armclk = {
251 .clk = {
252 .name = "armclk",
253 .id = 1,
254 .parent = &clk_mout_apll.clk,
255 .ops = &s5p6440_clkarm_ops,
256 },
257 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 4 },
258};
259
250static struct clksrc_clk clk_dout_mpll = { 260static struct clksrc_clk clk_dout_mpll = {
251 .clk = { 261 .clk = {
252 .name = "dout_mpll", 262 .name = "dout_mpll",
@@ -569,6 +579,7 @@ static struct clksrc_clk *sysclks[] = {
569 &clk_mout_epll, 579 &clk_mout_epll,
570 &clk_mout_mpll, 580 &clk_mout_mpll,
571 &clk_dout_mpll, 581 &clk_dout_mpll,
582 &clk_armclk,
572}; 583};
573 584
574void __init_or_cpufreq s5p6440_setup_clocks(void) 585void __init_or_cpufreq s5p6440_setup_clocks(void)
@@ -592,8 +603,6 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
592 clk_fout_epll.ops = &s5p6440_epll_ops; 603 clk_fout_epll.ops = &s5p6440_epll_ops;
593 604
594 /* Set S5P6440 functions for arm clock */ 605 /* Set S5P6440 functions for arm clock */
595 clk_arm.parent = &clk_mout_apll.clk;
596 clk_arm.ops = &s5p6440_clkarm_ops;
597 clk_48m.enable = s5p6440_clk48m_ctrl; 606 clk_48m.enable = s5p6440_clk48m_ctrl;
598 607
599 clkdiv0 = __raw_readl(S5P_CLK_DIV0); 608 clkdiv0 = __raw_readl(S5P_CLK_DIV0);
@@ -610,11 +619,15 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
610 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); 619 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
611 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4502); 620 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4502);
612 621
622 clk_fout_mpll.rate = mpll;
623 clk_fout_epll.rate = epll;
624 clk_fout_apll.rate = apll;
625
613 printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \ 626 printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
614 " E=%ld.%ldMHz\n", 627 " E=%ld.%ldMHz\n",
615 print_mhz(apll), print_mhz(mpll), print_mhz(epll)); 628 print_mhz(apll), print_mhz(mpll), print_mhz(epll));
616 629
617 fclk = apll / GET_DIV(clkdiv0, S5P_CLKDIV0_ARM); 630 fclk = clk_get_rate(&clk_armclk.clk);
618 hclk = fclk / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK); 631 hclk = fclk / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK);
619 pclk = hclk / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK); 632 pclk = hclk / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK);
620 633
@@ -633,10 +646,6 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
633 print_mhz(hclk), print_mhz(hclk_low), 646 print_mhz(hclk), print_mhz(hclk_low),
634 print_mhz(pclk), print_mhz(pclk_low)); 647 print_mhz(pclk), print_mhz(pclk_low));
635 648
636 clk_fout_mpll.rate = mpll;
637 clk_fout_epll.rate = epll;
638 clk_fout_apll.rate = apll;
639
640 clk_f.rate = fclk; 649 clk_f.rate = fclk;
641 clk_h.rate = hclk; 650 clk_h.rate = hclk;
642 clk_p.rate = pclk; 651 clk_p.rate = pclk;