From patchwork Thu Sep 19 22:03:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 174103 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1596652ill; Thu, 19 Sep 2019 15:11:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz8INH6tn/CTcDlI0k9WAfCBxdYPjVgDvv9kiDXAmfdmGMWYWKlMVDRGiH6LoR3myAlxSw X-Received: by 2002:aa7:c80e:: with SMTP id a14mr18532401edt.205.1568931066470; Thu, 19 Sep 2019 15:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568931066; cv=none; d=google.com; s=arc-20160816; b=nv8xJbPvVTnRh1u6T7UIx5AHZiLp6D7XPxc1e7AihjHYwBNSmT4m9C+RwqC3AP2mFp bs4HQT+nRHwazN2juugAqUi4yfzIBqsvRFlS8F4rc4olAtvQIVXzlvFS3wCFFybMCdD8 hOA2/X8XsfH9CX56Lsk08kQObSA6HXg3Z8/Cu8Q/nEg4UaI6rPI9t9TdMXlJCUtPdqJt yMXQx9EpI4vjKJ4fVcqYuL2i7J+IKppbHUrKQu2rA8uA8M9V37kG+3LE7s2Ff0SBDPzT R+YRJP9m6tQ+zwS4NBeLm4rc5nR4/V14Vn0+uhoM8B+aWJwSOwT4pYdeLwrSh8+qpl6n cPMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pcn+GOKTNWrFwjXk7v1m0P6r9iL/hVUDzvnxgWCwqvo=; b=NFB3IQDqhlblHxUHxDlh+ToeynKYNOR0c+Ao37VTiU7UKIX6rsbrccQ+0/RHtcrUjH WP5lStG/qRzRZjCcDLlhRfDO2VU80fDSra9MfmrCWvIfJxzUyFAs1HNcmSR+kPtOw8Qs wouUPM/1zWYHSIE5/uULcVBl265RVpzIsAHyQiJI8AGDlMb9xQWecOwIr8Cpt3z3ly4y QfPAzT8uU6d1lKxIYWfb+LuhfIgX8rfwVfWxNi0HLsKOE6ADRzn07Fyl/4/9kG1HxqPt yBssviBREkdQ0oq1YkNVScK1r8sODWexUUdDop7SgWlr9znj9TO2nIzKgwoye4kgX7oh knkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TTvvfKOZ; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si78768eda.104.2019.09.19.15.11.06; Thu, 19 Sep 2019 15:11:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@kernel.org header.s=default header.b=TTvvfKOZ; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405837AbfISWLF (ORCPT + 14 others); Thu, 19 Sep 2019 18:11:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405830AbfISWLE (ORCPT ); Thu, 19 Sep 2019 18:11:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 082EB21920; Thu, 19 Sep 2019 22:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931063; bh=sjobayxK8BQV7kAzsBZ5thsoTl6H6cbirtCozGkDE30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTvvfKOZ0ylUnD5G4TN/8oKr3zVDpD8/Zj9KjRAXkIp+b/V3SjWMAkCbUtGhQ3UCD leV2U38QxZry5l776hMM/Mpw7IciJvTOO4f5viBJ2HturQHrg7gZgEpVYwLOqcRqyl UiQZLrH535tYKWRQ3voW5XPs6k2ZT1rIE3SxAilE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.2 115/124] dmaengine: sprd: Fix the DMA link-list configuration Date: Fri, 20 Sep 2019 00:03:23 +0200 Message-Id: <20190919214823.367143978@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214819.198419517@linuxfoundation.org> References: <20190919214819.198419517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Baolin Wang [ Upstream commit 689379c2f383b1fdfdff03e84cf659daf62f2088 ] 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 Link: https://lore.kernel.org/r/77868edb7aff9d5cb12ac3af8827ef2e244441a6.1567150471.git.baolin.wang@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/sprd-dma.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index baac476c86224..525dc7338fe3b 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -908,6 +908,7 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, } } - 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;