From: 21cnbao@gmail.com (Barry Song)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/7] clk: atlas7: replace dto resolution magic number by macro
Date: Tue, 28 Jul 2015 06:27:22 +0000 [thread overview]
Message-ID: <1438064845-17894-5-git-send-email-21cnbao@gmail.com> (raw)
In-Reply-To: <1438064845-17894-1-git-send-email-21cnbao@gmail.com>
From: Yibo Cai <yibo.cai@csr.com>
Signed-off-by: Yibo Cai <yibo.cai@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
drivers/clk/sirf/clk-atlas7.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/sirf/clk-atlas7.c b/drivers/clk/sirf/clk-atlas7.c
index cf489a5..1000421 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 = {
* double resolution mode:fout = fin * finc / 2^29
* 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)
{
struct clk_dto *clk = to_dtoclk(hw);
@@ -509,9 +512,9 @@ static unsigned long dto_clk_recalc_rate(struct clk_hw *hw,
rate *= finc;
if (droff & BIT(0))
/* Double resolution off */
- do_div(rate, 1 << 28);
+ do_div(rate, DTO_RESL_NORMAL);
else
- do_div(rate, 1 << 29);
+ do_div(rate, DTO_RESL_DOUBLE);
return rate;
}
@@ -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,
unsigned long *parent_rate)
{
- u64 dividend = (u64)rate * (1 << 29);
+ u64 dividend = rate * DTO_RESL_DOUBLE;
do_div(dividend, *parent_rate);
dividend *= *parent_rate;
- do_div(dividend, 1 << 29);
+ do_div(dividend, DTO_RESL_DOUBLE);
return dividend;
}
@@ -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,
unsigned long parent_rate)
{
- u64 dividend = (u64)rate * (1 << 29);
+ u64 dividend = rate * DTO_RESL_DOUBLE;
struct clk_dto *clk = to_dtoclk(hw);
do_div(dividend, parent_rate);
--
1.9.1
next prev parent reply other threads:[~2015-07-28 6:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 6:27 [PATCH 0/7] clk: atlas7: a bind of fixes Barry Song
2015-07-28 6:27 ` [PATCH 1/7] clk: atlas7: add lost pwm unit clks Barry Song
2015-07-28 6:27 ` [PATCH 2/7] clk: atlas7: export mux clks so that driver can use it Barry Song
2015-07-28 21:56 ` Stephen Boyd
2015-07-29 12:24 ` Barry Song
2015-07-28 6:27 ` [PATCH 3/7] clk: sirf: fix integer overflow in dto rate calculation Barry Song
2015-07-28 6:27 ` Barry Song [this message]
2015-07-28 6:27 ` [PATCH 5/7] clk: atlas7: fix the clock tree for bluetooth stuff Barry Song
2015-07-28 22:07 ` Stephen Boyd
2015-07-29 14:52 ` Barry Song
2015-08-06 1:44 ` Stephen Boyd
2015-08-06 9:53 ` Barry Song
2015-08-10 2:35 ` Barry Song
2015-08-12 0:02 ` Stephen Boyd
2015-08-12 2:39 ` Barry Song
2015-07-28 6:27 ` [PATCH 6/7] clk: sirf: fix bit field and its root clk for coresight_tpiu Barry Song
2015-07-28 6:27 ` [PATCH 7/7] clk: atlas7: fix pll missed divide NR in fraction mode Barry Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1438064845-17894-5-git-send-email-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).