linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: rockchip: Ignore frac divisor for PLL equivalence when it's unused
@ 2016-11-02 23:43 Julius Werner
  2016-11-05 22:25 ` Heiko Stuebner
  0 siblings, 1 reply; 2+ messages in thread
From: Julius Werner @ 2016-11-02 23:43 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: linux-rockchip, linux-kernel, Doug Anderson, Xing Zheng, Julius Werner

Rockchip RK3399 PLLs can be used in two separate modes: integral and
fractional. We can select between these two modes with the unambiguously
named DSMPD bit.

During boot, we check all PLL settings to confirm that they match our
PLL table for that frequency, and reinitialize the PLLs where they
don't. The settings checked for this include the fractional divider
field that is only used in fractional mode, even if we're in integral
mode (DSMPD = 1) and that field has no effect.

This patch changes the check to only compare the fractional divider if
we're actually in fractional mode. This way, we won't reinitialize the
PLL in cases where there's absolutely no reason for that, which may
avoid glitching child clocks that should better not be glitched (e.g.
PWM regulators).

Signed-off-by: Julius Werner <jwerner@chromium.org>
---
 drivers/clk/rockchip/clk-pll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
index 9c1373e..1449c76 100644
--- a/drivers/clk/rockchip/clk-pll.c
+++ b/drivers/clk/rockchip/clk-pll.c
@@ -795,7 +795,8 @@ static void rockchip_rk3399_pll_init(struct clk_hw *hw)
 
 	if (rate->fbdiv != cur.fbdiv || rate->postdiv1 != cur.postdiv1 ||
 		rate->refdiv != cur.refdiv || rate->postdiv2 != cur.postdiv2 ||
-		rate->dsmpd != cur.dsmpd || rate->frac != cur.frac) {
+		rate->dsmpd != cur.dsmpd ||
+		(!cur.dsmpd && (rate->frac != cur.frac))) {
 		struct clk *parent = clk_get_parent(hw->clk);
 
 		if (!parent) {
-- 
2.6.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: rockchip: Ignore frac divisor for PLL equivalence when it's unused
  2016-11-02 23:43 [PATCH] clk: rockchip: Ignore frac divisor for PLL equivalence when it's unused Julius Werner
@ 2016-11-05 22:25 ` Heiko Stuebner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stuebner @ 2016-11-05 22:25 UTC (permalink / raw)
  To: Julius Werner; +Cc: linux-rockchip, linux-kernel, Doug Anderson, Xing Zheng

Am Mittwoch, 2. November 2016, 16:43:24 CET schrieb Julius Werner:
> Rockchip RK3399 PLLs can be used in two separate modes: integral and
> fractional. We can select between these two modes with the unambiguously
> named DSMPD bit.
> 
> During boot, we check all PLL settings to confirm that they match our
> PLL table for that frequency, and reinitialize the PLLs where they
> don't. The settings checked for this include the fractional divider
> field that is only used in fractional mode, even if we're in integral
> mode (DSMPD = 1) and that field has no effect.
> 
> This patch changes the check to only compare the fractional divider if
> we're actually in fractional mode. This way, we won't reinitialize the
> PLL in cases where there's absolutely no reason for that, which may
> avoid glitching child clocks that should better not be glitched (e.g.
> PWM regulators).
> 
> Signed-off-by: Julius Werner <jwerner@chromium.org>

I took the liberty to clone the fix to the rk3036 pll type as well, which is
quite similar and only differs in the actual register layout.

As sugested by the above, I've applied this to my clk branch for 4.10 [0]


Thanks for fixing this
Heiko


[0] https://git.kernel.org/cgit/linux/kernel/git/mmind/linux-rockchip.git/commit/?id=bf92384b6d729b22916ba832b4a225ca196e98ba

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-05 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-02 23:43 [PATCH] clk: rockchip: Ignore frac divisor for PLL equivalence when it's unused Julius Werner
2016-11-05 22:25 ` Heiko Stuebner

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).