From patchwork Tue Nov 6 05:01:35 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: 10669629 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 33F761709 for ; Tue, 6 Nov 2018 05:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23E1529B9F for ; Tue, 6 Nov 2018 05:02:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 182BA2A0A7; Tue, 6 Nov 2018 05:02: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 B451329B9F for ; Tue, 6 Nov 2018 05:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729160AbeKFOZy (ORCPT ); Tue, 6 Nov 2018 09:25:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36190 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387450AbeKFOZh (ORCPT ); Tue, 6 Nov 2018 09:25:37 -0500 Received: by mail-pf1-f193.google.com with SMTP id j22-v6so5539317pfh.3 for ; Mon, 05 Nov 2018 21:02:15 -0800 (PST) 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=An5a6eraHBGxYnTEnYSGMSvJom+BfCzLpM/xs8uLYjgucl2r1i+avUxJxJy1IhaTCo dis9DzuoqlpgedC8n3Hl66n2OZHtyVZVec8W4yQsZK3iBJg804l4GYJnE8zQ/luHWuG+ cj/XqQjPHZrN7wrF9VErJP6wViuwoIvYgy3WI= 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=rMQqCX+MG8WSlEIn1uyXTAGKGBaaFgW/efGssPort5g/CbdsnyoC4mGVRH2qTu5x/c /pPfbKuMv99ZkicWPpKsLEFSf8iqZCyk+RPSRLTnevlrqyyap+fTCHQa4qRmhKZaBKG7 OiZ7Iz9NULDeNJssz24b29Lz8u8zyxQ631p7zf7wkTkb8gMoUipFV3G+7UF8jENhR7Jb 1A3S6KphAQoeCeks/AdKZ8GEo7axgN/+zn0FqX/T8SVDv/goOSe9+JdlefKDLsKVl/dI 6zMgT0a+pqgDyahqzbmsgxzTXGuAunQ/OTQqY0BXvusB8PJbCVbuTTcCWenV+3z/OWFi aurQ== X-Gm-Message-State: AGRZ1gIpTAv5Dt48nGynmkddkkpapdZYWtg2eq9fkRUOHX7+Y6CUTHFt 65T+MMC1w2jlKKDEDzNTBYsOsg== X-Google-Smtp-Source: AJdET5dvBKAnHb67r0s6mpcLRbrYJQH0L+XsOIks/k74LWc/D6SbP0S8Mbg/dq7fCM1TU62ZoyDPUw== X-Received: by 2002:a63:d157:: with SMTP id c23mr6593019pgj.170.1541480534703; Mon, 05 Nov 2018 21:02:14 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id o7-v6sm55735416pfb.23.2018.11.05.21.02.12 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 21:02:14 -0800 (PST) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org, eric.long@unisoc.com Cc: broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH 5/7] dmaengine: sprd: Support DMA link-list cyclic callback Date: Tue, 6 Nov 2018 13:01:35 +0800 Message-Id: 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 */