All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: bcm2835: Correct the prediv logic
@ 2017-05-15 17:35 ` Eric Anholt
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2017-05-15 17:35 UTC (permalink / raw)
  To: Lee Jones, Florian Fainelli, Michael Turquette, Stephen Boyd
  Cc: linux-rpi-kernel, linux-arm-kernel, linux-kernel, Stefan Wahren,
	bcm-kernel-feedback-list, linux-clk, Phil Elwell, Eric Anholt

From: Phil Elwell <phil@raspberrypi.org>

If a clock has the prediv flag set, both the integer and fractional
parts must be scaled when calculating the resulting frequency.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
---

While this is a bugfix, I haven't put a "Fixes:" line in here to get
it automatically backported to stable.  We had trouble with the
out-of-tree DSI panel driver, at least: Our old set_rate() didn't
work, because the new PLL was just barely too fast to get the integer
PLL divider we needed.  We may run into similar troubles
elsewhere. --anholt

 drivers/clk/bcm/clk-bcm2835.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 025853870619..7a35df6b45bd 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -616,8 +616,10 @@ static unsigned long bcm2835_pll_get_rate(struct clk_hw *hw,
 	using_prediv = cprman_read(cprman, data->ana_reg_base + 4) &
 		data->ana->fb_prediv_mask;
 
-	if (using_prediv)
+	if (using_prediv) {
 		ndiv *= 2;
+		fdiv *= 2;
+	}
 
 	return bcm2835_pll_rate_from_divisors(parent_rate, ndiv, fdiv, pdiv);
 }
-- 
2.11.0

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

end of thread, other threads:[~2017-06-02 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-15 17:35 [PATCH] clk: bcm2835: Correct the prediv logic Eric Anholt
2017-05-15 17:35 ` Eric Anholt
2017-05-15 17:47 ` Stefan Wahren
2017-05-15 17:47   ` Stefan Wahren
2017-05-15 19:03   ` Eric Anholt
2017-05-15 19:03     ` Eric Anholt
2017-06-02 22:41 ` Stephen Boyd
2017-06-02 22:41   ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.