Skip to contentSkip to conversation

Bypass BAM init if Remotely controlled

PATCH In review Pramod Gurav 5 participants 9 messages Mar 22, 2016 – Apr 5, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Bypass BAM init if Remotely controlled

On some QOCM platforms(eg 8996) BAM control registers are managed remotely hence can not be accessed by application processor for writes. So skip the bam_init for any such platform if DT property is set.

Tested on 8996 (BAM Global control is through remote) and DB410C boards. Tested with i2c DMA on these targets which uses BAM as DMA controller.

Pramod Gurav (2):
dmaengine: qcom_bam_dma: Clear IRQ only if its set
dmaengine: qcom_bam_dma: Bypass BAM init if not managed locally

 .../devicetree/bindings/dma/qcom_bam_dma.txt        |  3 +++
 drivers/dma/qcom/bam_dma.c                          | 21 +++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 7 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH 1/2 dmaengine: qcom_bam_dma: Clear IRQ only if its set

Clear the BAM IRQ bit only if there is a BAM interrupt.

---
 drivers/dma/qcom/bam_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/qcom/bam_dma.c +2 -1
index d5e0a9c..0880345 100644
@@ -807,7 +807,8 @@ static irqreturn_t bam_dma_irq(int irq, void *data)
 	/* don't allow reorder of the various accesses to the BAM registers */
 	mb();
 
-	writel_relaxed(clr_mask, bam_addr(bdev, 0, BAM_IRQ_CLR));
+	if (srcs & BAM_IRQ)
+		writel_relaxed(clr_mask, bam_addr(bdev, 0, BAM_IRQ_CLR));
 
 	return IRQ_HANDLED;
 }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#2 lore raw

PATCH 2/2 dmaengine: qcom_bam_dma: Bypass BAM init if not managed locally

In reply to Pramod Gurav

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.

---
 Documentation/devicetree/bindings/dma/qcom_bam_dma.txt |  3 +++
 drivers/dma/qcom/bam_dma.c                             | 18 +++++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +3 -0
index 1c9d48e..46e33ae 100644
@@ -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
drivers/dma/qcom/bam_dma.c +11 -7
index 0880345..04dd446 100644
@@ -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);
 
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
maintainer
#3 lore raw

Re: [PATCH 2/2] dmaengine: qcom_bam_dma: Bypass BAM init if not managed locally

Quoted 1 line · Pramod Gurav

On some QOCM platforms BAM control registers are managed remotely

s/QOCM/QCOM/

Quoted 2 lines

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.

Is this a property of specific SOCs or a configuration option? If the former, use the SOC specific compatible string to determine this option.

Quoted 14 lines

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

---
 Documentation/devicetree/bindings/dma/qcom_bam_dma.txt |  3 +++
 drivers/dma/qcom/bam_dma.c                             | 18 +++++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +0 -0
index 1c9d48e..46e33ae 100644

Documentation/devicetree/bindings/dma/qcom_bam_dma.txt Required properties: · line 16

Quoted 4 lines
Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +1 -0
@@ -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

Don't use '_' in property names.

Quoted 12 lines
Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +2 -0
+  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
#4 lore raw
In reply to Pramod Gurav
Quoted 6 lines · Pramod Gurav

On some QOCM platforms(eg 8996) BAM control registers are managed remotely hence can not be accessed by application processor for writes. So skip the bam_init for any such platform if DT property is set.

Tested on 8996 (BAM Global control is through remote) and DB410C boards. Tested with i2c DMA on these targets which uses BAM as DMA controller.

I have similar patches at [1] already, could you check them first.

[1] https://lkml.org/lkml/2015/12/1/113

Signature · 6 lines
regards,
Stan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
Quoted 5 lines · Stanimir Varbanov
Quoted 4 lines · Pramod Gurav

On some QOCM platforms(eg 8996) BAM control registers are managed remotely hence can not be accessed by application processor for writes. So skip the bam_init for any such platform if DT property is set.

Quoted 7 lines
Quoted 2 lines

Tested on 8996 (BAM Global control is through remote) and DB410C boards. Tested with i2c DMA on these targets which uses BAM as DMA controller.

I have similar patches at [1] already, could you check them first.

[1] https://lkml.org/lkml/2015/12/1/113

Thanks. I should have known them. Will test them and and provide Tested-by. :)

Regards,
Pramod
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Stanimir Varbanov
Quoted 9 lines · Stanimir Varbanov
Quoted 6 lines · Pramod Gurav

On some QOCM platforms(eg 8996) BAM control registers are managed remotely hence can not be accessed by application processor for writes. So skip the bam_init for any such platform if DT property is set.

Tested on 8996 (BAM Global control is through remote) and DB410C boards. Tested with i2c DMA on these targets which uses BAM as DMA controller.

I have similar patches at [1] already, could you check them first.

was there an update posted on these? I dont have this series or an update in my queue

Signature · 5 lines
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw
Quoted 6 lines · Vinod Koul
Quoted 5 lines · Stanimir Varbanov
Quoted 4 lines · Pramod Gurav

On some QOCM platforms(eg 8996) BAM control registers are managed remotely hence can not be accessed by application processor for writes. So skip the bam_init for any such platform if DT property is set.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Tested on 8996 (BAM Global control is through remote) and DB410C boards. Tested with i2c DMA on these targets which uses BAM as DMA controller.

I have similar patches at [1] already, could you check them first.

was there an update posted on these? I dont have this series or an update in my queue

No updates that I can see. The original is here:

https://lkml.org/lkml/2015/12/1/113

#8 lore raw
Quoted 16 lines · Andy Gross
Quoted 15 lines · Vinod Koul
Quoted 13 lines · Stanimir Varbanov
Quoted 10 lines · Pramod Gurav

On some QOCM platforms(eg 8996) BAM control registers are managed remotely
hence can not be accessed by application processor for writes. So skip the bam_init
for any such platform if DT property is set.

Tested on 8996 (BAM Global control is through remote) and DB410C boards.
Tested with i2c DMA on these targets which uses BAM as DMA controller.

I have similar patches at [1] already, could you check them first.

Quoted 8 lines
Quoted 3 lines

was there an update posted on these? I dont have this series or an update in
my queue

No updates that I can see. The original is here:

https://lkml.org/lkml/2015/12/1/113

And that seemed to have some discussion so I dont recall looking at it.

Signature · 1 line
~Vinod