S3C2443: Accommodate cpufreq frequency scheme in armdiv

A patch from »S3C2416: Enable armdiv and armclk« in state Mainline for linux-kernel

From: Heiko Stuebner <heiko.stuebner@...> Date: Tue, 27 Sep 2011 13:39:04 +0200

Commit-Message

Cpufreq uses frequencies in kHz and not Hz, so set_rate and round_rate would be called with a frequency of 266666000 instead of 266666666 but the clock functions check for rates smaller or equal to the targetrate. As the armdiv does not support steps this small we can accommodate this by simply also setting the last 3 digits of the calculated rate to zero. Signed-off-by: Heiko Stuebner <heiko@...>

Patch-Comment

arch/arm/plat-s3c24xx/s3c2443-clock.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)

Statistics

  • 4 lines added
  • 2 lines removed

Changes

-------------------- arch/arm/plat-s3c24xx/s3c2443-clock.c ---------------------
index 31f97f1..40a8720 100644
@@ -185,7 +185,8 @@ static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
for (ptr = 0; ptr < nr_armdiv; ptr++) {
div = armdiv[ptr];
if (div) {
- calc = parent / div;
+ /* cpufreq provides 266mhz as 266666000 not 266666666 */
+ calc = (parent / div / 1000) * 1000;
if (calc <= rate && div < best)
best = div;
}
@@ -225,7 +226,8 @@ static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
for (ptr = 0; ptr < nr_armdiv; ptr++) {
div = armdiv[ptr];
if (div) {
- calc = parent / div;
+ /* cpufreq provides 266mhz as 266666000 not 266666666 */
+ calc = (parent / div / 1000) * 1000;
if (calc <= rate && div < best) {
best = div;
val = ptr;
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...