diff options
Diffstat (limited to 'arch/arm/mach-mxs/clock-mx23.c')
-rw-r--r-- | arch/arm/mach-mxs/clock-mx23.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c index e12e11231dc7..293958beb505 100644 --- a/arch/arm/mach-mxs/clock-mx23.c +++ b/arch/arm/mach-mxs/clock-mx23.c | |||
@@ -223,7 +223,6 @@ static int cpu_clk_set_rate(struct clk *clk, unsigned long rate) | |||
223 | { | 223 | { |
224 | u32 reg, bm_busy, div_max, d, f, div, frac; | 224 | u32 reg, bm_busy, div_max, d, f, div, frac; |
225 | unsigned long diff, parent_rate, calc_rate; | 225 | unsigned long diff, parent_rate, calc_rate; |
226 | int i; | ||
227 | 226 | ||
228 | parent_rate = clk_get_rate(clk->parent); | 227 | parent_rate = clk_get_rate(clk->parent); |
229 | 228 | ||
@@ -275,14 +274,7 @@ static int cpu_clk_set_rate(struct clk *clk, unsigned long rate) | |||
275 | reg |= div << BP_CLKCTRL_CPU_DIV_CPU; | 274 | reg |= div << BP_CLKCTRL_CPU_DIV_CPU; |
276 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU); | 275 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU); |
277 | 276 | ||
278 | for (i = 10000; i; i--) | 277 | mxs_clkctrl_timeout(HW_CLKCTRL_CPU, bm_busy); |
279 | if (!(__raw_readl(CLKCTRL_BASE_ADDR + | ||
280 | HW_CLKCTRL_CPU) & bm_busy)) | ||
281 | break; | ||
282 | if (!i) { | ||
283 | pr_err("%s: divider writing timeout\n", __func__); | ||
284 | return -ETIMEDOUT; | ||
285 | } | ||
286 | 278 | ||
287 | return 0; | 279 | return 0; |
288 | } | 280 | } |
@@ -292,7 +284,6 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
292 | { \ | 284 | { \ |
293 | u32 reg, div_max, div; \ | 285 | u32 reg, div_max, div; \ |
294 | unsigned long parent_rate; \ | 286 | unsigned long parent_rate; \ |
295 | int i; \ | ||
296 | \ | 287 | \ |
297 | parent_rate = clk_get_rate(clk->parent); \ | 288 | parent_rate = clk_get_rate(clk->parent); \ |
298 | div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ | 289 | div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ |
@@ -310,15 +301,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
310 | } \ | 301 | } \ |
311 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ | 302 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ |
312 | \ | 303 | \ |
313 | for (i = 10000; i; i--) \ | 304 | mxs_clkctrl_timeout(HW_CLKCTRL_##dr, BM_CLKCTRL_##dr##_BUSY); \ |
314 | if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ | ||
315 | HW_CLKCTRL_##dr) & BM_CLKCTRL_##dr##_BUSY)) \ | ||
316 | break; \ | ||
317 | if (!i) { \ | ||
318 | pr_err("%s: divider writing timeout\n", __func__); \ | ||
319 | return -ETIMEDOUT; \ | ||
320 | } \ | ||
321 | \ | ||
322 | return 0; \ | 305 | return 0; \ |
323 | } | 306 | } |
324 | 307 | ||
@@ -461,7 +444,7 @@ static struct clk_lookup lookups[] = { | |||
461 | static int clk_misc_init(void) | 444 | static int clk_misc_init(void) |
462 | { | 445 | { |
463 | u32 reg; | 446 | u32 reg; |
464 | int i; | 447 | int ret; |
465 | 448 | ||
466 | /* Fix up parent per register setting */ | 449 | /* Fix up parent per register setting */ |
467 | reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ); | 450 | reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ); |
@@ -510,14 +493,7 @@ static int clk_misc_init(void) | |||
510 | reg |= 3 << BP_CLKCTRL_HBUS_DIV; | 493 | reg |= 3 << BP_CLKCTRL_HBUS_DIV; |
511 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS); | 494 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS); |
512 | 495 | ||
513 | for (i = 10000; i; i--) | 496 | ret = mxs_clkctrl_timeout(HW_CLKCTRL_HBUS, BM_CLKCTRL_HBUS_BUSY); |
514 | if (!(__raw_readl(CLKCTRL_BASE_ADDR + | ||
515 | HW_CLKCTRL_HBUS) & BM_CLKCTRL_HBUS_BUSY)) | ||
516 | break; | ||
517 | if (!i) { | ||
518 | pr_err("%s: divider writing timeout\n", __func__); | ||
519 | return -ETIMEDOUT; | ||
520 | } | ||
521 | 497 | ||
522 | /* Gate off cpu clock in WFI for power saving */ | 498 | /* Gate off cpu clock in WFI for power saving */ |
523 | __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT, | 499 | __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT, |
@@ -532,7 +508,7 @@ static int clk_misc_init(void) | |||
532 | reg |= 30 << BP_CLKCTRL_FRAC_IOFRAC; | 508 | reg |= 30 << BP_CLKCTRL_FRAC_IOFRAC; |
533 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC); | 509 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC); |
534 | 510 | ||
535 | return 0; | 511 | return ret; |
536 | } | 512 | } |
537 | 513 | ||
538 | int __init mx23_clocks_init(void) | 514 | int __init mx23_clocks_init(void) |