From patchwork Fri Aug 30 07:37:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 172678 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp250722ily; Fri, 30 Aug 2019 00:38:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRrT216sHhZWipXBHnT4DTF8h0/Xsk9e1ooYSTWQiVa1OVihipBM4DX56fo4p9rww0Aejp X-Received: by 2002:a63:2a08:: with SMTP id q8mr11746639pgq.415.1567150694689; Fri, 30 Aug 2019 00:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567150694; cv=none; d=google.com; s=arc-20160816; b=jGY4/w2t6vn28nYACvLUY8dhA1Ka8Xxma3HU98It80iCKY3xtf698QAngL58JNKazV s3Z5KPXY0w1CefTZzhqnXsuzpPD6xrUWCsvJUki2iGnavSMS2uzimy1E87rSK3jc9ecS FSBnCUZ4WI3M2AunyV4/qN7kzlDR7Ia94gAnIydfGahZpwt1StxJh3PRfDhVCG/YmHlo xkaGijLewSUd+zNiMAuE13/lkowGgfOm0Kx1bh+PXfGsjUBQlROI3TLZHk0oxy62H5mF +hL+ohECJxNIewn6KaxHnMoTFAoCgfkrPJzkxHGBpP4E7M3qWQODos/9L2RRKmfZoslc gojg== 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; bh=v5xyixMQpdnvsR85DjQFgmM24utx1QoiwCBrTyF/frg=; b=fOzvTd6Q1c4zw06wFGTdpbtYuOYSW1kefuesn+Q32q6EMqQOmpNTNdW5DS+CdgNduW ucADECTH/FOwsuF9MA8qe5wJRLXUbi5PhZQG5qevRWGhXkJHZhGMvTXb/D85U1MtCuQp d8oKOWUSAkRtEKufFQS+YQItcLA7bsCUuar0ZY009STSXInTc0kpw6y3L5+tkgcTv5TX d9GbQuGtSvXj7Px3XBlh8L7Gi5eZhCNSHfZ7RQ5r3Dqh+Ro/nXYsch+vWGYW5UDkA8Kj +8e10NrSHrqoKe2enRuU0JW/SUq2l8AZCztH3ymATsCaBRWHPwLpsQn/hr6Dv7hFn3YV AS+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Grs7Mr/k"; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-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 l65si4108591plb.312.2019.08.30.00.38.14; Fri, 30 Aug 2019 00:38:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dmaengine-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="Grs7Mr/k"; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-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 S1727671AbfH3HiO (ORCPT + 3 others); Fri, 30 Aug 2019 03:38:14 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42481 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbfH3HiN (ORCPT ); Fri, 30 Aug 2019 03:38:13 -0400 Received: by mail-pg1-f193.google.com with SMTP id p3so3094227pgb.9 for ; Fri, 30 Aug 2019 00:38:13 -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=v5xyixMQpdnvsR85DjQFgmM24utx1QoiwCBrTyF/frg=; b=Grs7Mr/kb+erqCA+QcT/K0ygk8yUOU+cOayf7fRm/iYs/sK5SMsg/Nhkyw28NnPaeB njw6NpYe7ZN1z/SJOj/32nI9QCSXsEPPAopB39aBmH/nckAImHnf8bMbqOo0abLy+KiA wzSU+G0/Chy4UekpPbEl6lx05fTwPT8hDhE15+IGk3v9XoUV49tzu7KE+pKHYcP/UARf hPJx9MAuJrbPgUgnKxWuER0p+qoUWRZvt8OPkh6wW+on69na7borZhEuOwbZ/zz0FTI2 jNEtyZw7QBWGb+VSH5SEvu8AkmuDPgIO23O+TOstZytvgQIyYEXDP9fIUAbK95pi6nxn MLMw== 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=v5xyixMQpdnvsR85DjQFgmM24utx1QoiwCBrTyF/frg=; b=Zl/t1tvBv1pszsCYuKndZyPNsciG6ngswUvAY3llY44pzEZ1iPjUfMUa4mioNzC+Zx YvsEeySSQGelWoXq2DFbHZz86b8V0uZHCblJv8US3YKKnDfOvPNq/GxMCPqg4yjmyef1 vnd1MSl+ZxzwK1Fa44/56arZPJA1ruWDHSgcs5dY/8P5CS61vzvc8peNcwgwTjYYouMl pOUzKACV+P06UQztvj7LzgmQHG1mQoysjkBkFX3NbGH4FA5DiPyz1kIxsrukZ0FVG7R4 dFkyRWu/Dfs6ETFIYZ9lGzI1tCwE6ZkRqgWB0MUVTAuC+jdqv9IdJi7HeotoS13fIWQC iFQQ== X-Gm-Message-State: APjAAAWvQrdxRAgjWGYdz1hLpw1mAzCXHQvbC02BRpjq8qlCRg/tWK00 jlah8pHeBNcluvogykzTclcjFQ== X-Received: by 2002:a62:641:: with SMTP id 62mr16324411pfg.55.1567150693260; Fri, 30 Aug 2019 00:38:13 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id k8sm4036197pgm.14.2019.08.30.00.38.10 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Aug 2019 00:38:12 -0700 (PDT) From: Baolin Wang To: vkoul@kernel.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, dan.j.williams@intel.com, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, eric.long@unisoc.com, baolin.wang@linaro.org Subject: [PATCH] dmaengine: sprd: Fix the DMA link-list configuration Date: Fri, 30 Aug 2019 15:37:45 +0800 Message-Id: <77868edb7aff9d5cb12ac3af8827ef2e244441a6.1567150471.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org For the Spreadtrum DMA link-list mode, when the DMA engine got a slave hardware request, which will trigger the DMA engine to load the DMA configuration from the link-list memory automatically. But before the slave hardware request, the slave will get an incorrect residue due to the first node used to trigger the link-list was configured as the last source address and destination address. Thus we should make sure the first node was configured the start source address and destination address, which can fix this issue. Fixes: 4ac695464763 ("dmaengine: sprd: Support DMA link-list mode") Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index baac476..525dc73 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -908,6 +908,7 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan, struct sprd_dma_chn *schan = to_sprd_dma_chan(chan); struct dma_slave_config *slave_cfg = &schan->slave_cfg; dma_addr_t src = 0, dst = 0; + dma_addr_t start_src = 0, start_dst = 0; struct sprd_dma_desc *sdesc; struct scatterlist *sg; u32 len = 0; @@ -954,6 +955,11 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan, dst = sg_dma_address(sg); } + if (!i) { + start_src = src; + start_dst = dst; + } + /* * The link-list mode needs at least 2 link-list * configurations. If there is only one sg, it doesn't @@ -970,8 +976,8 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan, } } - ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, src, dst, len, - dir, flags, slave_cfg); + ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, start_src, + start_dst, len, dir, flags, slave_cfg); if (ret) { kfree(sdesc); return NULL;