summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Almesberger <werner@openmoko.org>2009-02-27 12:03:07 +0100
committerBen Dooks <ben-linux@fluff.org>2009-02-27 12:34:01 +0100
commitefeff568677aa325f84d3ce37c219019887a79eb (patch)
tree455f6ff1ae9e64da5bd7b0e146f3b8479fc78b0c
parent[ARM] S3C64XX: sparse warnings in arch/arm/plat-s3c64xx/irq.c (diff)
downloadlinux-efeff568677aa325f84d3ce37c219019887a79eb.tar.xz
linux-efeff568677aa325f84d3ce37c219019887a79eb.zip
[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>
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c6
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)
rate = clk_round_rate(clk, rate);
div = clk_get_rate(clk->parent) / rate;
+ if (div > 16)
+ return -EINVAL;
val = __raw_readl(reg);
- val &= ~sclk->mask;
- val |= (rate - 1) << sclk->shift;
+ val &= ~(0xf << sclk->shift);
+ val |= (div - 1) << sclk->shift;
__raw_writel(val, reg);
return 0;