linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Michael Turquette <mturquette@baylibre.com>,
	Paul Cercueil <paul@crapouillou.net>
Cc: list@opendingux.net, linux-mips@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	Paul Cercueil <paul@crapouillou.net>,
	stable@vger.kernel.org
Subject: Re: [PATCH] clk: ingenic: jz4760: Update M/N/OD calculation algorithm
Date: Wed, 25 Jan 2023 17:21:48 -0800	[thread overview]
Message-ID: <a6e30b47b574e3fea568931862bcc1a6.sboyd@kernel.org> (raw)
In-Reply-To: <20221214123704.7305-1-paul@crapouillou.net>

Quoting Paul Cercueil (2022-12-14 04:37:04)
> The previous algorithm was pretty broken.
> 
> - The inner loop had a '(m > m_max)' condition, and the value of 'm'
>   would increase in each iteration;
> 
> - Each iteration would actually multiply 'm' by two, so it is not needed
>   to re-compute the whole equation at each iteration;
> 
> - It would loop until (m & 1) == 0, which means it would loop at most
>   once.
> 
> - The outer loop would divide the 'n' value by two at the end of each
>   iteration. This meant that for a 12 MHz parent clock and a 1.2 GHz
>   requested clock, it would first try n=12, then n=6, then n=3, then
>   n=1, none of which would work; the only valid value is n=2 in this
>   case.
> 
> Simplify this algorithm with a single for loop, which decrements 'n'
> after each iteration, addressing all of the above problems.
> 
> Fixes: bdbfc029374f ("clk: ingenic: Add support for the JZ4760")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---

Applied to clk-fixes

      reply	other threads:[~2023-01-26  1:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 12:37 [PATCH] clk: ingenic: jz4760: Update M/N/OD calculation algorithm Paul Cercueil
2023-01-26  1:21 ` Stephen Boyd [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=a6e30b47b574e3fea568931862bcc1a6.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=list@opendingux.net \
    --cc=mturquette@baylibre.com \
    --cc=paul@crapouillou.net \
    --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).