devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
To: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Andy Gross <andy.gross-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	David Brown <david.brown-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	yanhe-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org,
	ramkri-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org,
	sdharia-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org,
	Srinivas Kandagatla
	<srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH 2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled
Date: Tue, 16 Jan 2018 19:02:34 +0000	[thread overview]
Message-ID: <20180116190236.14558-3-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20180116190236.14558-1-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

From: Srinivas Kandagatla <srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

When Linux is master of BAM, it can directly read registers to know number
of supported channels, however when its remotely controlled reading these
registers would trigger a crash if the BAM is not yet intialized/powered up
on the remote side.

This patch adds num-channels binding to specify number of supported
dma channels on remotely controlled BAM.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/dma/qcom_bam_dma.txt |  2 ++
 drivers/dma/qcom/bam_dma.c                             | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
index 9cbf5d9df8fd..aa6822cbb230 100644
--- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
+++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
@@ -15,6 +15,8 @@ Required properties:
   the secure world.
 - qcom,controlled-remotely : optional, indicates that the bam is controlled by
   remote proccessor i.e. execution environment.
+- num-channels : optional, indicates supported number of DMA channels in a
+  remotely controlled bam.
 
 Example:
 
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 78e488e8f96d..523bd178047a 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -1083,8 +1083,10 @@ 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;
+	if (!bdev->num_channels) {
+		val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES));
+		bdev->num_channels = val & BAM_NUM_PIPES_MASK;
+	}
 
 	if (bdev->controlled_remotely)
 		return 0;
@@ -1179,6 +1181,13 @@ static int bam_dma_probe(struct platform_device *pdev)
 	bdev->controlled_remotely = of_property_read_bool(pdev->dev.of_node,
 						"qcom,controlled-remotely");
 
+	if (bdev->controlled_remotely) {
+		ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
+					   &bdev->num_channels);
+		if (ret)
+			dev_err(bdev->dev, "num-channels unspecified in dt\n");
+	}
+
 	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
 	if (IS_ERR(bdev->bamclk)) {
 		bdev->bamclk = NULL;
-- 
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-01-16 19:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 19:02 [PATCH 0/4] dmaengine: qcom: bam_dma: fixes for remotely controlled bam srinivas.kandagatla
2018-01-16 19:02 ` [PATCH 1/4] dmaengine: qcom: bam_dma: make bam clk optional srinivas.kandagatla
2018-01-16 19:38   ` Sagar Dharia
2018-01-17  9:46     ` Srinivas Kandagatla
2018-01-19  5:52   ` Vinod Koul
2018-01-22  9:55     ` Srinivas Kandagatla
     [not found]       ` <8dfa8ba1-6e98-a8e4-614c-592861cef571-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-23  9:19         ` Vinod Koul
2018-01-23  9:20           ` Srinivas Kandagatla
2018-01-16 19:02 ` [PATCH 3/4] dmaengine: qcom: bam_dma: do not write to global regs in remote mode srinivas.kandagatla
2018-01-16 19:02 ` [PATCH 4/4] dmaengine: qcom: bam_dma: Add num-ees dt binding for remotely controlled srinivas.kandagatla
     [not found]   ` <20180116190236.14558-5-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-29 16:21     ` Rob Herring
2018-01-30  9:18       ` Srinivas Kandagatla
     [not found] ` <20180116190236.14558-1-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-16 19:02   ` srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A [this message]
2018-01-19  5:55     ` [PATCH 2/4] dmaengine: qcom: bam_dma: add num-channels " Vinod Koul
2018-01-22  9:55       ` Srinivas Kandagatla
     [not found]     ` <20180116190236.14558-3-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-29 16:19       ` Rob Herring
2018-01-17 10:18   ` [PATCH 0/4] dmaengine: qcom: bam_dma: fixes for remotely controlled bam Vinod Koul
2018-01-17 10:55     ` Srinivas Kandagatla
2018-01-17 15:59       ` Vinod Koul

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=20180116190236.14558-3-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=andy.gross-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=david.brown-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=ramkri-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sdharia-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org \
    --cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=yanhe-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org \
    /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).