Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 196de71a authored by James Liao's avatar James Liao Committed by Stephen Boyd
Browse files

clk: mediatek: Fix calculation of PLL rate settings



Avoid u32 overflow when calculate post divider setting, and
increase the max post divider setting from 3 (/8) to 4 (/16).

Signed-off-by: default avatarJames Liao <jamesjj.liao@mediatek.com>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent b3be457e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -144,9 +144,9 @@ static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv,
	if (freq > pll->data->fmax)
		freq = pll->data->fmax;

	for (val = 0; val < 4; val++) {
	for (val = 0; val < 5; val++) {
		*postdiv = 1 << val;
		if (freq * *postdiv >= fmin)
		if ((u64)freq * *postdiv >= fmin)
			break;
	}