From: James Liao <jamesjj.liao@mediatek.com>
To: Matthias Brugger <matthias.bgg@gmail.com>,
Mike Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Heiko Stubner <heiko@sntech.de>
Cc: <srv_heupstream@mediatek.com>,
Daniel Kurtz <djkurtz@chromium.org>,
Ricky Liang <jcliang@chromium.org>,
Rob Herring <robh+dt@kernel.org>,
Sascha Hauer <kernel@pengutronix.de>,
<devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>,
James Liao <jamesjj.liao@mediatek.com>
Subject: [PATCH v3 2/3] clk: mediatek: Fix calculation of PLL rate settings
Date: Fri, 10 Jul 2015 16:39:33 +0800 [thread overview]
Message-ID: <1436517574-17895-3-git-send-email-jamesjj.liao@mediatek.com> (raw)
In-Reply-To: <1436517574-17895-1-git-send-email-jamesjj.liao@mediatek.com>
Avoid u32 overflow when calculate post divider setting, and
increase the max post divider setting from 3 (/8) to 4 (/16).
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
---
drivers/clk/mediatek/clk-pll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c
index 68af518..0e3f4ef 100644
--- a/drivers/clk/mediatek/clk-pll.c
+++ b/drivers/clk/mediatek/clk-pll.c
@@ -144,9 +144,9 @@ static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv,
if (freq > pll->data->fmax)
freq = pll->data->fmax;
- for (val = 0; val < 4; val++) {
+ for (val = 0; val < 5; val++) {
*postdiv = 1 << val;
- if (freq * *postdiv >= fmin)
+ if ((u64)freq * *postdiv >= fmin)
break;
}
--
1.8.1.1.dirty
next prev parent reply other threads:[~2015-07-10 8:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 8:39 [PATCH v3 0/3] Fixes for MT8173 PLLs James Liao
2015-07-10 8:39 ` [PATCH v3 1/3] clk: mediatek: Fix PLL registers setting flow James Liao
2015-07-18 0:47 ` Stephen Boyd
2015-07-10 8:39 ` James Liao [this message]
2015-07-18 0:47 ` [PATCH v3 2/3] clk: mediatek: Fix calculation of PLL rate settings Stephen Boyd
2015-07-10 8:39 ` [PATCH v3 3/3] clk: mediatek: Add MT8173 MMPLL change rate support James Liao
2015-07-18 0:47 ` Stephen Boyd
2015-07-13 5:45 ` [PATCH v3 0/3] Fixes for MT8173 PLLs Sascha Hauer
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=1436517574-17895-3-git-send-email-jamesjj.liao@mediatek.com \
--to=jamesjj.liao@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=djkurtz@chromium.org \
--cc=heiko@sntech.de \
--cc=jcliang@chromium.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
--cc=srv_heupstream@mediatek.com \
/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
all inboxes | Powered by JetHome®