From patchwork Sat Sep 29 05:49: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: 147819 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1575344lji; Fri, 28 Sep 2018 22:50:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV61cWPWYM7WGvuXl88bJIhPfMHq1hp2V0EpxL1US3XVHy5Bq5HTYt1ay/Wlx/DdcZOyyo3Is X-Received: by 2002:a63:cf0e:: with SMTP id j14-v6mr1555118pgg.195.1538200219262; Fri, 28 Sep 2018 22:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538200219; cv=none; d=google.com; s=arc-20160816; b=reAj7kBFdPh6qcATUpjYI+ooq/glZI337rT71d8f9e5EYp5AyxqbVGF1/ATNKjxAhE 99kZc7BSM6czWs01j99LjRK3Ix6q91OuKAeMjQS2ESrAqj7kDogng2w995uLQi1fK9fq XLc94oFGBDSrwJoax+vkyRlc1Pzpu1ZES8h5zWgR0fv36VKuiwqoSLAKWQdoA7k5hF5j u1D1gBH8uHlA5zcUVqG7BzgIzY6muUpaIU5rOAssY2ZBkdpQqpm+G8LsmZFOa/+1eMuf qLkKAJS2pKn8TdrU0aSZtQbIsmSlMstEDCUwrD2SZbvjioMqjd4OaTKgyT1UjQLUDR9S Nt6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Ig1u0SVMDYDTOMNzrGMHK+hoBj16/oLyBxKtaJt37JU=; b=yMOQarWcSjTflW81ykA3kz2+F15rK22G7RV/N/xoRF9ZGmxDT9Tk1jZ6PwIuJWkhhR L9Ah79d1Xjmjo0XPBN76yDAUFCE9WnC3uNlCJGwTA3zgvESo/bYNXrEfwegH/5PJBwFc n3HOR2qiIT7WajIO/aFcn0aEdf9wi2N9eV3ZDRk+hAqnGExDHunk1melufR9cpayD3p6 hmPwfu4aHgqqpPgm4a47AXTA3F0iJ368gtPxJeOe5fXiIISW0NJWqmfrgh8DqGCjZUht Vg8VtXRFZSsZ7i5Ijeu7liKCfOoLD6C8aRT/yvfPaGe48sAc2qyCbp3oSuxvYLDraiiv ZUmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XezMXmNa; 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 d37-v6si7031796pla.40.2018.09.28.22.50.18; Fri, 28 Sep 2018 22:50:19 -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=XezMXmNa; 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 S1727604AbeI2MRU (ORCPT + 32 others); Sat, 29 Sep 2018 08:17:20 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35850 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727393AbeI2MRT (ORCPT ); Sat, 29 Sep 2018 08:17:19 -0400 Received: by mail-pg1-f196.google.com with SMTP id f18-v6so2382002pgv.3 for ; Fri, 28 Sep 2018 22:50:16 -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:in-reply-to:references :in-reply-to:references; bh=Ig1u0SVMDYDTOMNzrGMHK+hoBj16/oLyBxKtaJt37JU=; b=XezMXmNaRKQSJ6O7CK0Mc2+4mFLPQOgXEpsEsnVB2F5WItgYc+VNlacf3o5VCqZ3fZ elgzCOz+EIsJuwUJRO8e04u0P/T/zGFB8JU4R62W9ITRWYlnVAr6Azz4CvLNV64/FPsa si1S4opSex+TcxopZgf4dsOrYXQq5Up/JCEnM= 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:in-reply-to :references:in-reply-to:references; bh=Ig1u0SVMDYDTOMNzrGMHK+hoBj16/oLyBxKtaJt37JU=; b=gcvk2tVMVZAl+5P0/cw+WAFpXqwVcTfyK5cUYixJolmT8vUXcWTt7R4B/RnScUolOc Z3eXRU/MxrmYL5PwzIxS5w46+DD7WuLllb3pcTgdAYfqtyNe4tjrZ4jsHnowNL0X6BI4 a6ILRcuhmartVUsLQRp2anyl+kiSUnL5UQV7Hg47JcrIxalIHJmWqyP5kvFvDv7tDeRt VG/gm31fNIBqRdBQOaMoQzgVZHwqCBMTSJ9Y2cjCJL9eXZwnwZr4Mti0SeQGD/qlwRvP KnzK+cDWgLRvzX1j/GHAGeiSMxHDvl5qXQhFJNwqvEbLA94iQxe/KSDfKl/oIvFX3U0/ uW0g== X-Gm-Message-State: ABuFfojE/Qg14DDmr1xcQwBtr4Jh42Gf2WjKcklscslyYvlBNpQZEiVA 56cfvIGav5rwJVFYjZx8wfUXpg== X-Received: by 2002:a17:902:585:: with SMTP id f5-v6mr1718464plf.7.1538200215637; Fri, 28 Sep 2018 22:50:15 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id i80-v6sm11118049pfi.87.2018.09.28.22.50.12 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Sep 2018 22:50:14 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org, eric.long@spreadtrum.com Cc: broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] dmaengine: sprd: Support DMA link-list cyclic callback Date: Sat, 29 Sep 2018 13:49:03 +0800 Message-Id: <5512ed9fc0c63cd05a56defd79ab3b6a60a8acb1.1538199697.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Long The Spreadtrum DMA link-list mode is always one cyclic transfer, so we should clear the SPRD_DMA_LLIST_END flag for the link-list configuration. Moreover add cyclic callback support for the cyclic transfer. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 1b39661..cefe42f 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -463,7 +463,7 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) struct sprd_dma_desc *sdesc; enum sprd_dma_req_mode req_type; enum sprd_dma_int_type int_type; - bool trans_done = false; + bool trans_done = false, cyclic = false; u32 i; while (irq_status) { @@ -478,13 +478,19 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) sdesc = schan->cur_desc; - /* Check if the dma request descriptor is done. */ - trans_done = sprd_dma_check_trans_done(sdesc, int_type, - req_type); - if (trans_done == true) { - vchan_cookie_complete(&sdesc->vd); - schan->cur_desc = NULL; - sprd_dma_start(schan); + /* cyclic mode schedule callback */ + cyclic = schan->linklist.phy_addr ? true : false; + if (cyclic == true) { + vchan_cyclic_callback(&sdesc->vd); + } else { + /* Check if the dma request descriptor is done. */ + trans_done = sprd_dma_check_trans_done(sdesc, int_type, + req_type); + if (trans_done == true) { + vchan_cookie_complete(&sdesc->vd); + schan->cur_desc = NULL; + sprd_dma_start(schan); + } } spin_unlock(&schan->vc.lock); } @@ -692,9 +698,6 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, /* link-list configuration */ if (schan->linklist.phy_addr) { - if (sg_index == sglen - 1) - hw->frg_len |= SPRD_DMA_LLIST_END; - hw->cfg |= SPRD_DMA_LINKLIST_EN; /* link-list index */