From patchwork Sat Apr 9 16:53:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12807986 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 6AD8AC433FE for ; Sat, 9 Apr 2022 16:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242773AbiDIQ4C (ORCPT ); Sat, 9 Apr 2022 12:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbiDIQ4C (ORCPT ); Sat, 9 Apr 2022 12:56:02 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8DCC526AE06; Sat, 9 Apr 2022 09:53:54 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.90,248,1643641200"; d="scan'208";a="117255905" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 10 Apr 2022 01:53:52 +0900 Received: from localhost.localdomain (unknown [10.226.92.32]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id A1E554005E27; Sun, 10 Apr 2022 01:53:50 +0900 (JST) From: Biju Das To: Vinod Koul Cc: Biju Das , Colin Ian King , Lad Prabhakar , Geert Uytterhoeven , Dan Carpenter , dmaengine@vger.kernel.org, Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction Date: Sat, 9 Apr 2022 17:53:48 +0100 Message-Id: <20220409165348.46080-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Client drivers configure DMA transfer parameters based on the DMA transfer direction. This patch sets corresponding parameters in rz_dmac_config() based on the DMA transfer direction. Signed-off-by: Biju Das Reviewed-by: Lad Prabhakar --- v1->v2: * Updated commit description --- drivers/dma/sh/rz-dmac.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index ee2872e7d64c..de57ae006879 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -597,24 +597,24 @@ static int rz_dmac_config(struct dma_chan *chan, struct dma_slave_config *config) { struct rz_dmac_chan *channel = to_rz_dmac_chan(chan); - u32 val; + u32 val, data_sz; - channel->src_per_address = config->src_addr; - channel->src_word_size = config->src_addr_width; - 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) { + channel->src_per_address = config->src_addr; + channel->src_word_size = config->src_addr_width; + val = rz_dmac_ds_to_val_mapping(config->src_addr_width); + data_sz = CHCFG_FILL_SDS(val); + } else { + 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); + data_sz = CHCFG_FILL_DDS(val); + } - val = rz_dmac_ds_to_val_mapping(config->src_addr_width); if (val == CHCFG_DS_INVALID) return -EINVAL; - channel->chcfg |= CHCFG_FILL_SDS(val); + channel->chcfg |= data_sz; return 0; }