From ff4ce813939da6178b20e5154cd2da42fcbc49ac Mon Sep 17 00:00:00 2001 From: Jarkko Lavinen Date: Tue, 21 Jun 2005 05:44:39 -0700 Subject: [PATCH] [PATCH] ARM: OMAP: Writing large files onto sync mounted MMC corrupts the FS Fixed incorrect DMA flags as noted by David Brownell. Signed-off-by: Jarkko Lavinen Signed-off-by: Tony Lindgren --- drivers/mmc/omap.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index 3140a99b471..1c09a5b05da 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c @@ -643,6 +643,7 @@ static inline void set_data_timeout(struct mmc_omap_host *host, struct mmc_reque static void mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) { struct mmc_data *data = req->data; + enum dma_data_direction dma_data_dir; host->data = data; if (data == NULL) { @@ -664,12 +665,16 @@ static void mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request OMAP_MMC_WRITE(host->base, BLEN, (1 << data->blksz_bits) - 1); set_data_timeout(host, req); - host->datadir = (data->flags & MMC_DATA_WRITE) ? - OMAP_MMC_DATADIR_WRITE : OMAP_MMC_DATADIR_READ; - host->dma_len = 0; - - host->dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, - host->datadir); + if (data->flags & MMC_DATA_WRITE) { + host->datadir = OMAP_MMC_DATADIR_WRITE; + dma_data_dir = DMA_TO_DEVICE; + } else { + host->datadir = OMAP_MMC_DATADIR_READ; + dma_data_dir = DMA_FROM_DEVICE; + } + + host->dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, + dma_data_dir); /* No SG-DMA */ if (unlikely(host->dma_len > 1)) -- 2.41.1