Commit d1ccbddd authored by Yibo Cai's avatar Yibo Cai Committed by Michael Turquette

clk: atlas7: replace dto resolution magic number by macro

Signed-off-by: default avatarYibo Cai <yibo.cai@csr.com>
Signed-off-by: default avatarBarry Song <Baohua.Song@csr.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 6132e89a
...@@ -465,6 +465,9 @@ static struct clk_pll clk_sys3pll = { ...@@ -465,6 +465,9 @@ static struct clk_pll clk_sys3pll = {
* double resolution mode:fout = fin * finc / 2^29 * double resolution mode:fout = fin * finc / 2^29
* normal mode:fout = fin * finc / 2^28 * normal mode:fout = fin * finc / 2^28
*/ */
#define DTO_RESL_DOUBLE (1ULL << 29)
#define DTO_RESL_NORMAL (1ULL << 28)
static int dto_clk_is_enabled(struct clk_hw *hw) static int dto_clk_is_enabled(struct clk_hw *hw)
{ {
struct clk_dto *clk = to_dtoclk(hw); struct clk_dto *clk = to_dtoclk(hw);
...@@ -509,9 +512,9 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw, ...@@ -509,9 +512,9 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw,
rate *= finc; rate *= finc;
if (droff & BIT(0)) if (droff & BIT(0))
/* Double resolution off */ /* Double resolution off */
do_div(rate, 1 << 28); do_div(rate, DTO_RESL_NORMAL);
else else
do_div(rate, 1 << 29); do_div(rate, DTO_RESL_DOUBLE);
return rate; return rate;
} }
...@@ -519,11 +522,11 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw, ...@@ -519,11 +522,11 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw,
static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate, static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate) unsigned long *parent_rate)
{ {
u64 dividend = (u64)rate * (1 << 29); u64 dividend = rate * DTO_RESL_DOUBLE;
do_div(dividend, *parent_rate); do_div(dividend, *parent_rate);
dividend *= *parent_rate; dividend *= *parent_rate;
do_div(dividend, 1 << 29); do_div(dividend, DTO_RESL_DOUBLE);
return dividend; return dividend;
} }
...@@ -531,7 +534,7 @@ static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate, ...@@ -531,7 +534,7 @@ static long dto_clk_round_rate(struct clk_hw *hw, unsigned long rate,
static int dto_clk_set_rate(struct clk_hw *hw, unsigned long rate, static int dto_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) unsigned long parent_rate)
{ {
u64 dividend = (u64)rate * (1 << 29); u64 dividend = rate * DTO_RESL_DOUBLE;
struct clk_dto *clk = to_dtoclk(hw); struct clk_dto *clk = to_dtoclk(hw);
do_div(dividend, parent_rate); do_div(dividend, parent_rate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment