All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abel Vesa <abel.vesa@linaro.org>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: aford173@gmail.com, adrian.alonso@nxp.com,
	rasmus.villemoes@prevas.dk, bli@bang-olufsen.dk,
	linux-imx@nxp.com, linux-clk@vger.kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	abelvesa@kernel.org
Subject: Re: [PATCH] clk: imx: pll14xx: align pdiv with reference manual
Date: Tue, 25 Jul 2023 10:38:17 +0300	[thread overview]
Message-ID: <ZL976QadmcinquUk@linaro.org> (raw)
In-Reply-To: <20230714134938.2124861-1-m.felsch@pengutronix.de>

On 23-07-14 15:49:38, Marco Felsch wrote:
> The PLL14xx hardware can be found on i.MX8M{M,N,P} SoCs and always come
> with a 6-bit pre-divider. Neither the reference manuals nor the
> datasheets of these SoCs do mention any restrictions. Furthermore the
> current code doesn't respect the restrictions from the comment too.
> 
> Therefore drop the restriction and align the max pre-divider (pdiv)
> value to 63 to get more accurate frequencies.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

I'm OK with this:

Reviewed-by: Abel Vesa <abel.vesa@linaro.org>

> ---
> Hi Adam,
> 
> here is the patch I made for setting the exact video-pll settings.
> 
> Regards,
>   Marco
> 
> 
>  drivers/clk/imx/clk-pll14xx.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
> index 7150c59bbfc95..dc6bc21dff41f 100644
> --- a/drivers/clk/imx/clk-pll14xx.c
> +++ b/drivers/clk/imx/clk-pll14xx.c
> @@ -139,11 +139,10 @@ static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rat
>  	/*
>  	 * Fractional PLL constrains:
>  	 *
> -	 * a) 6MHz <= prate <= 25MHz
> -	 * b) 1 <= p <= 63 (1 <= p <= 4 prate = 24MHz)
> -	 * c) 64 <= m <= 1023
> -	 * d) 0 <= s <= 6
> -	 * e) -32768 <= k <= 32767
> +	 * a) 1 <= p <= 63
> +	 * b) 64 <= m <= 1023
> +	 * c) 0 <= s <= 6
> +	 * d) -32768 <= k <= 32767
>  	 *
>  	 * fvco = (m * 65536 + k) * prate / (p * 65536)
>  	 */
> @@ -186,7 +185,7 @@ static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rat
>  	}
>  
>  	/* Finally calculate best values */
> -	for (pdiv = 1; pdiv <= 7; pdiv++) {
> +	for (pdiv = 1; pdiv <= 63; pdiv++) {
>  		for (sdiv = 0; sdiv <= 6; sdiv++) {
>  			/* calc mdiv = round(rate * pdiv * 2^sdiv) / prate) */
>  			mdiv = DIV_ROUND_CLOSEST(rate * (pdiv << sdiv), prate);
> -- 
> 2.39.2
> 

  reply	other threads:[~2023-07-25  7:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 11:24 bounds of pdiv in clk-pll14xx.c Rasmus Villemoes
2023-07-13 17:54 ` Marco Felsch
2023-07-13 21:59   ` [EXT] " Adrian Alonso
2023-07-14  7:09     ` Marco Felsch
2023-07-14 13:39       ` Adam Ford
2023-07-14 13:49         ` [PATCH] clk: imx: pll14xx: align pdiv with reference manual Marco Felsch
2023-07-25  7:38           ` Abel Vesa [this message]
2023-07-25 19:59             ` Adam Ford
2023-08-06 13:55           ` Adam Ford
2023-08-07  7:45             ` Marco Felsch
2023-07-20 13:07     ` [EXT] Re: bounds of pdiv in clk-pll14xx.c Ahmad Fatoum
2023-08-02  6:46 ` 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=ZL976QadmcinquUk@linaro.org \
    --to=abel.vesa@linaro.org \
    --cc=abelvesa@kernel.org \
    --cc=adrian.alonso@nxp.com \
    --cc=aford173@gmail.com \
    --cc=bli@bang-olufsen.dk \
    --cc=kernel@pengutronix.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=m.felsch@pengutronix.de \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=s.hauer@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.