mmc: use ilog2 for fifoth calculation
authorlintao <lintao@rock-chips.com>
Tue, 17 Mar 2015 08:49:37 +0000 (16:49 +0800)
committerlintao <lintao@rock-chips.com>
Tue, 17 Mar 2015 08:49:47 +0000 (16:49 +0800)
Signed-off-by: lintao <lintao@rock-chips.com>
drivers/mmc/host/rk_sdmmc.c

index 69c3711c899c55485ba1b72b35c1615d6245dcf0..227bc7efa9b2007a8aad2c06c7087727a96c7c5c 100755 (executable)
@@ -46,6 +46,7 @@
 #include <linux/clk-private.h>
 #include <linux/rockchip/cpu.h>
 #include <linux/rfkill-wlan.h>
+#include <linux/log2.h>
 #include "rk_sdmmc.h"
 #include "rk_sdmmc_dbg.h"
 #include <linux/regulator/rockchip_io_vol_domain.h>
@@ -639,7 +640,9 @@ static void dw_mci_edmac_start_dma(struct dw_mci *host, unsigned int sg_len)
 
        if (mburst > burst_limit) {
                mburst = burst_limit;
-               fifoth_val = SDMMC_SET_FIFOTH(mszs[3], mszs[3] - 1, (host->fifo_depth) / 2);
+               fifoth_val = SDMMC_SET_FIFOTH(ilog2(mburst) - 1,
+                                               (host->fifo_depth) / 2 - 1,
+                                               (host->fifo_depth) / 2);
                mci_writel(host, FIFOTH, fifoth_val);
        }