Skip to content

Commit 25fbbaf

Browse files
committed
clk: sunxi-ng: mp: Fix dual-divider clock rate readback
When dual-divider clock support was introduced, the P divider offset was left out of the .recalc_rate readback function. This causes the clock rate to become bogus or even zero (possibly due to the P divider being 1, leading to a divide-by-zero). Fix this by incorporating the P divider offset into the calculation. Fixes: 4571780 ("clk: sunxi-ng: mp: introduce dual-divider clock") Reviewed-by: Andre Przywara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Chen-Yu Tsai <[email protected]>
1 parent 8f5ae30 commit 25fbbaf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/sunxi-ng/ccu_mp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static unsigned long ccu_mp_recalc_rate(struct clk_hw *hw,
185185
p &= (1 << cmp->p.width) - 1;
186186

187187
if (cmp->common.features & CCU_FEATURE_DUAL_DIV)
188-
rate = (parent_rate / p) / m;
188+
rate = (parent_rate / (p + cmp->p.offset)) / m;
189189
else
190190
rate = (parent_rate >> p) / m;
191191

0 commit comments

Comments
 (0)