summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/uniphier-sd.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-10-13 00:03:08 +0900
committerUlf Hansson <ulf.hansson@linaro.org>2018-10-15 14:52:50 +0200
commitd3dd5db0c1b904e71690ef8cfaebd562d8e865b1 (patch)
treebf15a44ac594b9d85d402df1b7269cd3471603b8 /drivers/mmc/host/uniphier-sd.c
parent722fb61e2ed39473297157839ec7230b77fd6940 (diff)
mmc: tmio: simplify the DMA mode test
host->chan_{rx,tx} represents the DMA capability of the platform. Even if DMA is supported, there are cases where we want to use PIO, for example, data length is short enough as commit 5f52c3552946 ("mmc: tmio: use PIO for short transfers") mentioned. Regarding the hardware control flow, we are interested in whether DMA is currently enabled or not, instead of whether the platform has the DMA capability. Hence, the several conditionals in tmio_mmc_core.c end up with checking host->chan_{rx,tx} and !host->force_pio. This is not nice. Let's flip the flag host->force_pio into host->dma_on. host->dma_on represents whether the DMA is currently enabled or not. This flag is set false in the beginning of each command, then should be set true by tmio_mmc_start_dma() when the DMA is turned on. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/uniphier-sd.c')
-rw-r--r--drivers/mmc/host/uniphier-sd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c
index 10e7b30c792a..7a8d3081f579 100644
--- a/drivers/mmc/host/uniphier-sd.c
+++ b/drivers/mmc/host/uniphier-sd.c
@@ -157,13 +157,14 @@ static void uniphier_sd_external_dma_start(struct tmio_mmc_host *host,
if (cookie < 0)
goto unmap_sg;
+ host->dma_on = true;
+
return;
unmap_sg:
dma_unmap_sg(mmc_dev(host->mmc), host->sg_ptr, host->sg_len,
priv->dma_dir);
force_pio:
- host->force_pio = true;
uniphier_sd_dma_endisable(host, 0);
}
@@ -280,9 +281,10 @@ static void uniphier_sd_internal_dma_start(struct tmio_mmc_host *host,
writel(lower_32_bits(dma_addr), host->ctl + UNIPHIER_SD_DMA_ADDR_L);
writel(upper_32_bits(dma_addr), host->ctl + UNIPHIER_SD_DMA_ADDR_H);
+ host->dma_on = true;
+
return;
force_pio:
- host->force_pio = true;
uniphier_sd_dma_endisable(host, 0);
}