* [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock
@ 2023-05-18 9:26 Stephan Gerhold
2023-05-18 11:13 ` Bhupesh Sharma
0 siblings, 1 reply; 5+ messages in thread
From: Stephan Gerhold @ 2023-05-18 9:26 UTC (permalink / raw)
To: Vinod Koul
Cc: Bjorn Andersson, Andy Gross, Konrad Dybcio, linux-arm-msm,
dmaengine, linux-kernel, Stephan Gerhold
If we have a BAM clock in the DT we are able to turn on the BAM
controller while probing, so there is no need to read "num-channels"
and "qcom,num-ees" from the DT. It can be read more accurately directly
from the identification registers of the BAM.
This simplifies setting up typical controlled-remotely BAM DMAs in the
DT that can be turned on via a clock (e.g. the BLSP DMA).
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/dma/qcom/bam_dma.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 1e47d27e1f81..4c3eb972039d 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -1272,7 +1272,15 @@ static int bam_dma_probe(struct platform_device *pdev)
bdev->powered_remotely = of_property_read_bool(pdev->dev.of_node,
"qcom,powered-remotely");
- if (bdev->controlled_remotely || bdev->powered_remotely) {
+ if (bdev->controlled_remotely || bdev->powered_remotely)
+ bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk");
+ else
+ bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
+
+ if (IS_ERR(bdev->bamclk))
+ return PTR_ERR(bdev->bamclk);
+
+ if (!bdev->bamclk) {
ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
&bdev->num_channels);
if (ret)
@@ -1284,14 +1292,6 @@ static int bam_dma_probe(struct platform_device *pdev)
dev_err(bdev->dev, "num-ees unspecified in dt\n");
}
- if (bdev->controlled_remotely || bdev->powered_remotely)
- bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk");
- else
- 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");
---
base-commit: 1c677f238f92ba0a329b7c13220f38b396872806
change-id: 20230518-bamclk-dt-d44bae47b337
Best regards,
--
Stephan Gerhold <stephan@gerhold.net>
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock
2023-05-18 9:26 [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock Stephan Gerhold
@ 2023-05-18 11:13 ` Bhupesh Sharma
2023-05-18 11:21 ` Stephan Gerhold
0 siblings, 1 reply; 5+ messages in thread
From: Bhupesh Sharma @ 2023-05-18 11:13 UTC (permalink / raw)
To: Stephan Gerhold
Cc: Vinod Koul, Bjorn Andersson, Andy Gross, Konrad Dybcio,
linux-arm-msm, dmaengine, linux-kernel
Hi Stephan,
On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote:
>
> If we have a BAM clock in the DT we are able to turn on the BAM
> controller while probing, so there is no need to read "num-channels"
> and "qcom,num-ees" from the DT. It can be read more accurately directly
> from the identification registers of the BAM.
>
> This simplifies setting up typical controlled-remotely BAM DMAs in the
> DT that can be turned on via a clock (e.g. the BLSP DMA).
Can you please list which qcom board(s) you tested this patch on?
Thanks,
Bhupesh
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
> drivers/dma/qcom/bam_dma.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index 1e47d27e1f81..4c3eb972039d 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -1272,7 +1272,15 @@ static int bam_dma_probe(struct platform_device *pdev)
> bdev->powered_remotely = of_property_read_bool(pdev->dev.of_node,
> "qcom,powered-remotely");
>
> - if (bdev->controlled_remotely || bdev->powered_remotely) {
> + if (bdev->controlled_remotely || bdev->powered_remotely)
> + bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk");
> + else
> + bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
> +
> + if (IS_ERR(bdev->bamclk))
> + return PTR_ERR(bdev->bamclk);
> +
> + if (!bdev->bamclk) {
> ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
> &bdev->num_channels);
> if (ret)
> @@ -1284,14 +1292,6 @@ static int bam_dma_probe(struct platform_device *pdev)
> dev_err(bdev->dev, "num-ees unspecified in dt\n");
> }
>
> - if (bdev->controlled_remotely || bdev->powered_remotely)
> - bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk");
> - else
> - 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");
>
> ---
> base-commit: 1c677f238f92ba0a329b7c13220f38b396872806
> change-id: 20230518-bamclk-dt-d44bae47b337
>
> Best regards,
> --
> Stephan Gerhold <stephan@gerhold.net>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock
2023-05-18 11:13 ` Bhupesh Sharma
@ 2023-05-18 11:21 ` Stephan Gerhold
2023-05-19 9:10 ` Bhupesh Sharma
0 siblings, 1 reply; 5+ messages in thread
From: Stephan Gerhold @ 2023-05-18 11:21 UTC (permalink / raw)
To: Bhupesh Sharma
Cc: Vinod Koul, Bjorn Andersson, Andy Gross, Konrad Dybcio,
linux-arm-msm, dmaengine, linux-kernel
On Thu, May 18, 2023 at 04:43:57PM +0530, Bhupesh Sharma wrote:
> On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote:
> >
> > If we have a BAM clock in the DT we are able to turn on the BAM
> > controller while probing, so there is no need to read "num-channels"
> > and "qcom,num-ees" from the DT. It can be read more accurately directly
> > from the identification registers of the BAM.
> >
> > This simplifies setting up typical controlled-remotely BAM DMAs in the
> > DT that can be turned on via a clock (e.g. the BLSP DMA).
>
> Can you please list which qcom board(s) you tested this patch on?
>
It works fine at least on MSM8916/DB410c (for blsp_dma) and MDM9607
(blsp_dma and qpic_dma (for NAND)). More testing would be much
appreciated of course!
Personally I don't see much of a risk: If enabling the clock doesn't
actually enable the BAM controller, then the clock probably does not
belong to the BAM in the first place... :)
Thanks,
Stephan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock
2023-05-18 11:21 ` Stephan Gerhold
@ 2023-05-19 9:10 ` Bhupesh Sharma
2023-05-19 10:15 ` Stephan Gerhold
0 siblings, 1 reply; 5+ messages in thread
From: Bhupesh Sharma @ 2023-05-19 9:10 UTC (permalink / raw)
To: Stephan Gerhold
Cc: Vinod Koul, Bjorn Andersson, Andy Gross, Konrad Dybcio,
linux-arm-msm, dmaengine, linux-kernel
On Thu, 18 May 2023 at 16:51, Stephan Gerhold <stephan@gerhold.net> wrote:
>
> On Thu, May 18, 2023 at 04:43:57PM +0530, Bhupesh Sharma wrote:
> > On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote:
> > >
> > > If we have a BAM clock in the DT we are able to turn on the BAM
> > > controller while probing, so there is no need to read "num-channels"
> > > and "qcom,num-ees" from the DT. It can be read more accurately directly
> > > from the identification registers of the BAM.
> > >
> > > This simplifies setting up typical controlled-remotely BAM DMAs in the
> > > DT that can be turned on via a clock (e.g. the BLSP DMA).
> >
> > Can you please list which qcom board(s) you tested this patch on?
> >
>
> It works fine at least on MSM8916/DB410c (for blsp_dma) and MDM9607
> (blsp_dma and qpic_dma (for NAND)). More testing would be much
> appreciated of course!
I tested this yesterday on RB1/RB2, RB5 and saw no improvement, so was wondering
why exactly is this needed and which platforms are impacted.
> Personally I don't see much of a risk: If enabling the clock doesn't
> actually enable the BAM controller, then the clock probably does not
> belong to the BAM in the first place... :)
Right, but I think the commit message needs a bit more clarity to
reflect that it is now proposed to check for the bam_clk presence
earlier in the _probe flow (as compared to earlier).
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock
2023-05-19 9:10 ` Bhupesh Sharma
@ 2023-05-19 10:15 ` Stephan Gerhold
0 siblings, 0 replies; 5+ messages in thread
From: Stephan Gerhold @ 2023-05-19 10:15 UTC (permalink / raw)
To: Bhupesh Sharma
Cc: Vinod Koul, Bjorn Andersson, Andy Gross, Konrad Dybcio,
linux-arm-msm, dmaengine, linux-kernel
On Fri, May 19, 2023 at 02:40:21PM +0530, Bhupesh Sharma wrote:
> On Thu, 18 May 2023 at 16:51, Stephan Gerhold <stephan@gerhold.net> wrote:
> >
> > On Thu, May 18, 2023 at 04:43:57PM +0530, Bhupesh Sharma wrote:
> > > On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote:
> > > >
> > > > If we have a BAM clock in the DT we are able to turn on the BAM
> > > > controller while probing, so there is no need to read "num-channels"
> > > > and "qcom,num-ees" from the DT. It can be read more accurately directly
> > > > from the identification registers of the BAM.
> > > >
> > > > This simplifies setting up typical controlled-remotely BAM DMAs in the
> > > > DT that can be turned on via a clock (e.g. the BLSP DMA).
> > >
> > > Can you please list which qcom board(s) you tested this patch on?
> > >
> >
> > It works fine at least on MSM8916/DB410c (for blsp_dma) and MDM9607
> > (blsp_dma and qpic_dma (for NAND)). More testing would be much
> > appreciated of course!
>
> I tested this yesterday on RB1/RB2, RB5 and saw no improvement, so was wondering
> why exactly is this needed and which platforms are impacted.
>
RB1/RB2 should be able to benefit from this for the cryptobam if you add
the rpmcc clock to it, see my reply in [1].
[1]: https://lore.kernel.org/linux-arm-msm/ZGdLCdSof027mk5u@gerhold.net/
> > Personally I don't see much of a risk: If enabling the clock doesn't
> > actually enable the BAM controller, then the clock probably does not
> > belong to the BAM in the first place... :)
>
> Right, but I think the commit message needs a bit more clarity to
> reflect that it is now proposed to check for the bam_clk presence
> earlier in the _probe flow (as compared to earlier).
>
Sure, I will try to clarify the commit message a bit in v2.
Thanks,
Stephan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-19 10:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-18 9:26 [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock Stephan Gerhold
2023-05-18 11:13 ` Bhupesh Sharma
2023-05-18 11:21 ` Stephan Gerhold
2023-05-19 9:10 ` Bhupesh Sharma
2023-05-19 10:15 ` Stephan Gerhold
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).