From patchwork Tue Apr 10 07:46:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 133058 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1029179ljb; Tue, 10 Apr 2018 00:46:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49yhCXjqZdNwXuVGvmAg/s/yq7yaGTFAcsM29gWVgJXooxlaR4nf0t7IMiOzx13JFg1HLfB X-Received: by 10.99.191.12 with SMTP id v12mr5001099pgf.54.1523346402657; Tue, 10 Apr 2018 00:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523346402; cv=none; d=google.com; s=arc-20160816; b=LWTvOiv2BoaRmX5ePYCCK1zkxfIMgOtgfvZkRIXZs9jMrBjQyCks14zG0fRI3R/4Y3 DAOOyVsPHLEr49sDeTx7GWsGGP6SEXjmNIwX3vCzKyUFZsFUrh4PEbKgoVT3FRwScfgi LQ6VMg+qe2S1sDpM6NurAN56NtmmwWsVxF5aXYrcc+sJFon1u2F+nE6iWBjgFIJpjrO6 V1/XbURr50gAeA0RK5g/T6QtsoLiC1q2MRRrwEsQZHoYet8MKx5xjazfoLGOrqLUxFIm ZZs/e8EZx+2JOD6sTpXROZxpY/mzUA1Wky538uPmcfBuGkWcLVsFQ3O0CfKUsNSRc/NE ejLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=w79L65rOvc47yyfbyc4jTlWwancETpryqzoDL61LG5I=; b=N69tI4CktEpK2UlgLTYpTeNIvJ+p31duoDoLmuDK05iFhAZ49DN5r71dUEYLkhFpF1 D6Q+W/KmdF/ntV2aKiKKUf0FXfLQy2b0oKIyKk8RodbnFhN/U0KH5xo6+Jbs+KodV7UW Hh1hrjqlSeN71hvseb64hscy8hNdCpNQw+9SA4pD16VY6IJAnbiNYQtyQDXf5ddUO3UE uA2ZnSzhD1SvihOmluJHAbFg6S5h4V/Pyrr1zDHqU4HmO5D7uIADdlqs8HkiDh8BNM3Q VDbrStQSISx03nB8MiOczu+A5BdpVs3kDidQT8ZeQ7j3WtUt8e7j1294TL5RfSMyDuOm bFKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kwCammK4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9-v6si2096314pln.439.2018.04.10.00.46.42; Tue, 10 Apr 2018 00:46:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kwCammK4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752394AbeDJHqj (ORCPT + 29 others); Tue, 10 Apr 2018 03:46:39 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:41202 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751978AbeDJHqi (ORCPT ); Tue, 10 Apr 2018 03:46:38 -0400 Received: by mail-pl0-f67.google.com with SMTP id bj1-v6so6918578plb.8 for ; Tue, 10 Apr 2018 00:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=w79L65rOvc47yyfbyc4jTlWwancETpryqzoDL61LG5I=; b=kwCammK4xErXLwGBnbi29QSbBL+gPVr01Nn4SJGBRyL7sYrVa8JT3GJrIUjIWKflJ8 NzIWGq2bC1sXTCvs3r+d1LBbDuIruE9PWaV9B5KDnO42WPlgB82XpxuEoc+75NVrG6dB /cJPgx4Cxd0LpUv1S7dfZzEPPUaFAtku7RTdk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=w79L65rOvc47yyfbyc4jTlWwancETpryqzoDL61LG5I=; b=Z+HHou2PmgAT1PArQsgtUpotHQy+vO2y/+Fqy9v5nDGw4mluefDjdawVQ71bMTj7Hy gJBK8S6QF9ruH1pLYzfI+mxDF6bW1TELGXeWILYmk3xHsQcA/S38OzznQ+IayGTILQFY U2LITB44S0xQRgakXZk8nsLadjDCERD/7sCU9bJBgle0uKO/+C+WyoFALMpYgni2oGUs kw7JntXxziKN9Qxdv54gwW9hcIxlh2GFHNSOlW+gUZRPYLb7FMVMriWFh6VfjvRG4cBv iZHG9SRffbyBVnZ/v+lV8/9tGyz0tfORoIGzrdM1kccgYO09K9VRMtiiFQVlOMTbx1Mk MOoQ== X-Gm-Message-State: AElRT7Frkt/d9mok+u+tpZvyTxS8JyIjDrIVJo7TB3G1VqDaoVFmGfdH vxtKl8vcy1sb0NDa1UrrNl615w== X-Received: by 2002:a17:902:a981:: with SMTP id bh1-v6mr43196413plb.255.1523346397860; Tue, 10 Apr 2018 00:46:37 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id x17sm3095279pfm.161.2018.04.10.00.46.35 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 00:46:37 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vinod.koul@intel.com Cc: eric.long@spreadtrum.com, broonie@kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH 1/5] dmaengine: sprd: Define the DMA transfer step type Date: Tue, 10 Apr 2018 15:46:03 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Long Define the DMA transfer step type to make code more readable. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index b106e8a..af9c156 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -169,6 +169,22 @@ enum sprd_dma_int_type { SPRD_DMA_CFGERR_INT, }; +/* + * enum sprd_dma_step: define the DMA transfer step type + * @SPRD_DMA_NONE_STEP: transfer do not need step + * @SPRD_DMA_BYTE_STEP: transfer step is one byte + * @SPRD_DMA_SHORT_STEP: transfer step is two bytes + * @SPRD_DMA_WORD_STEP: transfer step is one word + * @SPRD_DMA_DWORD_STEP: transfer step is double word + */ +enum sprd_dma_step { + SPRD_DMA_NONE_STEP, + SPRD_DMA_BYTE_STEP = BIT(0), + SPRD_DMA_SHORT_STEP = BIT(1), + SPRD_DMA_WORD_STEP = BIT(2), + SPRD_DMA_DWORD_STEP = BIT(3), +}; + /* dma channel hardware configuration */ struct sprd_dma_chn_hw { u32 pause; @@ -598,16 +614,16 @@ static int sprd_dma_config(struct dma_chan *chan, struct sprd_dma_desc *sdesc, if (IS_ALIGNED(len, 4)) { datawidth = 2; - src_step = 4; - des_step = 4; + src_step = SPRD_DMA_WORD_STEP; + des_step = SPRD_DMA_WORD_STEP; } else if (IS_ALIGNED(len, 2)) { datawidth = 1; - src_step = 2; - des_step = 2; + src_step = SPRD_DMA_SHORT_STEP; + des_step = SPRD_DMA_SHORT_STEP; } else { datawidth = 0; - src_step = 1; - des_step = 1; + src_step = SPRD_DMA_BYTE_STEP; + des_step = SPRD_DMA_BYTE_STEP; } fragment_len = SPRD_DMA_MEMCPY_MIN_SIZE;