Patchwork [U-Boot] Exynos5: clock: Update the equation to calculate PLL output frequency

login
register
mail settings
Submitter Akshay Saraswat
Date March 22, 2013, 12:26 p.m.
Message ID <1363955196-1217-1-git-send-email-akshay.s@samsung.com>
Download mbox | patch
Permalink /patch/229977/
State Accepted
Delegated to: Minkyu Kang
Headers show

Comments

Akshay Saraswat - March 22, 2013, 12:26 p.m.
According to the latest exynos5 user manual, the equation for
calculating PLL output was changed to
FOUT= MDIV x FIN/(PDIV x 2^SDIV)
earlier it was
FOUT= MDIV x FIN/(PDIV x 2^(SDIV -1))
So updating the clock code accordingly.

Signed-off-by: Hatim Ali <hatim.rv@samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
---
 arch/arm/cpu/armv7/exynos/clock.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Simon Glass - March 23, 2013, 12:41 a.m.
On Fri, Mar 22, 2013 at 5:26 AM, Akshay Saraswat <akshay.s@samsung.com> wrote:
> According to the latest exynos5 user manual, the equation for
> calculating PLL output was changed to
> FOUT= MDIV x FIN/(PDIV x 2^SDIV)
> earlier it was
> FOUT= MDIV x FIN/(PDIV x 2^(SDIV -1))
> So updating the clock code accordingly.
>
> Signed-off-by: Hatim Ali <hatim.rv@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>

Acked-by: Simon Glass <sjg@chromium.org>

I think this is EVT1 silicon, right?

> ---
>  arch/arm/cpu/armv7/exynos/clock.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
> index 956427c..5299bc7 100644
> --- a/arch/arm/cpu/armv7/exynos/clock.c
> +++ b/arch/arm/cpu/armv7/exynos/clock.c
> @@ -73,10 +73,8 @@ static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k)
>                 /* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */
>                 fout = (m + k / 1024) * (freq / (p * (1 << s)));
>         } else {
> -               if (s < 1)
> -                       s = 1;
> -               /* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
> -               fout = m * (freq / (p * (1 << (s - 1))));
> +               /* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
> +               fout = m * (freq / (p * (1 << s)));
>         }
>
>         return fout;
> --
> 1.8.0
>
Minkyu Kang - May 21, 2013, 11:19 a.m.
Dear Akshay Saraswat,

On 22/03/13 21:26, Akshay Saraswat wrote:
> According to the latest exynos5 user manual, the equation for
> calculating PLL output was changed to
> FOUT= MDIV x FIN/(PDIV x 2^SDIV)
> earlier it was
> FOUT= MDIV x FIN/(PDIV x 2^(SDIV -1))
> So updating the clock code accordingly.
> 
> Signed-off-by: Hatim Ali <hatim.rv@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> ---
>  arch/arm/cpu/armv7/exynos/clock.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
> index 956427c..5299bc7 100644
> --- a/arch/arm/cpu/armv7/exynos/clock.c
> +++ b/arch/arm/cpu/armv7/exynos/clock.c
> @@ -73,10 +73,8 @@ static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k)
>  		/* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */
>  		fout = (m + k / 1024) * (freq / (p * (1 << s)));
>  	} else {
> -		if (s < 1)
> -			s = 1;
> -		/* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
> -		fout = m * (freq / (p * (1 << (s - 1))));
> +		/* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
> +		fout = m * (freq / (p * (1 << s)));
>  	}
>  
>  	return fout;
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

Patch

diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
index 956427c..5299bc7 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -73,10 +73,8 @@  static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k)
 		/* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */
 		fout = (m + k / 1024) * (freq / (p * (1 << s)));
 	} else {
-		if (s < 1)
-			s = 1;
-		/* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
-		fout = m * (freq / (p * (1 << (s - 1))));
+		/* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
+		fout = m * (freq / (p * (1 << s)));
 	}
 
 	return fout;