ARM: tegra11: clock: Fix cbus fine granularity rounding
Alex Frid [Sat, 9 Nov 2013 03:20:17 +0000 (19:20 -0800)]
Made sure that rounding rate equal to cbus fine granularity region
threshold returns threshold rate regardless of rounding direction:
up/down (was only up).

Change-Id: I61d33cf400b52e8d51a711a995666a5edb9b0cf3
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/328576
(cherry picked from commit 651660986248a50e9440475ea630026b1458daa1)
Reviewed-on: http://git-master/r/344627
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/tegra11_clocks.c

index 6a12882..01746af 100644 (file)
@@ -4897,7 +4897,10 @@ static long tegra11_clk_cbus_round_updown(struct clk *c, unsigned long rate,
                        c->dvfs->freqs[n-2] + CBUS_FINE_GRANULARITY_RANGE);
                threshold -= CBUS_FINE_GRANULARITY_RANGE;
 
-               if (rate <= threshold)
+               if (rate == threshold)
+                       return threshold;
+
+               if (rate < threshold)
                        return up ? threshold : c->dvfs->freqs[n-2];
 
                rate = (up ? DIV_ROUND_UP(rate, CBUS_FINE_GRANULARITY) :