All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] MX6: Correct calculation of PLL_SYS
@ 2014-06-09 20:47 Andre Renaud
  2014-07-09 12:56 ` Stefano Babic
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Renaud @ 2014-06-09 20:47 UTC (permalink / raw)
  To: u-boot

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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index bd65a08..7dd83ec 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] MX6: Correct calculation of PLL_SYS
  2014-06-09 20:47 [U-Boot] [PATCH] MX6: Correct calculation of PLL_SYS Andre Renaud
@ 2014-07-09 12:56 ` Stefano Babic
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2014-07-09 12:56 UTC (permalink / raw)
  To: u-boot

On 09/06/2014 22:47, Andre Renaud wrote:
> 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 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
> index bd65a08..7dd83ec 100644
> --- a/arch/arm/cpu/armv7/mx6/clock.c

Applied to u-boot-imx, as a fix, thanks !

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
=====================================================================

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-09 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 20:47 [U-Boot] [PATCH] MX6: Correct calculation of PLL_SYS Andre Renaud
2014-07-09 12:56 ` Stefano Babic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.