dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-17  9:46 Srinivas Kandagatla
  0 siblings, 0 replies; 7+ messages in thread
From: Srinivas Kandagatla @ 2018-01-17  9:46 UTC (permalink / raw)
  To: Sagar Dharia, 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

On 16/01/18 19:38, Sagar Dharia wrote:
> 
> On 1/16/2018 12:02 PM, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> When BAM is remotely controlled it does not sound correct to control
>> its clk on Linux side. Make it optional, so that its not madatory
>> for remote controlled BAM instances.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   drivers/dma/qcom/bam_dma.c | 15 ++++++++-------
>>   1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
>> index 03c4eb3fd314..78e488e8f96d 100644
>> --- a/drivers/dma/qcom/bam_dma.c
>> +++ b/drivers/dma/qcom/bam_dma.c
>> @@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct 
>> platform_device *pdev)
>>                           "qcom,controlled-remotely");
>>       bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
>> -    if (IS_ERR(bdev->bamclk))
>> -        return PTR_ERR(bdev->bamclk);
>> -
>> -    ret = clk_prepare_enable(bdev->bamclk);
>> -    if (ret) {
>> -        dev_err(bdev->dev, "failed to prepare/enable clock\n");
>> -        return ret;
>> +    if (IS_ERR(bdev->bamclk)) {
>> +        bdev->bamclk = NULL;
>> +    } else {
>> +        ret = clk_prepare_enable(bdev->bamclk);
>> +        if (ret) {
>> +            dev_err(bdev->dev, "failed to prepare/enable clock\n");
>> +            return ret;
>> +        }
> I believe you can also keep pm_runtime disabled if BAM is remotely 
> controlled.

Yes, that's another topic which should be fixed too. I will add that 
patch in next version.

thanks,
srini
> 
> Thanks
> Sagar
>>       }
>>       ret = bam_init(bdev);
>
---
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] 7+ messages in thread
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-23  9:20 Srinivas Kandagatla
  0 siblings, 0 replies; 7+ messages in thread
From: Srinivas Kandagatla @ 2018-01-23  9:20 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 23/01/18 09:19, Vinod Koul wrote:
> On Mon, Jan 22, 2018 at 09:55:01AM +0000, Srinivas Kandagatla wrote:
> 
>>>> @@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct platform_device *pdev)
>>>>   						"qcom,controlled-remotely");
>>>>   	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
>>>
>>> but you still do clk_get unconditionally?
>>
>> Only reason to do this way is to not break existing users in the mainline.
>>
>> remotely controlled BAM is already supported in upstream driver, there are
>> users of this who pass clk from device tree, If I make this conditional then
>> subsequent reads to the BAM registers for those instances might crash the
>> system.
> 
> But these instances are remote controlled, so if we stop representing them
> in Linux, why would we read them?

Plan is that we would transition those users once we get these 
bindings/changes in. Currently I don't have access to any of those 
devices so I made the changes safe, such that it does not break devices 
on mainline.

--srini

>
---
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] 7+ messages in thread
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-23  9:19 Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2018-01-23  9:19 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 Mon, Jan 22, 2018 at 09:55:01AM +0000, Srinivas Kandagatla wrote:

> >>@@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct platform_device *pdev)
> >>  						"qcom,controlled-remotely");
> >>  	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
> >
> >but you still do clk_get unconditionally?
> 
> Only reason to do this way is to not break existing users in the mainline.
> 
> remotely controlled BAM is already supported in upstream driver, there are
> users of this who pass clk from device tree, If I make this conditional then
> subsequent reads to the BAM registers for those instances might crash the
> system.

But these instances are remote controlled, so if we stop representing them
in Linux, why would we read them?

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-22  9:55 Srinivas Kandagatla
  0 siblings, 0 replies; 7+ 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:52, Vinod Koul wrote:
> On Tue, Jan 16, 2018 at 07:02:33PM +0000, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> When BAM is remotely controlled it does not sound correct to control
>> its clk on Linux side. Make it optional, so that its not madatory
> 
> s/madatory/mandatory
> 
Yep,
>> for remote controlled BAM instances.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   drivers/dma/qcom/bam_dma.c | 15 ++++++++-------
>>   1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
>> index 03c4eb3fd314..78e488e8f96d 100644
>> --- a/drivers/dma/qcom/bam_dma.c
>> +++ b/drivers/dma/qcom/bam_dma.c
>> @@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct platform_device *pdev)
>>   						"qcom,controlled-remotely");
>>   
>>   	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
> 
> but you still do clk_get unconditionally?

Only reason to do this way is to not break existing users in the mainline.

remotely controlled BAM is already supported in upstream driver, there 
are users of this who pass clk from device tree, If I make this 
conditional then subsequent reads to the BAM registers for those 
instances might crash the system.

This sounds wrong to control clk from linux for the dma controller which 
is remotely controlled. These users should be transitioned to new 
bindings once the new bindings endup in the mainline.

> 
>> -	if (IS_ERR(bdev->bamclk))
>> -		return PTR_ERR(bdev->bamclk);
>> -
>> -	ret = clk_prepare_enable(bdev->bamclk);
>> -	if (ret) {
>> -		dev_err(bdev->dev, "failed to prepare/enable clock\n");
>> -		return ret;
>> +	if (IS_ERR(bdev->bamclk)) {
>> +		bdev->bamclk = NULL;
>> +	} else {
>> +		ret = clk_prepare_enable(bdev->bamclk);
>> +		if (ret) {
>> +			dev_err(bdev->dev, "failed to prepare/enable clock\n");
>> +			return ret;
>> +		}
> 
> wouldn't it be better to set that an instance is remote controlled and thus
> not at all visible to Linux?

We already have a flag "controlled_remotely" for that in the driver.

thanks,
srini
> 
>>   	}
>>   
>>   	ret = bam_init(bdev);
>> -- 
>> 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
>
---
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] 7+ messages in thread
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-19  5:52 Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2018-01-19  5:52 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:33PM +0000, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> When BAM is remotely controlled it does not sound correct to control
> its clk on Linux side. Make it optional, so that its not madatory

s/madatory/mandatory

> for remote controlled BAM instances.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/dma/qcom/bam_dma.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index 03c4eb3fd314..78e488e8f96d 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct platform_device *pdev)
>  						"qcom,controlled-remotely");
>  
>  	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");

but you still do clk_get unconditionally?

> -	if (IS_ERR(bdev->bamclk))
> -		return PTR_ERR(bdev->bamclk);
> -
> -	ret = clk_prepare_enable(bdev->bamclk);
> -	if (ret) {
> -		dev_err(bdev->dev, "failed to prepare/enable clock\n");
> -		return ret;
> +	if (IS_ERR(bdev->bamclk)) {
> +		bdev->bamclk = NULL;
> +	} else {
> +		ret = clk_prepare_enable(bdev->bamclk);
> +		if (ret) {
> +			dev_err(bdev->dev, "failed to prepare/enable clock\n");
> +			return ret;
> +		}

wouldn't it be better to set that an instance is remote controlled and thus
not at all visible to Linux?

>  	}
>  
>  	ret = bam_init(bdev);
> -- 
> 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] 7+ messages in thread
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-16 19:38 Sagar Dharia
  0 siblings, 0 replies; 7+ messages in thread
From: Sagar Dharia @ 2018-01-16 19:38 UTC (permalink / raw)
  To: srinivas.kandagatla, 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

On 1/16/2018 12:02 PM, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
> When BAM is remotely controlled it does not sound correct to control
> its clk on Linux side. Make it optional, so that its not madatory
> for remote controlled BAM instances.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>   drivers/dma/qcom/bam_dma.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index 03c4eb3fd314..78e488e8f96d 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct platform_device *pdev)
>   						"qcom,controlled-remotely");
>   
>   	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
> -	if (IS_ERR(bdev->bamclk))
> -		return PTR_ERR(bdev->bamclk);
> -
> -	ret = clk_prepare_enable(bdev->bamclk);
> -	if (ret) {
> -		dev_err(bdev->dev, "failed to prepare/enable clock\n");
> -		return ret;
> +	if (IS_ERR(bdev->bamclk)) {
> +		bdev->bamclk = NULL;
> +	} else {
> +		ret = clk_prepare_enable(bdev->bamclk);
> +		if (ret) {
> +			dev_err(bdev->dev, "failed to prepare/enable clock\n");
> +			return ret;
> +		}
I believe you can also keep pm_runtime disabled if BAM is remotely 
controlled.

Thanks
Sagar
>   	}
>   
>   	ret = bam_init(bdev);
---
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] 7+ messages in thread
* [1/4] dmaengine: qcom: bam_dma: make bam clk optional
@ 2018-01-16 19:02 Srinivas Kandagatla
  0 siblings, 0 replies; 7+ 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 BAM is remotely controlled it does not sound correct to control
its clk on Linux side. Make it optional, so that its not madatory
for remote controlled BAM instances.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/dma/qcom/bam_dma.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 03c4eb3fd314..78e488e8f96d 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -1180,13 +1180,14 @@ static int bam_dma_probe(struct platform_device *pdev)
 						"qcom,controlled-remotely");
 
 	bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
-	if (IS_ERR(bdev->bamclk))
-		return PTR_ERR(bdev->bamclk);
-
-	ret = clk_prepare_enable(bdev->bamclk);
-	if (ret) {
-		dev_err(bdev->dev, "failed to prepare/enable clock\n");
-		return ret;
+	if (IS_ERR(bdev->bamclk)) {
+		bdev->bamclk = NULL;
+	} else {
+		ret = clk_prepare_enable(bdev->bamclk);
+		if (ret) {
+			dev_err(bdev->dev, "failed to prepare/enable clock\n");
+			return ret;
+		}
 	}
 
 	ret = bam_init(bdev);

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

end of thread, other threads:[~2018-01-23  9:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-17  9:46 [1/4] dmaengine: qcom: bam_dma: make bam clk optional Srinivas Kandagatla
  -- strict thread matches above, loose matches on Subject: below --
2018-01-23  9:20 Srinivas Kandagatla
2018-01-23  9:19 Vinod Koul
2018-01-22  9:55 Srinivas Kandagatla
2018-01-19  5:52 Vinod Koul
2018-01-16 19:38 Sagar Dharia
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).