From patchwork Mon Mar 7 19:12:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12772252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BFA8C433FE for ; Mon, 7 Mar 2022 19:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238707AbiCGTNO (ORCPT ); Mon, 7 Mar 2022 14:13:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245140AbiCGTNM (ORCPT ); Mon, 7 Mar 2022 14:13:12 -0500 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 570295674F; Mon, 7 Mar 2022 11:12:17 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.90,163,1643641200"; d="scan'208";a="113628015" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 08 Mar 2022 04:12:16 +0900 Received: from localhost.localdomain (unknown [10.226.92.211]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A281A40D6A32; Tue, 8 Mar 2022 04:12:14 +0900 (JST) From: Biju Das To: Vinod Koul Cc: Biju Das , Lad Prabhakar , Colin Ian King , Dan Carpenter , dmaengine@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Date: Mon, 7 Mar 2022 19:12:10 +0000 Message-Id: <20220307191211.12087-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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 Reviewed-by: Lad Prabhakar --- 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; }