diff options
author | Werner Almesberger <werner@openmoko.org> | 2009-02-27 06:03:07 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-02-27 06:34:01 -0500 |
commit | efeff568677aa325f84d3ce37c219019887a79eb (patch) | |
tree | 455f6ff1ae9e64da5bd7b0e146f3b8479fc78b0c /arch/arm | |
parent | fdca9bf2dae14218704ddd7dc60ad1b198c1d787 (diff) |
[ARM] S3C64XX: Fix s3c64xx_setrate_clksrc
Some of the rate selection logic in s3c64xx_setrate_clksrc uses what
appears to be parent clock selection logic. This patch corrects it.
I also added a check for overly large dividers to prevent them from
changing unrelated clocks.
Signed-off-by: Werner Almesberger <werner@openmoko.org>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-s3c64xx/s3c6400-clock.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c index 6edbeef6aa9d..05b17528041e 100644 --- a/arch/arm/plat-s3c64xx/s3c6400-clock.c +++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c | |||
@@ -239,10 +239,12 @@ static int s3c64xx_setrate_clksrc(struct clk *clk, unsigned long rate) | |||
239 | 239 | ||
240 | rate = clk_round_rate(clk, rate); | 240 | rate = clk_round_rate(clk, rate); |
241 | div = clk_get_rate(clk->parent) / rate; | 241 | div = clk_get_rate(clk->parent) / rate; |
242 | if (div > 16) | ||
243 | return -EINVAL; | ||
242 | 244 | ||
243 | val = __raw_readl(reg); | 245 | val = __raw_readl(reg); |
244 | val &= ~sclk->mask; | 246 | val &= ~(0xf << sclk->shift); |
245 | val |= (rate - 1) << sclk->shift; | 247 | val |= (div - 1) << sclk->shift; |
246 | __raw_writel(val, reg); | 248 | __raw_writel(val, reg); |
247 | 249 | ||
248 | return 0; | 250 | return 0; |