aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakeshi Saito <takeshi.saito.xv@renesas.com>2019-01-18 17:42:36 +0900
committerRyo Kataoka <ryo.kataoka.wt@renesas.com>2019-03-22 20:50:19 +0900
commit6331c5f1c6a6f543ab27d12dfe8112b3959d2edd (patch)
tree5c75830236455636baf77db27e70d9a6b97b5f7c
parentb2e044a3602f7f9ffe6c61b6655e6b0b283d85c4 (diff)
downloadrenesas-bsp-6331c5f1c6a6f543ab27d12dfe8112b3959d2edd.tar.gz
mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes
The internal DMAC buffer alignment condition of R-Car Gen3 SDHI HW is 128 bytes before. It is correct, but HW manual have had a mistake as 8 bytes. The driver is fixed with 128 bytes according to the modification of HW manual, this time. Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
-rw-r--r--drivers/mmc/host/renesas_sdhi_internal_dmac.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 29da88ae257b6..173be0742191e 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -175,6 +175,13 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
if (!tmio_mmc_pre_dma_transfer(host, data, COOKIE_MAPPED))
goto force_pio;
+ /*
+ * In case of Gen3, this DMAC cannot handle if buffer is
+ * not 128-bytes alignment
+ */
+ if (!IS_ALIGNED(sg_dma_address(sg), 128))
+ goto force_pio_with_unmap;
+
if (data->flags & MMC_DATA_READ) {
dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) &&
@@ -197,6 +204,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
force_pio_with_unmap:
dma_unmap_sg(&host->pdev->dev, sg, host->sg_len, mmc_get_dma_dir(data));
+ data->host_cookie = COOKIE_UNMAPPED;
force_pio:
host->force_pio = true;