]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
MX6: Correct calculation of PLL_SYS
authorAndre Renaud <andre@bluewatersys.com>
Mon, 9 Jun 2014 20:47:13 +0000 (08:47 +1200)
committerStefano Babic <sbabic@denx.de>
Wed, 9 Jul 2014 12:55:30 +0000 (14:55 +0200)
DIV_SELECT is used as Fout = Fin * div_select / 2.0, so we should do
the shift after the multiply to avoid rounding errors

Signed-off-by: Andre Renaud <andre@bluewatersys.com>
arch/arm/cpu/armv7/mx6/clock.c

index bd65a08ba236f8afb0695c71e0d9c43defee14de..7dd83ec9e18babfd71d501a15c0ca4f7faa3af5a 100644 (file)
@@ -80,7 +80,7 @@ static u32 decode_pll(enum pll_clocks pll, u32 infreq)
                div = __raw_readl(&imx_ccm->analog_pll_sys);
                div &= BM_ANADIG_PLL_SYS_DIV_SELECT;
 
-               return infreq * (div >> 1);
+               return (infreq * div) >> 1;
        case PLL_BUS:
                div = __raw_readl(&imx_ccm->analog_pll_528);
                div &= BM_ANADIG_PLL_528_DIV_SELECT;