devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pramod Gurav <gpramod@codeaurora.org>
To: andy.gross@linaro.org, linux-kernel@vger.kernel.org
Cc: dmaengine@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, dan.j.williams@intel.com,
	vinod.koul@intel.com, okaya@codeaurora.org,
	architt@codeaurora.org, Pramod Gurav <gpramod@codeaurora.org>
Subject: [PATCH 2/2] dmaengine: qcom_bam_dma: Bypass BAM init if not managed locally
Date: Tue, 22 Mar 2016 15:19:11 +0530	[thread overview]
Message-ID: <1458640151-15150-3-git-send-email-gpramod@codeaurora.org> (raw)
In-Reply-To: <1458640151-15150-1-git-send-email-gpramod@codeaurora.org>

On some QOCM platforms BAM control registers are managed remotely
hence can not be accessed by application processor for writes. Pass
a DT property qcom,bam_ctrl_remote to declare the same to skip bam_init.

Move the pipe number initialisation from bam_init to probe functiom
as it should be done for all platforms.

Signed-off-by: Pramod Gurav <gpramod@codeaurora.org>
---
 Documentation/devicetree/bindings/dma/qcom_bam_dma.txt |  3 +++
 drivers/dma/qcom/bam_dma.c                             | 18 +++++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
index 1c9d48e..46e33ae 100644
--- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
+++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
@@ -13,6 +13,8 @@ Required properties:
 - clock-names: must contain "bam_clk" entry
 - qcom,ee : indicates the active Execution Environment identifier (0-7) used in
   the secure world.
+- qcom,bam_ctrl_remote: Use when BAM global device control is managed remotely
+  and not locally by the application processor.
 
 Example:
 
@@ -24,6 +26,7 @@ Example:
 		clock-names = "bam_clk";
 		#dma-cells = <1>;
 		qcom,ee = <0>;
+		qcom,bam_ctrl_remote;
 	};
 
 DMA clients must use the format described in the dma.txt file, using a two cell
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 0880345..04dd446 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -384,6 +384,7 @@ struct bam_device {
 	struct device_dma_parameters dma_parms;
 	struct bam_chan *channels;
 	u32 num_channels;
+	bool bam_ctrl_remote;
 
 	/* execution environment ID, from DT */
 	u32 ee;
@@ -1036,9 +1037,6 @@ static int bam_init(struct bam_device *bdev)
 	if (bdev->ee >= val)
 		return -EINVAL;
 
-	val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES));
-	bdev->num_channels = val & BAM_NUM_PIPES_MASK;
-
 	/* s/w reset bam */
 	/* after reset all pipes are disabled and idle */
 	val = readl_relaxed(bam_addr(bdev, 0, BAM_CTRL));
@@ -1095,7 +1093,7 @@ static int bam_dma_probe(struct platform_device *pdev)
 	struct bam_device *bdev;
 	const struct of_device_id *match;
 	struct resource *iores;
-	int ret, i;
+	int ret, i, val;
 
 	bdev = devm_kzalloc(&pdev->dev, sizeof(*bdev), GFP_KERNEL);
 	if (!bdev)
@@ -1136,9 +1134,15 @@ static int bam_dma_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = bam_init(bdev);
-	if (ret)
-		goto err_disable_clk;
+	val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES));
+	bdev->num_channels = val & BAM_NUM_PIPES_MASK;
+
+	bdev->bam_ctrl_remote = of_property_read_bool(pdev->dev.of_node,
+						"qcom,bam_ctrl_remote");
+	if (bdev->bam_ctrl_remote != true)
+		ret = bam_init(bdev);
+		if (ret)
+			goto err_disable_clk;
 
 	tasklet_init(&bdev->task, dma_tasklet, (unsigned long)bdev);
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

  parent reply	other threads:[~2016-03-22  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22  9:49 [PATCH 0/2] Bypass BAM init if Remotely controlled Pramod Gurav
2016-03-22  9:49 ` [PATCH 1/2] dmaengine: qcom_bam_dma: Clear IRQ only if its set Pramod Gurav
2016-03-22  9:49 ` Pramod Gurav [this message]
2016-03-23 15:09   ` [PATCH 2/2] dmaengine: qcom_bam_dma: Bypass BAM init if not managed locally Rob Herring
     [not found] ` <1458640151-15150-1-git-send-email-gpramod-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-03-22  9:55   ` [PATCH 0/2] Bypass BAM init if Remotely controlled Stanimir Varbanov
     [not found]     ` <56F116AC.2000704-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2016-03-22 10:36       ` gpramod-sgV2jX0FEOL9JmXXK+q4OQ
2016-04-05 18:19       ` Vinod Koul
2016-04-05 21:21         ` Andy Gross
2016-04-05 21:27           ` Koul, Vinod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458640151-15150-3-git-send-email-gpramod@codeaurora.org \
    --to=gpramod@codeaurora.org \
    --cc=andy.gross@linaro.org \
    --cc=architt@codeaurora.org \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okaya@codeaurora.org \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).