From: Abel Vesa <abel.vesa@nxp.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-clk@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Adrian Alonso <adrian.alonso@nxp.com>,
Mads Bligaard Nielsen <bli@bang-olufsen.dk>
Subject: Re: [PATCH v2 5/8] clk: imx: pll14xx: name variables after usage
Date: Fri, 25 Feb 2022 15:25:31 +0200 [thread overview]
Message-ID: <YhjYy+cl35kMz/o6@abelvesa> (raw)
In-Reply-To: <20220225082937.2746176-6-s.hauer@pengutronix.de>
On 22-02-25 09:29:34, Sascha Hauer wrote:
> In clk_pll1443x_set_rate() 'tmp' is used for the content of different
> registers which makes it a bit hard to follow. Use different variables
> named after the registers to make it clearer. No functional change
> intended.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
> ---
> drivers/clk/imx/clk-pll14xx.c | 42 +++++++++++++++++------------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
> index ebd5d888fea6d..b464e1155e25b 100644
> --- a/drivers/clk/imx/clk-pll14xx.c
> +++ b/drivers/clk/imx/clk-pll14xx.c
> @@ -238,7 +238,7 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
> {
> struct clk_pll14xx *pll = to_clk_pll14xx(hw);
> const struct imx_pll14xx_rate_table *rate;
> - u32 tmp, div_val;
> + u32 gnrl_ctl, div_ctl0;
> int ret;
>
> rate = imx_get_pll_settings(pll, drate);
> @@ -248,32 +248,32 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
> return -EINVAL;
> }
>
> - tmp = readl_relaxed(pll->base + DIV_CTL0);
> + div_ctl0 = readl_relaxed(pll->base + DIV_CTL0);
>
> - if (!clk_pll14xx_mp_change(rate, tmp)) {
> - tmp &= ~SDIV_MASK;
> - tmp |= FIELD_PREP(SDIV_MASK, rate->sdiv);
> - writel_relaxed(tmp, pll->base + DIV_CTL0);
> + if (!clk_pll14xx_mp_change(rate, div_ctl0)) {
> + div_ctl0 &= ~SDIV_MASK;
> + div_ctl0 |= FIELD_PREP(SDIV_MASK, rate->sdiv);
> + writel_relaxed(div_ctl0, pll->base + DIV_CTL0);
>
> - tmp = FIELD_PREP(KDIV_MASK, rate->kdiv);
> - writel_relaxed(tmp, pll->base + DIV_CTL1);
> + writel_relaxed(FIELD_PREP(KDIV_MASK, rate->kdiv),
> + pll->base + DIV_CTL1);
>
> return 0;
> }
>
> /* Enable RST */
> - tmp = readl_relaxed(pll->base + GNRL_CTL);
> - tmp &= ~RST_MASK;
> - writel_relaxed(tmp, pll->base + GNRL_CTL);
> + gnrl_ctl = readl_relaxed(pll->base + GNRL_CTL);
> + gnrl_ctl &= ~RST_MASK;
> + writel_relaxed(gnrl_ctl, pll->base + GNRL_CTL);
>
> /* Enable BYPASS */
> - tmp |= BYPASS_MASK;
> - writel_relaxed(tmp, pll->base + GNRL_CTL);
> + gnrl_ctl |= BYPASS_MASK;
> + writel_relaxed(gnrl_ctl, pll->base + GNRL_CTL);
>
> - div_val = FIELD_PREP(MDIV_MASK, rate->mdiv) |
> - FIELD_PREP(PDIV_MASK, rate->pdiv) |
> - FIELD_PREP(SDIV_MASK, rate->sdiv);
> - writel_relaxed(div_val, pll->base + DIV_CTL0);
> + div_ctl0 = FIELD_PREP(MDIV_MASK, rate->mdiv) |
> + FIELD_PREP(PDIV_MASK, rate->pdiv) |
> + FIELD_PREP(SDIV_MASK, rate->sdiv);
> + writel_relaxed(div_ctl0, pll->base + DIV_CTL0);
> writel_relaxed(FIELD_PREP(KDIV_MASK, rate->kdiv), pll->base + DIV_CTL1);
>
> /*
> @@ -285,8 +285,8 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
> udelay(3);
>
> /* Disable RST */
> - tmp |= RST_MASK;
> - writel_relaxed(tmp, pll->base + GNRL_CTL);
> + gnrl_ctl |= RST_MASK;
> + writel_relaxed(gnrl_ctl, pll->base + GNRL_CTL);
>
> /* Wait Lock*/
> ret = clk_pll14xx_wait_lock(pll);
> @@ -294,8 +294,8 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
> return ret;
>
> /* Bypass */
> - tmp &= ~BYPASS_MASK;
> - writel_relaxed(tmp, pll->base + GNRL_CTL);
> + gnrl_ctl &= ~BYPASS_MASK;
> + writel_relaxed(gnrl_ctl, pll->base + GNRL_CTL);
>
> return 0;
> }
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-02-25 13:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 8:29 [PATCH v2 0/8] clk: i.MX: PLL14xx: Support dynamic rates Sascha Hauer
2022-02-25 8:29 ` [PATCH v2 1/8] clk: imx: pll14xx: Use register defines consistently Sascha Hauer
2022-02-25 8:29 ` [PATCH v2 2/8] clk: imx: pll14xx: Drop wrong shifting Sascha Hauer
2022-02-25 8:29 ` [PATCH v2 3/8] clk: imx: pll14xx: Use FIELD_GET/FIELD_PREP Sascha Hauer
2022-02-25 8:29 ` [PATCH v2 4/8] clk: imx: pll14xx: consolidate rate calculation Sascha Hauer
2022-02-25 13:24 ` Abel Vesa
2022-02-25 8:29 ` [PATCH v2 5/8] clk: imx: pll14xx: name variables after usage Sascha Hauer
2022-02-25 13:25 ` Abel Vesa [this message]
2022-02-25 8:29 ` [PATCH v2 6/8] clk: imx: pll14xx: explicitly return lowest rate Sascha Hauer
2022-02-25 13:26 ` Abel Vesa
2022-02-25 8:29 ` [PATCH v2 7/8] clk: imx: pll14xx: Add pr_fmt Sascha Hauer
2022-02-25 13:27 ` Abel Vesa
2022-02-25 8:29 ` [PATCH v2 8/8] clk: imx: pll14xx: Support dynamic rates Sascha Hauer
2022-02-25 14:13 ` Abel Vesa
2022-03-04 8:39 ` Abel Vesa
2022-03-04 12:44 ` 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=YhjYy+cl35kMz/o6@abelvesa \
--to=abel.vesa@nxp.com \
--cc=adrian.alonso@nxp.com \
--cc=bli@bang-olufsen.dk \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-clk@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=mturquette@baylibre.com \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@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