public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Abel Vesa <abelvesa@kernel.org>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	linux-clk <linux-clk@vger.kernel.org>,
	NXP Linux Team <linux-imx@nxp.com>
Subject: Re: bounds of pdiv in clk-pll14xx.c
Date: Wed, 2 Aug 2023 08:46:39 +0200	[thread overview]
Message-ID: <20230802064639.GK15436@pengutronix.de> (raw)
In-Reply-To: <ca6b0f0b-3f0d-8e4d-c857-8c6515250782@prevas.dk>

On Wed, Jun 21, 2023 at 01:24:12PM +0200, Rasmus Villemoes wrote:
> I'm a bit confused by the range of pdiv used in
> imx_pll14xx_calc_settings(), introduced in commit b09c68dc57c9 (clk:
> imx: pll14xx: Support dynamic rates).
> 
> We have this comment
> 
>         /*
>          * 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
> 
> and those values match what I can find in the reference manuals for the
> imx8mm, imx8mn and imx8mp SOCs. But the code then only loops over 1 <= p
> <= 7. I also don't really understand what the parenthesis
> 
>    (1 <= p <= 4 prate = 24MHz)
> 
> is supposed to mean. Is p restricted to <= 4 when the parent rate is
> 24MHz? That doesn't seem to make any sense, and in any case the loop
> does go up to p==7.

The original patch from Adrian that my patch is based on indeed had 1 <=
p <= 4. I did some digging but I haven't found the reason why this was
changed to 1 <= p <= 7 in the patch I upstreamed. I can imagine that at
some point we realized that we also got suboptimal rates and therefore
changed it, but I don't know.

> 
> It also seems that the built-in entries for 393216000 and 361267200 are
> suboptimal. Using m=655, p=5, s=3, k=23593 would give 393216000 exactly,
> and that set would be found by the loop if it wasn't being preceded by
> the table lookup.

I gave the table precedence in case it contains qualified known good
values. If these values turn out to be not so good after all then I
suggest that we remove them.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

      parent reply	other threads:[~2023-08-02  6:46 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
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 [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=20230802064639.GK15436@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=abelvesa@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=rasmus.villemoes@prevas.dk \
    /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