diff options
author | Heiko Stuebner <heiko@sntech.de> | 2012-03-07 05:00:04 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2012-03-07 05:00:04 -0500 |
commit | b681bfcf484519112ed67ceaed94fdaca929aaef (patch) | |
tree | 39e959421ce61ce8a4800425b4d012e9f8561475 /arch/arm/mach-s3c24xx/common-s3c2443.c | |
parent | 7d9811f11f823f28d8d04fbb6aafebb909a4cd15 (diff) |
ARM: S3C24XX: add get_rate for clk_h on S3C2416/2443
Currently the rate of clk_h is calculated once and set through the
s3c24xx_setup_clocks call. As the clk_h is a child of the prediv
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/arm/mach-s3c24xx/common-s3c2443.c')
-rw-r--r-- | arch/arm/mach-s3c24xx/common-s3c2443.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c index 274561677e5c..5e863bff5c7f 100644 --- a/arch/arm/mach-s3c24xx/common-s3c2443.c +++ b/arch/arm/mach-s3c24xx/common-s3c2443.c | |||
@@ -168,6 +168,25 @@ static struct clk clk_prediv = { | |||
168 | }, | 168 | }, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | /* hclk divider | ||
172 | * | ||
173 | * divides the prediv and provides the hclk. | ||
174 | */ | ||
175 | |||
176 | static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk) | ||
177 | { | ||
178 | unsigned long rate = clk_get_rate(clk->parent); | ||
179 | unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0); | ||
180 | |||
181 | clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK; | ||
182 | |||
183 | return rate / (clkdiv0 + 1); | ||
184 | } | ||
185 | |||
186 | static struct clk_ops clk_h_ops = { | ||
187 | .get_rate = s3c2443_hclkdiv_getrate, | ||
188 | }; | ||
189 | |||
171 | /* armdiv | 190 | /* armdiv |
172 | * | 191 | * |
173 | * this clock is sourced from msysclk and can have a number of | 192 | * this clock is sourced from msysclk and can have a number of |
@@ -524,13 +543,6 @@ static struct clk hsmmc1_clk = { | |||
524 | .ctrlbit = S3C2443_HCLKCON_HSMMC, | 543 | .ctrlbit = S3C2443_HCLKCON_HSMMC, |
525 | }; | 544 | }; |
526 | 545 | ||
527 | static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0) | ||
528 | { | ||
529 | clkcon0 &= S3C2443_CLKDIV0_HCLKDIV_MASK; | ||
530 | |||
531 | return clkcon0 + 1; | ||
532 | } | ||
533 | |||
534 | /* EPLLCON compatible enough to get on/off information */ | 546 | /* EPLLCON compatible enough to get on/off information */ |
535 | 547 | ||
536 | void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) | 548 | void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) |
@@ -554,8 +566,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) | |||
554 | clk_msysclk.clk.rate = pll; | 566 | clk_msysclk.clk.rate = pll; |
555 | 567 | ||
556 | fclk = clk_get_rate(&clk_armdiv); | 568 | fclk = clk_get_rate(&clk_armdiv); |
557 | hclk = s3c2443_prediv_getrate(&clk_prediv); | 569 | hclk = clk_get_rate(&clk_h); |
558 | hclk /= s3c2443_get_hdiv(clkdiv0); | ||
559 | pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); | 570 | pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); |
560 | 571 | ||
561 | s3c24xx_setup_clocks(fclk, hclk, pclk); | 572 | s3c24xx_setup_clocks(fclk, hclk, pclk); |
@@ -621,6 +632,8 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, | |||
621 | 632 | ||
622 | /* s3c2443 parents h and p clocks from prediv */ | 633 | /* s3c2443 parents h and p clocks from prediv */ |
623 | clk_h.parent = &clk_prediv; | 634 | clk_h.parent = &clk_prediv; |
635 | clk_h.ops = &clk_h_ops; | ||
636 | |||
624 | clk_p.parent = &clk_prediv; | 637 | clk_p.parent = &clk_prediv; |
625 | 638 | ||
626 | clk_usb_bus.parent = &clk_usb_bus_host.clk; | 639 | clk_usb_bus.parent = &clk_usb_bus_host.clk; |