mmc:fsl_esdhc invalidate dcache before read
[oweals/u-boot.git] / drivers / mmc / fsl_esdhc.c
index c4719e6f3635b6396ea731c8c624199d17cdc335..0510bf02f41bbf28d2b93ed0ae4f958da358d230 100644 (file)
@@ -341,6 +341,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 */
@@ -437,6 +440,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