Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295700
b: refs/heads/master
c: b681bfc
h: refs/heads/master
v: v3
  • Loading branch information
Heiko Stuebner authored and Kukjin Kim committed Mar 7, 2012
1 parent 8fe9e39 commit 05be8a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d9811f11f823f28d8d04fbb6aafebb909a4cd15
refs/heads/master: b681bfcf484519112ed67ceaed94fdaca929aaef
31 changes: 22 additions & 9 deletions trunk/arch/arm/mach-s3c24xx/common-s3c2443.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,25 @@ static struct clk clk_prediv = {
},
};

/* hclk divider
*
* divides the prediv and provides the hclk.
*/

static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk)
{
unsigned long rate = clk_get_rate(clk->parent);
unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);

clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;

return rate / (clkdiv0 + 1);
}

static struct clk_ops clk_h_ops = {
.get_rate = s3c2443_hclkdiv_getrate,
};

/* armdiv
*
* this clock is sourced from msysclk and can have a number of
Expand Down Expand Up @@ -524,13 +543,6 @@ static struct clk hsmmc1_clk = {
.ctrlbit = S3C2443_HCLKCON_HSMMC,
};

static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0)
{
clkcon0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;

return clkcon0 + 1;
}

/* EPLLCON compatible enough to get on/off information */

void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
Expand All @@ -554,8 +566,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
clk_msysclk.clk.rate = pll;

fclk = clk_get_rate(&clk_armdiv);
hclk = s3c2443_prediv_getrate(&clk_prediv);
hclk /= s3c2443_get_hdiv(clkdiv0);
hclk = clk_get_rate(&clk_h);
pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);

s3c24xx_setup_clocks(fclk, hclk, pclk);
Expand Down Expand Up @@ -621,6 +632,8 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,

/* s3c2443 parents h and p clocks from prediv */
clk_h.parent = &clk_prediv;
clk_h.ops = &clk_h_ops;

clk_p.parent = &clk_prediv;

clk_usb_bus.parent = &clk_usb_bus_host.clk;
Expand Down

0 comments on commit 05be8a9

Please sign in to comment.