diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2015-08-28 07:49:35 -0400 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-09-22 12:53:51 -0400 |
commit | 9e294bf88a583825a413df408b9fe9e658fb93ac (patch) | |
tree | 5611f92b4992251c8ab615a4fa3e935dfae8b18a | |
parent | d34e210ed3a28050441f15228fd5ed929028d9cd (diff) |
clk: samsung: fix cpu clock's flags checking
CLK_CPU_HAS_DIV1 and CLK_CPU_NEEDS_DEBUG_ALT_DIV masks were
incorrectly used as a bit numbers. Fix it.
Tested on Exynos4210 based Origen board and on Exynos5250 based
Arndale board.
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Fixes: ddeac8d96 ("clk: samsung: add infrastructure to register cpu clocks")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r-- | drivers/clk/samsung/clk-cpu.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 7c1e1f58e2da..2fe37f708dc7 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c | |||
@@ -164,7 +164,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, | |||
164 | * the values for DIV_COPY and DIV_HPM dividers need not be set. | 164 | * the values for DIV_COPY and DIV_HPM dividers need not be set. |
165 | */ | 165 | */ |
166 | div0 = cfg_data->div0; | 166 | div0 = cfg_data->div0; |
167 | if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { | 167 | if (cpuclk->flags & CLK_CPU_HAS_DIV1) { |
168 | div1 = cfg_data->div1; | 168 | div1 = cfg_data->div1; |
169 | if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK) | 169 | if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK) |
170 | div1 = readl(base + E4210_DIV_CPU1) & | 170 | div1 = readl(base + E4210_DIV_CPU1) & |
@@ -185,7 +185,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, | |||
185 | alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1; | 185 | alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1; |
186 | WARN_ON(alt_div >= MAX_DIV); | 186 | WARN_ON(alt_div >= MAX_DIV); |
187 | 187 | ||
188 | if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { | 188 | if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) { |
189 | /* | 189 | /* |
190 | * In Exynos4210, ATB clock parent is also mout_core. So | 190 | * In Exynos4210, ATB clock parent is also mout_core. So |
191 | * ATB clock also needs to be mantained at safe speed. | 191 | * ATB clock also needs to be mantained at safe speed. |
@@ -206,7 +206,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, | |||
206 | writel(div0, base + E4210_DIV_CPU0); | 206 | writel(div0, base + E4210_DIV_CPU0); |
207 | wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL); | 207 | wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL); |
208 | 208 | ||
209 | if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { | 209 | if (cpuclk->flags & CLK_CPU_HAS_DIV1) { |
210 | writel(div1, base + E4210_DIV_CPU1); | 210 | writel(div1, base + E4210_DIV_CPU1); |
211 | wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, | 211 | wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, |
212 | DIV_MASK_ALL); | 212 | DIV_MASK_ALL); |
@@ -225,7 +225,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata, | |||
225 | unsigned long mux_reg; | 225 | unsigned long mux_reg; |
226 | 226 | ||
227 | /* find out the divider values to use for clock data */ | 227 | /* find out the divider values to use for clock data */ |
228 | if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { | 228 | if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) { |
229 | while ((cfg_data->prate * 1000) != ndata->new_rate) { | 229 | while ((cfg_data->prate * 1000) != ndata->new_rate) { |
230 | if (cfg_data->prate == 0) | 230 | if (cfg_data->prate == 0) |
231 | return -EINVAL; | 231 | return -EINVAL; |
@@ -240,7 +240,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata, | |||
240 | writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU); | 240 | writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU); |
241 | wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1); | 241 | wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1); |
242 | 242 | ||
243 | if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { | 243 | if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) { |
244 | div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK); | 244 | div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK); |
245 | div_mask |= E4210_DIV0_ATB_MASK; | 245 | div_mask |= E4210_DIV0_ATB_MASK; |
246 | } | 246 | } |