[U-Boot] [PATCH 2/2] imx: mx7ulp: Fix SPLL/APLL clock rate calculation issue
Stefano Babic
sbabic at denx.de
Wed Apr 12 16:45:46 UTC 2017
On 05/04/2017 04:36, Peng Fan wrote:
> From: Ye Li <ye.li at nxp.com>
>
> The num/denom is a float value, but in the calculation it is convert
> to integer 0, and wrong result.
>
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Cc: Stefano Babic <sbabic at denx.de>
> ---
> arch/arm/cpu/armv7/mx7ulp/scg.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx7ulp/scg.c b/arch/arm/cpu/armv7/mx7ulp/scg.c
> index ca8252d..c117af0 100644
> --- a/arch/arm/cpu/armv7/mx7ulp/scg.c
> +++ b/arch/arm/cpu/armv7/mx7ulp/scg.c
> @@ -504,7 +504,9 @@ u32 decode_pll(enum pll_clocks pll)
> num = readl(&scg1_regs->spllnum);
> denom = readl(&scg1_regs->splldenom);
>
> - return (infreq / pre_div) * (mult + num / denom);
> + infreq = infreq / pre_div;
> +
> + return infreq * mult + infreq * num / denom;
>
> case PLL_A7_APLL:
> reg = readl(&scg1_regs->apllcsr);
> @@ -531,7 +533,9 @@ u32 decode_pll(enum pll_clocks pll)
> num = readl(&scg1_regs->apllnum);
> denom = readl(&scg1_regs->aplldenom);
>
> - return (infreq / pre_div) * (mult + num / denom);
> + infreq = infreq / pre_div;
> +
> + return infreq * mult + infreq * num / denom;
>
> case PLL_USB:
> reg = readl(&scg1_regs->upllcsr);
>
Applied to u-boot-imx, thanks!
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
More information about the U-Boot
mailing list