aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2012-03-07 05:00:04 -0500
committerKukjin Kim <kgene.kim@samsung.com>2012-03-07 05:00:04 -0500
commit9edc12a1a9db50fd7659463adf5a0e1eb5f2ce0d (patch)
tree4cc78074268d76b93e1b3c115e4a083dc060131e /arch
parentb681bfcf484519112ed67ceaed94fdaca929aaef (diff)
ARM: S3C24XX: add get_rate for clk_p on S3C2416/2443
Currently the rate of clk_p is calculated once and set through the s3c24xx_setup_clocks call. As the clk_p is a child of clk_h we can evaluate its divider and calculate the rate in get_rate. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s3c24xx/common-s3c2443.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c
index 5e863bff5c7f..46795db2af41 100644
--- a/arch/arm/mach-s3c24xx/common-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/common-s3c2443.c
@@ -187,6 +187,25 @@ static struct clk_ops clk_h_ops = {
187 .get_rate = s3c2443_hclkdiv_getrate, 187 .get_rate = s3c2443_hclkdiv_getrate,
188}; 188};
189 189
190/* pclk divider
191 *
192 * divides the hclk and provides the pclk.
193 */
194
195static unsigned long s3c2443_pclkdiv_getrate(struct clk *clk)
196{
197 unsigned long rate = clk_get_rate(clk->parent);
198 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
199
200 clkdiv0 = ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 1 : 0);
201
202 return rate / (clkdiv0 + 1);
203}
204
205static struct clk_ops clk_p_ops = {
206 .get_rate = s3c2443_pclkdiv_getrate,
207};
208
190/* armdiv 209/* armdiv
191 * 210 *
192 * this clock is sourced from msysclk and can have a number of 211 * this clock is sourced from msysclk and can have a number of
@@ -549,7 +568,6 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
549{ 568{
550 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); 569 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
551 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); 570 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
552 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
553 struct clk *xtal_clk; 571 struct clk *xtal_clk;
554 unsigned long xtal; 572 unsigned long xtal;
555 unsigned long pll; 573 unsigned long pll;
@@ -567,7 +585,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
567 585
568 fclk = clk_get_rate(&clk_armdiv); 586 fclk = clk_get_rate(&clk_armdiv);
569 hclk = clk_get_rate(&clk_h); 587 hclk = clk_get_rate(&clk_h);
570 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 588 pclk = clk_get_rate(&clk_p);
571 589
572 s3c24xx_setup_clocks(fclk, hclk, pclk); 590 s3c24xx_setup_clocks(fclk, hclk, pclk);
573 591
@@ -630,11 +648,13 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
630 nr_armdiv = nr_divs; 648 nr_armdiv = nr_divs;
631 armdivmask = divmask; 649 armdivmask = divmask;
632 650
633 /* s3c2443 parents h and p clocks from prediv */ 651 /* s3c2443 parents h clock from prediv */
634 clk_h.parent = &clk_prediv; 652 clk_h.parent = &clk_prediv;
635 clk_h.ops = &clk_h_ops; 653 clk_h.ops = &clk_h_ops;
636 654
637 clk_p.parent = &clk_prediv; 655 /* and p clock from h clock */
656 clk_p.parent = &clk_h;
657 clk_p.ops = &clk_p_ops;
638 658
639 clk_usb_bus.parent = &clk_usb_bus_host.clk; 659 clk_usb_bus.parent = &clk_usb_bus_host.clk;
640 clk_epll.parent = &clk_epllref.clk; 660 clk_epll.parent = &clk_epllref.clk;