From: Michael Turquette <mturquette@baylibre.com>
To: Ray Jui <rjui@broadcom.com>, "Stephen Boyd" <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
"Simran Rai" <ssimran@broadcom.com>,
"Ray Jui" <rjui@broadcom.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] clk: iproc: Fix PLL output frequency calculation
Date: Wed, 21 Oct 2015 02:41:54 -0700 [thread overview]
Message-ID: <20151021094154.20687.68970@quantum> (raw)
In-Reply-To: <1445293639-5863-2-git-send-email-rjui@broadcom.com>
Quoting Ray Jui (2015-10-19 15:27:19)
> From: Simran Rai <ssimran@broadcom.com>
> =
> This patch affects the clocks that use fractional ndivider in their
> PLL output frequency calculation. Instead of 2^20 divide factor, the
> clock's ndiv integer shift was used. Fixed the bug by replacing ndiv
> integer shift with 2^20 factor.
> =
> Signed-off-by: Simran Rai <ssimran@broadcom.com>
> Signed-off-by: Ray Jui <rjui@broadcom.com>
> Reviewed-by: Scott Branden <sbranden@broadcom.com>
> Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support")
Applied to clk-next.
Regards,
Mike
> ---
> drivers/clk/bcm/clk-iproc-pll.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
> =
> diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-=
pll.c
> index 2dda4e8..d679ab8 100644
> --- a/drivers/clk/bcm/clk-iproc-pll.c
> +++ b/drivers/clk/bcm/clk-iproc-pll.c
> @@ -345,8 +345,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk=
_hw *hw,
> struct iproc_pll *pll =3D clk->pll;
> const struct iproc_pll_ctrl *ctrl =3D pll->ctrl;
> u32 val;
> - u64 ndiv;
> - unsigned int ndiv_int, ndiv_frac, pdiv;
> + u64 ndiv, ndiv_int, ndiv_frac;
> + unsigned int pdiv;
> =
> if (parent_rate =3D=3D 0)
> return 0;
> @@ -366,22 +366,19 @@ static unsigned long iproc_pll_recalc_rate(struct c=
lk_hw *hw,
> val =3D readl(pll->pll_base + ctrl->ndiv_int.offset);
> ndiv_int =3D (val >> ctrl->ndiv_int.shift) &
> bit_mask(ctrl->ndiv_int.width);
> - ndiv =3D (u64)ndiv_int << ctrl->ndiv_int.shift;
> + ndiv =3D ndiv_int << 20;
> =
> if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) {
> val =3D readl(pll->pll_base + ctrl->ndiv_frac.offset);
> ndiv_frac =3D (val >> ctrl->ndiv_frac.shift) &
> bit_mask(ctrl->ndiv_frac.width);
> -
> - if (ndiv_frac !=3D 0)
> - ndiv =3D ((u64)ndiv_int << ctrl->ndiv_int.shift) |
> - ndiv_frac;
> + ndiv +=3D ndiv_frac;
> }
> =
> val =3D readl(pll->pll_base + ctrl->pdiv.offset);
> pdiv =3D (val >> ctrl->pdiv.shift) & bit_mask(ctrl->pdiv.width);
> =
> - clk->rate =3D (ndiv * parent_rate) >> ctrl->ndiv_int.shift;
> + clk->rate =3D (ndiv * parent_rate) >> 20;
> =
> if (pdiv =3D=3D 0)
> clk->rate *=3D 2;
> -- =
> 1.9.1
>=20
prev parent reply other threads:[~2015-10-21 9:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 22:27 [PATCH v2] Fix iProc PLL output clock frequency calculation Ray Jui
2015-10-19 22:27 ` [PATCH v2] clk: iproc: Fix PLL output " Ray Jui
2015-10-21 9:41 ` Michael Turquette [this message]
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=20151021094154.20687.68970@quantum \
--to=mturquette@baylibre.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjui@broadcom.com \
--cc=sboyd@codeaurora.org \
--cc=ssimran@broadcom.com \
--cc=stable@vger.kernel.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).