Author: Vishal Annapurve MMC: Remove unnecessary cache operations 1) This change removes unnecessary cache operations happening after and before DMA setup in MMC host driver. Signed-off-by: Vishal Annapurve diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6e43c84..d5cd0ae 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -434,6 +434,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, dma_addr_t addr; dma_addr_t align_addr; int len, offset; + int align_buf_modified_len = 0; struct scatterlist *sg; int i; @@ -498,6 +499,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, align += 4; align_addr += 4; + align_buf_modified_len += 4; desc += 8; @@ -538,9 +540,10 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, /* * Resync align buffer as we might have changed it. */ - if (data->flags & MMC_DATA_WRITE) { + if ((data->flags & MMC_DATA_WRITE) && + align_buf_modified_len) { dma_sync_single_for_device(mmc_dev(host->mmc), - host->align_addr, 128 * 4, direction); + host->align_addr, align_buf_modified_len, direction); } host->adma_addr = dma_map_single(mmc_dev(host->mmc), @@ -583,9 +586,10 @@ static void sdhci_adma_table_post(struct sdhci_host *host, dma_unmap_single(mmc_dev(host->mmc), host->align_addr, 128 * 4, direction); + dma_unmap_sg(mmc_dev(host->mmc), data->sg, + data->sg_len, direction); + if (data->flags & MMC_DATA_READ) { - dma_sync_sg_for_cpu(mmc_dev(host->mmc), data->sg, - data->sg_len, direction); align = host->align_buffer; @@ -602,9 +606,6 @@ static void sdhci_adma_table_post(struct sdhci_host *host, } } } - - dma_unmap_sg(mmc_dev(host->mmc), data->sg, - data->sg_len, direction); } static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)