From: Peng Fan <peng.fan@nxp.com>
To: Ying Liu <victor.liu@nxp.com>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Abel Vesa <abel.vesa@nxp.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH] clk: imx: clk-fracn-gppll: Return rate in rate table properly in ->recalc_rate()
Date: Mon, 30 May 2022 02:08:01 +0000 [thread overview]
Message-ID: <DU0PR04MB94172CDB8AE355ACB0AFF0CF88DD9@DU0PR04MB9417.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20220529071156.2511568-1-victor.liu@nxp.com>
> Subject: [PATCH] clk: imx: clk-fracn-gppll: Return rate in rate table properly in
> ->recalc_rate()
>
> The PLL parameters in rate table should be directly compared with those read
> from PLL registers instead of the cooked ones.
>
> Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll")
> Cc: Abel Vesa <abel.vesa@nxp.com>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/clk/imx/clk-fracn-gppll.c | 24 +++++++++++++-----------
> 1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c
> index 71c102d950ab..762b07dd5a6d 100644
> --- a/drivers/clk/imx/clk-fracn-gppll.c
> +++ b/drivers/clk/imx/clk-fracn-gppll.c
> @@ -131,18 +131,7 @@ static unsigned long
> clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lon
> mfi = FIELD_GET(PLL_MFI_MASK, pll_div);
>
> rdiv = FIELD_GET(PLL_RDIV_MASK, pll_div);
> - rdiv = rdiv + 1;
> odiv = FIELD_GET(PLL_ODIV_MASK, pll_div);
> - switch (odiv) {
> - case 0:
> - odiv = 2;
> - break;
> - case 1:
> - odiv = 3;
> - break;
> - default:
> - break;
> - }
>
> /*
> * Sometimes, the recalculated rate has deviation due to @@ -160,6
> +149,19 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw
> *hw, unsigned lon
> if (rate)
> return (unsigned long)rate;
>
> + rdiv = rdiv + 1;
> +
> + switch (odiv) {
> + case 0:
> + odiv = 2;
> + break;
> + case 1:
> + odiv = 3;
> + break;
> + default:
> + break;
> + }
> +
> /* Fvco = Fref * (MFI + MFN / MFD) */
> fvco = fvco * mfi * mfd + fvco * mfn;
> do_div(fvco, mfd * rdiv * odiv);
> --
> 2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-05-30 2:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-29 7:11 [PATCH] clk: imx: clk-fracn-gppll: Return rate in rate table properly in ->recalc_rate() Liu Ying
2022-05-30 2:08 ` Peng Fan [this message]
2022-05-30 9:08 ` Peng Fan
2022-05-31 1:45 ` Liu Ying
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=DU0PR04MB94172CDB8AE355ACB0AFF0CF88DD9@DU0PR04MB9417.eurprd04.prod.outlook.com \
--to=peng.fan@nxp.com \
--cc=abel.vesa@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
--cc=victor.liu@nxp.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;
as well as URLs for NNTP newsgroup(s).