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: 10620635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED9DE15E8 for ; Sat, 29 Sep 2018 05:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E025B29CEB for ; Sat, 29 Sep 2018 05:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D48F62AFF5; Sat, 29 Sep 2018 05:50:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7399E29CEB for ; Sat, 29 Sep 2018 05:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbeI2MRh (ORCPT ); Sat, 29 Sep 2018 08:17:37 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33685 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727422AbeI2MRU (ORCPT ); Sat, 29 Sep 2018 08:17:20 -0400 Received: by mail-pf1-f195.google.com with SMTP id d4-v6so5696259pfn.0 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=C7H+BsPItPH5ONCMCgLcVsh38GhHLOHwZKnhr31msiEEDcoJ2xOBaG77VcpgFthtYJ b7NR6IKCtkX9Q8qIXYGvP6Rhi44mVyiGClGCN516p7t0nJFfiskBuioDGWS4sLF1uXE/ iBnIqlXaO6HPE/seQtvb3K4xjFYFJJuTycs6zVv2ME3lCP4NNBHdzkQz5mYcVJ3Ilorz HbT1/8/Kyh2wAZNhNFhwKcOgwo79yRfAilIElGr3BFVg9abqcGalJa+8Plr/iel4cAEg 3KBxEIpjHDZAF6p/t4aKiIjzRy4ZNLb6ih5W/hy5hRrF43sLwsXQ+AkVn02q7Ov+Ym+z AiyQ== X-Gm-Message-State: ABuFfogB/iQ4vB+3GI26Add0AmkBP3Wfw3S6QLeBPEsP6PaPIjuiLif2 0EUcUO6agNmAkWAohtl7pLIPGg== X-Google-Smtp-Source: ACcGV602hcoPUC/oDitWjzapQhAeOiaAMD+SKwH+lgtaZXmIr/i5M0+IfNqW7cotmYfdef4NDLMGjw== 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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 */