Skip to contentSkip to conversation

arm: exynos: fix the div value for set_mmc_clk

PATCH New Jaehoon Chung 2 participants 2 messages Jan 8, 2015 – Feb 13, 2015

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

PATCH 1/1 arm: exynos: fix the div value for set_mmc_clk

The most exynos used the "Ratio + 1" as div value. And value at register is "Ratio".
So if want to set exact value, it needs to subtract one.

Value at register ("Ratio") = div - 1

---
 arch/arm/cpu/armv7/exynos/clock.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/exynos/clock.c +4 -0
index b31c13b..3110bb0 100644
@@ -1656,6 +1656,10 @@ unsigned long get_mmc_clk(int dev_index)
 
 void set_mmc_clk(int dev_index, unsigned int div)
 {
+	/* If want to set correct value, it needs to substract one from div.*/
+	if (div > 0)
+		div -= 1;
+
 	if (cpu_is_exynos5()) {
 		if (proid_is_exynos5420() || proid_is_exynos5800())
 			exynos5420_set_mmc_clk(dev_index, div);
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm: exynos: fix the div value for set_mmc_clk

Quoted 17 lines · Jaehoon Chung

The most exynos used the "Ratio + 1" as div value. And value at register is "Ratio".
So if want to set exact value, it needs to subtract one.

Value at register ("Ratio") = div - 1

---
 arch/arm/cpu/armv7/exynos/clock.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/exynos/clock.c +0 -0
index b31c13b..3110bb0 100644

arch/arm/cpu/armv7/exynos/clock.c unsigned long get_mmc_clk(int dev_index) · line 1665

Quoted 10 lines
arch/arm/cpu/armv7/exynos/clock.c +4 -0
@@ -1656,6 +1656,10 @@ unsigned long get_mmc_clk(int dev_index)
 
 void set_mmc_clk(int dev_index, unsigned int div)
 {
+	/* If want to set correct value, it needs to substract one from div.*/
+	if (div > 0)
+		div -= 1;
+
 	if (cpu_is_exynos5()) {
 		if (proid_is_exynos5420() || proid_is_exynos5800())
 			exynos5420_set_mmc_clk(dev_index, div);

applied to u-boot-samsung.

Thank,
Minkyu Kang.