mmc: fix eco setting for uhs tune
authorlintao <lintao@rock-chips.com>
Fri, 5 Sep 2014 08:41:07 +0000 (16:41 +0800)
committerlintao <lintao@rock-chips.com>
Fri, 5 Sep 2014 08:41:07 +0000 (16:41 +0800)
drivers/mmc/host/dw_mmc-rockchip.c

index 3acdfbad14b80b1003f48ad0ad8c7115c83017f1..cfbbcccac732769c1734a436aa327664d9840065 100755 (executable)
@@ -358,28 +358,29 @@ static int dw_mci_rockchip_execute_tuning(struct dw_mci_slot *slot, u32 opcode,
            So we take average --- 60ps, (1.66ns/ 2) = 0.83(middle-value),TAKE 0.9
            0.9 / 60ps = 15 delayline
          */
-        if(cpu_is_rk3288()){
-                 ref = ((FREQ_REF_150MHZ + host->bus_hz - 1) / host->bus_hz);
-                 step = (15 * ref);
+        if (cpu_is_rk3288() && !(rockchip_get_cpu_version() > 0)) {
+                /* RK3288, non-eco */
+                ref = DIV_ROUND_UP(FREQ_REF_150MHZ, host->bus_hz);
+                step = (15 * ref);
 
-                 if(step > MAX_DELAY_LINE){
+                if (step > MAX_DELAY_LINE) {
                         step = MAX_DELAY_LINE;       
                         MMC_DBG_WARN_FUNC(host->mmc,
                                         "execute tuning: TOO LARGE STEP![%s]", mmc_hostname(host->mmc));
-                 }              
-                 MMC_DBG_INFO_FUNC(host->mmc,
+                }
+                MMC_DBG_INFO_FUNC(host->mmc,
                                 "execute tuning: SOC is RK3288, ref = %d, step = %d[%s]",
                                 ref, step, mmc_hostname(host->mmc));
                  
-        }else{              
-                 step = (15 * ((FREQ_REF_150MHZ / host->bus_hz) * 100)) / 100;
+        } else {
+                step = (15 * ((FREQ_REF_150MHZ / host->bus_hz) * 100)) / 100;
 
-                 if(step > MAX_DELAY_LINE){
+                if (step > MAX_DELAY_LINE) {
                         step = MAX_DELAY_LINE;
                         MMC_DBG_WARN_FUNC(host->mmc,
                                         "execute tuning: TOO LARGE STEP![%s]", mmc_hostname(host->mmc));
-                 }              
-                 MMC_DBG_INFO_FUNC(host->mmc,
+                }
+                MMC_DBG_INFO_FUNC(host->mmc,
                                 "execute tuning: SOC is UNKNOWN, step = %d[%s]",
                                 step, mmc_hostname(host->mmc));
         }