diff options
author | Yibo Cai <yibo.cai@csr.com> | 2015-08-04 10:45:29 -0400 |
---|---|---|
committer | Michael Turquette <mturquette@baylibre.com> | 2015-08-24 19:49:06 -0400 |
commit | d1ccbddd090b74b8027727cb543b9c23d7f0f23e (patch) | |
tree | 15d05c56ebd6e85d6382c63659165445a19eedc8 | |
parent | 6132e89aef51df044246b5aef822144217794ae1 (diff) |
clk: atlas7: replace dto resolution magic number by macro
Signed-off-by: Yibo Cai <yibo.cai@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r-- | drivers/clk/sirf/clk-atlas7.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/clk/sirf/clk-atlas7.c b/drivers/clk/sirf/clk-atlas7.c index ed77fd51692c..3d4217f38419 100644 --- a/drivers/clk/sirf/clk-atlas7.c +++ b/drivers/clk/sirf/clk-atlas7.c | |||
@@ -465,6 +465,9 @@ static struct clk_pll clk_sys3pll = { | |||
465 | * double resolution mode:fout = fin * finc / 2^29 | 465 | * double resolution mode:fout = fin * finc / 2^29 |
466 | * normal mode:fout = fin * finc / 2^28 | 466 | * normal mode:fout = fin * finc / 2^28 |
467 | */ | 467 | */ |
468 | #define DTO_RESL_DOUBLE (1ULL << 29) | ||
469 | #define DTO_RESL_NORMAL (1ULL << 28) | ||
470 | |||
468 | static int dto_clk_is_enabled(struct clk_hw *hw) | 471 | static int dto_clk_is_enabled(struct clk_hw *hw) |
469 | { | 472 | { |
470 | struct clk_dto *clk = to_dtoclk(hw); | 473 | struct clk_dto *clk = to_dtoclk(hw); |
@@ -509,9 +512,9 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw, | |||
509 | rate *= finc; | 512 | rate *= finc; |
510 | if (droff & BIT(0)) | 513 | if (droff & BIT(0)) |
511 | /* Double resolution off */ | 514 | /* Double resolution off */ |
512 | do_div(rate, 1 << 28); | 515 | do_div(rate, DTO_RESL_NORMAL); |
513 | else | 516 | else |
514 | do_div(rate, 1 << 29); | 517 | do_div(rate, DTO_RESL_DOUBLE); |
515 | 518 | ||
516 | return rate; | 519 | return rate; |
517 | } | 520 | } |
@@ -519,11 +522,11 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw, | |||
519 | static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate, | 522 | static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate, |
520 | unsigned long *parent_rate) | 523 | unsigned long *parent_rate) |
521 | { | 524 | { |
522 | u64 dividend = (u64)rate * (1 << 29); | 525 | u64 dividend = rate * DTO_RESL_DOUBLE; |
523 | 526 | ||
524 | do_div(dividend, *parent_rate); | 527 | do_div(dividend, *parent_rate); |
525 | dividend *= *parent_rate; | 528 | dividend *= *parent_rate; |
526 | do_div(dividend, 1 << 29); | 529 | do_div(dividend, DTO_RESL_DOUBLE); |
527 | 530 | ||
528 | return dividend; | 531 | return dividend; |
529 | } | 532 | } |
@@ -531,7 +534,7 @@ static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate, | |||
531 | static int dto_clk_set_rate(struct clk_hw *hw, unsigned long rate, | 534 | static int dto_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
532 | unsigned long parent_rate) | 535 | unsigned long parent_rate) |
533 | { | 536 | { |
534 | u64 dividend = (u64)rate * (1 << 29); | 537 | u64 dividend = rate * DTO_RESL_DOUBLE; |
535 | struct clk_dto *clk = to_dtoclk(hw); | 538 | struct clk_dto *clk = to_dtoclk(hw); |
536 | 539 | ||
537 | do_div(dividend, parent_rate); | 540 | do_div(dividend, parent_rate); |