Skip to contentSkip to conversation

Exynos5: clock: Update the equation to calculate PLL output frequency

PATCH New Akshay Saraswat 3 participants 3 messages Mar 22, 2013 – May 21, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Exynos5: clock: Update the equation to calculate PLL output frequency

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.

---
 arch/arm/cpu/armv7/exynos/clock.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/exynos/clock.c +2 -4
index 956427c..5299bc7 100644
@@ -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;
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/1 Exynos5: clock: Update the equation to calculate PLL output frequency

Quoted 9 lines · Akshay Saraswat

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.

I think this is EVT1 silicon, right?

Quoted 24 lines
---
 arch/arm/cpu/armv7/exynos/clock.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/exynos/clock.c +2 -5
index 956427c..5299bc7 100644
@@ -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

#2 lore raw

PATCH 1/1 Exynos5: clock: Update the equation to calculate PLL output frequency

In reply to Akshay Saraswat

Dear Akshay Saraswat,

Quoted 21 lines · Akshay Saraswat

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.

---
 arch/arm/cpu/armv7/exynos/clock.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/exynos/clock.c +0 -0
index 956427c..5299bc7 100644
@@ -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)));

arch/arm/cpu/armv7/exynos/clock.c static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k) · line 80

Quoted 10 lines
arch/arm/cpu/armv7/exynos/clock.c +2 -4
 	} 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.