Skip to contentSkip to conversation

clk: bcm2835: Correct the prediv logic

PATCH Applied Eric Anholt 3 participants 4 messages May 15, 2017 – Jun 2, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: bcm2835: Correct the prediv logic

From: Phil Elwell <[email protected]>

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

---

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(-)
drivers/clk/bcm/clk-bcm2835.c +3 -1
index 025853870619..7a35df6b45bd 100644
@@ -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);
 }
Signature · 1 line
2.11.0
#1 lore raw

Hi Eric,

Quoted 8 lines

Eric Anholt <[email protected]> hat am 15. Mai 2017 um 19:35 geschrieben:

From: Phil Elwell <[email protected]>

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

Quoted 6 lines

---

While this is a bugfix, I haven't put a "Fixes:" line in here to get it automatically backported to stable.

sorry, i can't follow. How should this happen without "Fixes: "?

Quoted 6 lines

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

#2 lore raw
Quoted 10 lines · Stefan Wahren

Hi Eric,

Quoted 8 lines

Eric Anholt <[email protected]> hat am 15. Mai 2017 um 19:35 geschrieben:

From: Phil Elwell <[email protected]>

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

Quoted 8 lines
Quoted 6 lines

---

While this is a bugfix, I haven't put a "Fixes:" line in here to get it automatically backported to stable.

sorry, i can't follow. How should this happen without "Fixes: "?

I didn't want it to be backported to stable, because of the risk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170515/803ae7fe/attachment.sig>

Applied
#3 lore raw
In reply to Eric Anholt
Quoted 8 lines · Eric Anholt

From: Phil Elwell <[email protected]>

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

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project