Skip to content

clk: nuvoton: ma35d1: fix PLL frequency calculation

Joey Lu linux-arm-kernel linux-clk lkml 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 0 repliesNew
  2. v43 patches 4 repliesSuperseded
  3. v33 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches3 repliesSuperseded
v11 patch2 repliesSuperseded

Changes in v5 from the cover letter

- 3/3: split CAPLL and DDRPLL back into separate case labels so

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3clk: nuvoton: ma35d1: fix ignored div_u64 return values in PLL freq calculationdrivers/clk/nuvoton/clk-ma35d1-pll.c+2 -20 replies
2/3clk: nuvoton: ma35d1: fix PLL_CTL1_FRAC bit field width and fractional calcdrivers/clk/nuvoton/clk-ma35d1-pll.c+4 -40 replies
3/3clk: nuvoton: ma35d1: fix ma35d1_clk_pll_determine_rate logicdrivers/clk/nuvoton/clk-ma35d1-pll.c+16 -150 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchBrian MasneyAlexandre Mergnat
1/3R-b R-b
2/3R-b R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/3] clk: nuvoton: ma35d1: fix PLL frequency calculation

Fix four bugs in the MA35D1 PLL clock driver that cause incorrect frequency values returned from recalc_rate() and determine_rate().

v1 combined all fixes into a single commit. At reviewer request, split into one patch per logical fix:

1/3 - fix div_u64 return value being discarded (affects both
ma35d1_calc_smic_pll_freq and ma35d1_calc_pll_freq INT mode)

2/3 - fix PLL_CTL1_FRAC mask width (8-bit -> 24-bit) and update
the fractional-mode arithmetic accordingly

3/3 - fix ma35d1_clk_pll_determine_rate: move find_closest() into
the configurable-PLL branch; split CAPLL and DDRPLL into separate case labels mirroring recalc_rate()

Changes in v5 (vs v4):
- 3/3: split CAPLL and DDRPLL back into separate case labels so

    that determine_rate() is structurally parallel with recalc_rate();
    add explicit default label; share single req->rate = pll_freq tail
    (readability suggestion by Alexandre Mergnat)

- 3/3: add Reviewed-by tag

Changes in v4 (vs v3):
- 2/3: add Reviewed-by tag

Changes in v3 (vs v2):
- 2/3: replace the manual round-to-nearest expression

    "(u32)(((u64)x * 1000 + 500) >> 24)" with the kernel helper
    DIV_ROUND_CLOSEST_ULL((u64)x * 1000, 1ULL << 24); the result
    is mathematically identical but more readable and idiomatic

Joey Lu (3):
clk: nuvoton: ma35d1: fix ignored div_u64 return values in PLL freq
calculation
clk: nuvoton: ma35d1: fix PLL_CTL1_FRAC bit field width and fractional
calc
clk: nuvoton: ma35d1: fix ma35d1_clk_pll_determine_rate logic

 drivers/clk/nuvoton/clk-ma35d1-pll.c | 43 ++++++++++++++--------------
 1 file changed, 22 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0