Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1285679pxu; Thu, 17 Dec 2020 06:39:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmvMaoWyklxonaIGU3XrL3nD5qC+/qVw9cTdjOO7p+2WSJjuzHSZgDNP3Uabh2iKaH+MMV X-Received: by 2002:a50:ab51:: with SMTP id t17mr39317981edc.89.1608215990399; Thu, 17 Dec 2020 06:39:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608215990; cv=none; d=google.com; s=arc-20160816; b=Vy86t5QOoAokhNGQMX8GXaUkqDk3gRX9Gze4rIb2inL7kijKnRrxUiwgaM0jSTsHzB vL0NLY2ymtvH0+Z6ECN+dS/ApO0iV9iRCeUpiznPc1AKHlorkTb3tPW9j6DEI+8jKRwY vnpF8lvpxMpX1wyI4+PuhSzXtL+/CmJWFO2IZWxH3TaoDZzrBs7f/Jc/BLbPMuyEDWET 1msip5+pinhkV696XW6yGlO8Y2hpShClRSiZ3MFwZ10dnZm/JNN4Ab2Zfd2wGLKj+8ne L4QduQDdzr9+q6s5np2yZFVsCIcBRDi4TMdtRF0lNnwL7U8pKL50pLruG0O/cENnX3Hw yeTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=BXHfLJEmgFw3rHQ5rd6+iFX+9OgKJAkLgmW1nuwU/Do=; b=l4i9Ic7aVWUwsVGFzhl+K9Kg5J4vtlGhNEhSrGJ/0pN/cvBPYXSDEFI1NMy7qWTEJi Vq3zzxg3XUeHkrdN/VXSF0EGRilObBQ44T2vbZuj1hTCzOAGGIc+1NFzb+rnee0O45mG UGtOukNJye4oqZ34Mre8cgcmyTCzBaEPN8lrdPb85po7izAxda/reZWACzxic1KKcMp2 CpLIxx3pOeabOaAo57i+SiDRTrtkVYe74iMEJmerhWtIqXyRhY2qEdNiSkBdjId2qU12 FbJ6XMmvQ1b6dvaPPsOX+9Nax2LF6AxuYrPtbT+v9Z187GRdYt73oZHiGRxsJWeoY3f+ vBaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si3148438ejr.339.2020.12.17.06.39.26; Thu, 17 Dec 2020 06:39:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728431AbgLQOid (ORCPT + 99 others); Thu, 17 Dec 2020 09:38:33 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:60663 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbgLQOid (ORCPT ); Thu, 17 Dec 2020 09:38:33 -0500 Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 17 Dec 2020 06:37:52 -0800 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 17 Dec 2020 06:37:50 -0800 X-QCInternal: smtphost Received: from mdalam-linux.qualcomm.com ([10.201.2.71]) by ironmsg01-blr.qualcomm.com with ESMTP; 17 Dec 2020 20:07:28 +0530 Received: by mdalam-linux.qualcomm.com (Postfix, from userid 466583) id B1A7F219ED; Thu, 17 Dec 2020 20:07:26 +0530 (IST) From: Md Sadre Alam To: vkoul@kernel.org, corbet@lwn.net, agross@kernel.org, bjorn.andersson@linaro.org, dan.j.williams@intel.com, dmaengine@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: mdalam@codeaurora.org, sricharan@codeaurora.org Subject: [PATCH] dmaengine: qcom: bam_dma: Add LOCK and UNLOCK flag bit support Date: Thu, 17 Dec 2020 20:07:22 +0530 Message-Id: <1608215842-15381-1-git-send-email-mdalam@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change will add support for LOCK & UNLOCK flag bit support on CMD descriptor. If DMA_PREP_LOCK flag passed in prep_slave_sg then requester of this transaction wanted to lock the DMA controller for this transaction so BAM driver should set LOCK bit for the HW descriptor. If DMA_PREP_UNLOCK flag passed in prep_slave_sg then requester of this transaction wanted to unlock the DMA controller.so BAM driver should set UNLOCK bit for the HW descriptor. Signed-off-by: Md Sadre Alam --- Documentation/driver-api/dmaengine/provider.rst | 9 +++++++++ drivers/dma/qcom/bam_dma.c | 9 +++++++++ include/linux/dmaengine.h | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst index ddb0a81..d7516e2 100644 --- a/Documentation/driver-api/dmaengine/provider.rst +++ b/Documentation/driver-api/dmaengine/provider.rst @@ -599,6 +599,15 @@ DMA_CTRL_REUSE - This flag is only supported if the channel reports the DMA_LOAD_EOT capability. +- DMA_PREP_LOCK + + - If set , the client driver tells DMA controller I am locking you for + this transcation. + +- DMA_PREP_UNLOCK + + - If set, the client driver will tells DMA controller I am releasing the lock + General Design Notes ==================== diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 4eeb8bb..cdbe395 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -58,6 +58,8 @@ struct bam_desc_hw { #define DESC_FLAG_EOB BIT(13) #define DESC_FLAG_NWD BIT(12) #define DESC_FLAG_CMD BIT(11) +#define DESC_FLAG_LOCK BIT(10) +#define DESC_FLAG_UNLOCK BIT(9) struct bam_async_desc { struct virt_dma_desc vd; @@ -644,6 +646,13 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan, /* fill in temporary descriptors */ desc = async_desc->desc; + if (flags & DMA_PREP_CMD) { + if (flags & DMA_PREP_LOCK) + desc->flags |= cpu_to_le16(DESC_FLAG_LOCK); + if (flags & DMA_PREP_UNLOCK) + desc->flags |= cpu_to_le16(DESC_FLAG_UNLOCK); + } + for_each_sg(sgl, sg, sg_len, i) { unsigned int remainder = sg_dma_len(sg); unsigned int curr_offset = 0; diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index dd357a7..79ccadb4 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -190,6 +190,9 @@ struct dma_interleaved_template { * transaction is marked with DMA_PREP_REPEAT will cause the new transaction * to never be processed and stay in the issued queue forever. The flag is * ignored if the previous transaction is not a repeated transaction. + * @DMA_PREP_LOCK: tell the driver that DMA HW engine going to be locked for this + * transaction , until not seen DMA_PREP_UNLOCK flag set. + * @DMA_PREP_UNLOCK: tell the driver to unlock the DMA HW engine. */ enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0), @@ -202,6 +205,8 @@ enum dma_ctrl_flags { DMA_PREP_CMD = (1 << 7), DMA_PREP_REPEAT = (1 << 8), DMA_PREP_LOAD_EOT = (1 << 9), + DMA_PREP_LOCK = (1 << 10), + DMA_PREP_UNLOCK = (1 << 11), }; /** -- 2.7.4