Skip to contentSkip to conversation

clk: meson: fix clk81 divider calculation

PATCH In review Neil Armstrong 2 participants 2 messages Nov 13, 2018 – Nov 20, 2018

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

PATCH 1/1 clk: meson: fix clk81 divider calculation

From: Jerome Brunet <[email protected]>

clk81 divider is 0 based (meaning that 0 value in the register means divide by 1). Fix clk81 rate calculation for this.

---
 drivers/clk/clk_meson.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/clk_meson.c +2 -1
index 236d7342b7..c44858822d 100644
@@ -600,7 +600,8 @@ static unsigned long meson_clk81_get_rate(struct clk *clk)
 	reg = readl(priv->addr + HHI_MPEG_CLK_CNTL);
 	reg = reg & ((1 << 7) - 1);
 
-	return parent_rate / reg;
+	/* clk81 divider is zero based */
+	return parent_rate / (reg + 1);
 }
 
 static long mpll_rate_from_params(unsigned long parent_rate,
Signature · 1 line
2.19.1
#1 lore raw
Quoted 7 lines · Neil Armstrong

From: Jerome Brunet <[email protected]>

clk81 divider is 0 based (meaning that 0 value in the register means divide by 1). Fix clk81 rate calculation for this.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20181120/357c8413/attachment.sig>