clk-bcm2835: Correct the prediv logic
authorPhil Elwell <phil@raspberrypi.org>
Wed, 1 Mar 2017 16:06:53 +0000 (16:06 +0000)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 8 Oct 2017 01:00:24 +0000 (01:00 +0000)
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: Phil Elwell <phil@raspberrypi.org>
drivers/clk/bcm/clk-bcm2835.c

index 6b245357e4e93c19a839eee92a82f95aec996e4e..8ea29fbc8dc451b9cff502bc1a918ae65fb1b306 100644 (file)
@@ -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);
 }