]> git.sur5r.net Git - u-boot/blobdiff - drivers/clk/aspeed/clk_ast2500.c
aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation
[u-boot] / drivers / clk / aspeed / clk_ast2500.c
index af369cc4c8aa0f5dd9f849fe0d81e17aa09a1fc6..26a5e58221cc155f5c95d09761600cc316c5b9ae 100644 (file)
@@ -35,7 +35,7 @@ static ulong ast2500_get_mpll_rate(ulong clkin, u32 mpll_reg)
        const ulong post_div = (mpll_reg >> SCU_MPLL_POST_SHIFT)
                        & SCU_MPLL_POST_MASK;
 
-       return (clkin * ((num + 1) / (denum + 1))) / post_div;
+       return (clkin * ((num + 1) / (denum + 1))) / (post_div + 1);
 }
 
 /*
@@ -50,7 +50,7 @@ static ulong ast2500_get_hpll_rate(ulong clkin, u32 hpll_reg)
        const ulong post_div = (hpll_reg >> SCU_HPLL_POST_SHIFT)
                        & SCU_HPLL_POST_MASK;
 
-       return (clkin * ((num + 1) / (denum + 1))) / post_div;
+       return (clkin * ((num + 1) / (denum + 1))) / (post_div + 1);
 }
 
 static ulong ast2500_get_clkin(struct ast2500_scu *scu)