mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <eagle.alexander923@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [PATCH 0/4] clk: rockchip: Fix RK3588/RK3576 fractional PLL handling
Date: Fri,  4 Dec 2026 15:34:54 +0300	[thread overview]
Message-ID: <20261204123458.3787582-1-eagle.alexander923@gmail.com> (raw)

The fractional PLL support for the RK3588 and RK3576 PLLs was ported from
Linux but three defects were carried over with it, and a fourth PLL type
was half-wired.

First, the fractional denominator was off by one. The PLL register field
holds values in the range 1..65535 while the reference implementation
divides by 65536, so every fractional rate was computed with a slightly
too small denominator.

Second, the fractional coefficient k is a signed 16-bit value in two's
complement. Barebox declared it unsigned, which made negative coefficients
impossible to express, so rates needing a negative correction were
recalculated with the wrong sign.

Third, the two RK3588/RK3576 fractional rate table entries that need a
negative coefficient were written as if the field were unsigned. They are
converted to the two's complement representation now that the type allows
it.

Finally, the RK3576 PPLL is registered with a PLL type that runs at twice
the configured rate. The type and its ops existed, but recalc_rate did not
apply the factor of two, so PPLL consumers saw half of the real clock.

None of the current boards enable fractional PLL rates, and RK3576 PPLL
consumers are not enabled in barebox either, so this is a correctness fix
without an observable regression risk today. It matters for DisplayPort
output (fractional rates) and for PCIe/MPHY reference dividers on RK3576
once those are enabled.

Ported from the corresponding Linux commits, listed in each patch.

Alexander Shiyan (4):
  clk: rockchip: Fix the fractional part denominator on RK3588/RK3576
    PLLs
  clk: rockchip: Treat fractional PLL coefficient as two's complement
  clk: rockchip: Use two's complement coefficients in RK3588/RK3576 PLL
    tables
  clk: rockchip: Return twice the configured rate for pll_rk3588_ddr

 drivers/clk/rockchip/clk-pll.c    | 19 ++++++++++++++-----
 drivers/clk/rockchip/clk-rk3576.c |  4 ++--
 drivers/clk/rockchip/clk-rk3588.c |  4 ++--
 drivers/clk/rockchip/clk.h        |  8 ++++----
 4 files changed, 22 insertions(+), 13 deletions(-)

-- 
2.56.1




             reply	other threads:[~2026-12-04 12:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 12:34 Alexander Shiyan [this message]
2026-12-04 12:34 ` [PATCH 1/4] clk: rockchip: Fix the fractional part denominator on RK3588/RK3576 PLLs Alexander Shiyan
2026-12-04 12:34 ` [PATCH 2/4] clk: rockchip: Treat fractional PLL coefficient as two's complement Alexander Shiyan
2026-12-04 12:34 ` [PATCH 3/4] clk: rockchip: Use two's complement coefficients in RK3588/RK3576 PLL tables Alexander Shiyan
2026-12-04 12:34 ` [PATCH 4/4] clk: rockchip: Return twice the configured rate for pll_rk3588_ddr Alexander Shiyan

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=20261204123458.3787582-1-eagle.alexander923@gmail.com \
    --to=eagle.alexander923@gmail.com \
    --cc=barebox@lists.infradead.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