dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled
@ 2018-01-22  9:55 Srinivas Kandagatla
  0 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2018-01-22  9:55 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Andy Gross, dmaengine, Rob Herring, Mark Rutland, David Brown,
	Dan Williams, devicetree, linux-kernel, linux-arm-msm, linux-soc,
	yanhe, ramkri, sdharia

On 19/01/18 05:55, Vinod Koul wrote:
> On Tue, Jan 16, 2018 at 07:02:34PM +0000, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.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@linaro.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) {
> 
> hmm so if we remove the remotely controlled instanced from DT and then Linux
> won't see them and not do anything. Do we need to do configuration of these
> instances too?
No, bindings "num-channels" and "num-ees" are applicable to remote 
controlled instances only, which is documented in the DT bindings.

Normally these values come from register reads, which are not possible 
in case of remotely controlled instances as BAM driver would not know if 
the remote is powered up or not.

thanks,
srini

> 
>> +		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 dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled
@ 2018-01-29 16:19 Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2018-01-29 16:19 UTC (permalink / raw)
  To: srinivas.kandagatla
  Cc: Vinod Koul, Andy Gross, dmaengine, Mark Rutland, David Brown,
	Dan Williams, devicetree, linux-kernel, linux-arm-msm, linux-soc,
	yanhe, ramkri, sdharia

On Tue, Jan 16, 2018 at 07:02:34PM +0000, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.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@linaro.org>
> ---
>  Documentation/devicetree/bindings/dma/qcom_bam_dma.txt |  2 ++

Reviewed-by: Rob Herring <robh@kernel.org>

>  drivers/dma/qcom/bam_dma.c                             | 13 +++++++++++--
>  2 files changed, 13 insertions(+), 2 deletions(-)
---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled
@ 2018-01-19  5:55 Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2018-01-19  5:55 UTC (permalink / raw)
  To: srinivas.kandagatla
  Cc: Andy Gross, dmaengine, Rob Herring, Mark Rutland, David Brown,
	Dan Williams, devicetree, linux-kernel, linux-arm-msm, linux-soc,
	yanhe, ramkri, sdharia

On Tue, Jan 16, 2018 at 07:02:34PM +0000, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.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@linaro.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) {

hmm so if we remove the remotely controlled instanced from DT and then Linux
won't see them and not do anything. Do we need to do configuration of these
instances too?

> +		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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled
@ 2018-01-16 19:02 Srinivas Kandagatla
  0 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2018-01-16 19:02 UTC (permalink / raw)
  To: Vinod Koul, Andy Gross, dmaengine
  Cc: Rob Herring, Mark Rutland, David Brown, Dan Williams, devicetree,
	linux-kernel, linux-arm-msm, linux-soc, yanhe, ramkri, sdharia,
	Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.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@linaro.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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-29 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22  9:55 [2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled Srinivas Kandagatla
  -- strict thread matches above, loose matches on Subject: below --
2018-01-29 16:19 Rob Herring
2018-01-19  5:55 Vinod Koul
2018-01-16 19:02 Srinivas Kandagatla

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).