This patch sets DMA transfer size for source/destination based on the DMA transfer direction in rz_dmac_config() as the client drivers sets this parameters based on DMA transfer direction. Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> --- drivers/dma/sh/rz-dmac.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index ee2872e7d64c..52d82f67d3dd 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -604,17 +604,19 @@ static int rz_dmac_config(struct dma_chan *chan, channel->dst_per_address = config->dst_addr; channel->dst_word_size = config->dst_addr_width; - val = rz_dmac_ds_to_val_mapping(config->dst_addr_width); - if (val == CHCFG_DS_INVALID) - return -EINVAL; - - channel->chcfg |= CHCFG_FILL_DDS(val); + if (config->direction == DMA_DEV_TO_MEM) { + val = rz_dmac_ds_to_val_mapping(config->src_addr_width); + if (val == CHCFG_DS_INVALID) + return -EINVAL; - val = rz_dmac_ds_to_val_mapping(config->src_addr_width); - if (val == CHCFG_DS_INVALID) - return -EINVAL; + channel->chcfg |= CHCFG_FILL_SDS(val); + } else { + val = rz_dmac_ds_to_val_mapping(config->dst_addr_width); + if (val == CHCFG_DS_INVALID) + return -EINVAL; - channel->chcfg |= CHCFG_FILL_SDS(val); + channel->chcfg |= CHCFG_FILL_DDS(val); + } return 0; } -- 2.17.1