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

Commit e45098d7 authored by Phil Elwell's avatar Phil Elwell Committed by Stephen Boyd
Browse files

clk: bcm2835: Correct the prediv logic



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: default avatarPhil Elwell <phil@raspberrypi.org>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 88754115
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
}