]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mmc/fsl_esdhc.c
karo: tx6ul: proper initialize second FEC if available
[karo-tx-uboot.git] / drivers / mmc / fsl_esdhc.c
index ebbe91305814d0795ebacc6674b04e950be6d207..20a2df1f01efb4dd9023ded72b60fe0315d1a4b7 100644 (file)
@@ -287,7 +287,6 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
        return 0;
 }
 
-#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
 static void check_and_invalidate_dcache_range
        (struct mmc_cmd *cmd,
         struct mmc_data *data) {
@@ -310,7 +309,6 @@ static void check_and_invalidate_dcache_range
 #endif
        invalidate_dcache_range(start, end);
 }
-#endif
 
 /*
  * Sends a command out on the bus.  Takes the mmc pointer,
@@ -362,6 +360,9 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                err = esdhc_setup_data(mmc, data);
                if (err)
                        return err;
+
+               if (data->flags & MMC_DATA_READ)
+                       check_and_invalidate_dcache_range(cmd, data);
        }
 
        /* Figure out the transfer arguments */
@@ -469,6 +470,11 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                        }
                } while ((irqstat & DATA_COMPLETE) != DATA_COMPLETE);
 
+               /*
+                * Need invalidate the dcache here again to avoid any
+                * cache-fill during the DMA operations such as the
+                * speculative pre-fetching etc.
+                */
                if (data->flags & MMC_DATA_READ)
                        check_and_invalidate_dcache_range(cmd, data);
 #endif