From d25006e7e5045e76575e9f58903efc1a860a3ff1 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 16 Jul 2014 00:45:12 +0200 Subject: [PATCH] mmc: sh_mmcif: Fix DMA slave address configuration Commit e5a233cb647d749de2f188477c9a54b94d90477f ("mmc: sh_mmcif: Factorize DMA channel request and configuration code") incorrectly set the destination address for both slave channels instead of setting the source address for the receive channel. Fix that. Signed-off-by: Laurent Pinchart Signed-off-by: Ulf Hansson --- drivers/mmc/host/sh_mmcif.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 0289b4ecccb3..863d21ee4a2f 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -386,7 +386,7 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host, struct sh_mmcif_plat_data *pdata, enum dma_transfer_direction direction) { - struct dma_slave_config cfg; + struct dma_slave_config cfg = { 0, }; struct dma_chan *chan; unsigned int slave_id; struct resource *res; @@ -417,8 +417,12 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host, /* In the OF case the driver will get the slave ID from the DT */ cfg.slave_id = slave_id; cfg.direction = direction; - cfg.dst_addr = res->start + MMCIF_CE_DATA; - cfg.src_addr = 0; + + if (direction == DMA_DEV_TO_MEM) + cfg.src_addr = res->start + MMCIF_CE_DATA; + else + cfg.dst_addr = res->start + MMCIF_CE_DATA; + ret = dmaengine_slave_config(chan, &cfg); if (ret < 0) { dma_release_channel(chan); -- 2.11.0