aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sh_mmcif.c
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2012-03-28 05:01:09 -0400
committerChris Ball <cjb@laptop.org>2012-04-05 20:32:23 -0400
commitf93882570496aa02ba8a47bfaf81cce43046b978 (patch)
treee1493468f480ff958edc5e3013b513b4baa43641 /drivers/mmc/host/sh_mmcif.c
parent5865f2876baa5c68fd0d50029dd220ce19f3d2af (diff)
mmc: sh_mmcif: double clock speed
Correct an off-by one error when calculating the clock divisor in cases where the host clock is a power of two of the target clock. Previously the divisor was one greater than the correct value in these cases leading to the clock being set at half the desired speed. Thanks to Guennadi Liakhovetski for working with me on the logic for this change. Tested-by: Cao Minh Hiep <hiepcm@gmail.com> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sh_mmcif.c')
-rw-r--r--drivers/mmc/host/sh_mmcif.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index aafaf0b6eb1c..d79c6430c164 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -454,7 +454,8 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
454 sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK); 454 sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK);
455 else 455 else
456 sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR & 456 sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR &
457 ((fls(host->clk / clk) - 1) << 16)); 457 ((fls(DIV_ROUND_UP(host->clk,
458 clk) - 1) - 1) << 16));
458 459
459 sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE); 460 sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE);
460} 461}