rk_sdmmc: recalculate audib rx_wmark
authorxiaoyao <xiaoyao@rock-chips.com>
Wed, 18 Mar 2015 03:43:16 +0000 (11:43 +0800)
committerxiaoyao <xiaoyao@rock-chips.com>
Wed, 18 Mar 2015 03:43:16 +0000 (11:43 +0800)
AudiB contain a less limitation in rx_wmark.

Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
Signed-off-by: lintao <lintao@rock-chips.com>
drivers/mmc/host/rk_sdmmc.c

index 227bc7efa9b2007a8aad2c06c7087727a96c7c5c..e4488a8de558e6f94202c398b9a860fb1a5dfdd7 100755 (executable)
@@ -620,6 +620,7 @@ static void dw_mci_edmac_start_dma(struct dw_mci *host, unsigned int sg_len)
        u32 sg_elems = host->data->sg_len;
        u32 fifoth_val, mburst;
        u32 burst_limit = 0;
+       u32 idx, rx_wmark, tx_wmark;
        int ret = 0;
 
        /* Set external dma config: burst size, burst width*/
@@ -640,9 +641,18 @@ 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(ilog2(mburst) - 1,
-                                               (host->fifo_depth) / 2 - 1,
-                                               (host->fifo_depth) / 2);
+               idx = (ilog2(mburst) > 0) ? (ilog2(mburst) - 1) : 0;
+
+               if (soc_is_rk3126b()) {
+                       idx = 0;
+                       rx_wmark = (host->fifo_depth) / 2 - 1;
+               } else {
+                       rx_wmark = mszs[idx] - 1;
+               }
+
+               tx_wmark = (host->fifo_depth) / 2;
+               fifoth_val = SDMMC_SET_FIFOTH(idx, rx_wmark, tx_wmark);
+
                mci_writel(host, FIFOTH, fifoth_val);
        }