clk: renesas: rcar-gen3: Increase Z clock accuracy
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 26 Mar 2021 12:00:58 +0000 (13:00 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 11 May 2021 07:57:06 +0000 (09:57 +0200)
commit50086045bd07a9bc55c113f2b19a8f3746c9f9b0
treeaab69c05c1394a1adefd7884bfbb1ba06ead189d
parent67a1b9b65165bd3204adef13f0d557b5705116b4
clk: renesas: rcar-gen3: Increase Z clock accuracy

Improve accuracy in the .determine_rate() callback for Z and Z2 clocks
by using rounded divisions.  This is similar to the calculation of rates
and multipliers in the .recalc_rate() resp. set_rate() callbacks.

Sample impact for a few requested clock rates:
  - R-Car H3:
      - Z 500 MHz: 468 MHz => 515 MHz
      - Z2 1000 MHz: 973 MHz => 1011 MHz
  - R-Car M3-W:
      - Z 500 MHz: 422 MHz => 516 MHz
      - Z2 800 MHz: 750 MHz => 788 MHz

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20210326120100.1577596-6-geert+renesas@glider.be
drivers/clk/renesas/rcar-gen3-cpg.c