diff options
Diffstat (limited to 'arch/arm/plat-samsung/clock-clksrc.c')
-rw-r--r-- | arch/arm/plat-samsung/clock-clksrc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/plat-samsung/clock-clksrc.c b/arch/arm/plat-samsung/clock-clksrc.c index 656c70e0400a..ae8b8507663f 100644 --- a/arch/arm/plat-samsung/clock-clksrc.c +++ b/arch/arm/plat-samsung/clock-clksrc.c | |||
@@ -60,7 +60,7 @@ static int s3c_setrate_clksrc(struct clk *clk, unsigned long rate) | |||
60 | 60 | ||
61 | rate = clk_round_rate(clk, rate); | 61 | rate = clk_round_rate(clk, rate); |
62 | div = clk_get_rate(clk->parent) / rate; | 62 | div = clk_get_rate(clk->parent) / rate; |
63 | if (div > 16) | 63 | if (div > (1 << sclk->reg_div.size)) |
64 | return -EINVAL; | 64 | return -EINVAL; |
65 | 65 | ||
66 | val = __raw_readl(reg); | 66 | val = __raw_readl(reg); |
@@ -102,7 +102,9 @@ static int s3c_setparent_clksrc(struct clk *clk, struct clk *parent) | |||
102 | static unsigned long s3c_roundrate_clksrc(struct clk *clk, | 102 | static unsigned long s3c_roundrate_clksrc(struct clk *clk, |
103 | unsigned long rate) | 103 | unsigned long rate) |
104 | { | 104 | { |
105 | struct clksrc_clk *sclk = to_clksrc(clk); | ||
105 | unsigned long parent_rate = clk_get_rate(clk->parent); | 106 | unsigned long parent_rate = clk_get_rate(clk->parent); |
107 | int max_div = 1 << sclk->reg_div.size; | ||
106 | int div; | 108 | int div; |
107 | 109 | ||
108 | if (rate >= parent_rate) | 110 | if (rate >= parent_rate) |
@@ -114,8 +116,8 @@ static unsigned long s3c_roundrate_clksrc(struct clk *clk, | |||
114 | 116 | ||
115 | if (div == 0) | 117 | if (div == 0) |
116 | div = 1; | 118 | div = 1; |
117 | if (div > 16) | 119 | if (div > max_div) |
118 | div = 16; | 120 | div = max_div; |
119 | 121 | ||
120 | rate = parent_rate / div; | 122 | rate = parent_rate / div; |
121 | } | 123 | } |