dmaengine: qcom: bam_dma: allow omitting num-{channels,ees}
authorStephan Gerhold <stephan@gerhold.net>
Fri, 19 May 2023 11:00:13 +0000 (13:00 +0200)
committerVinod Koul <vkoul@kernel.org>
Wed, 24 May 2023 06:52:43 +0000 (12:22 +0530)
commit8975dd41a9dbca3b47f7b8dac5bc4dfb23011000
tree62914cc2379b9f1f73d38e9b37215db4958561db
parent353d5c241e83c4de04ca5ec0d7922bfb0809aa25
dmaengine: qcom: bam_dma: allow omitting num-{channels,ees}

The bam_dma driver needs to know the number of channels and execution
environments (EEs) at probe time. If we are in full control of the BAM
controller this information can be obtained from the BAM identification
registers (BAM_REVISION/BAM_NUM_PIPES).

When the BAM is "controlled remotely" it is more complicated. The BAM
might not be on at probe time, so reading the registers could fail.
This is why the information must be added to the device tree in this
case, using "num-channels" and "qcom,num-ees".

However, there are also some BAM instances that are initialized by
something else but we still have a clock that allows to turn it on when
needed. This can be set up in the DT with "qcom,controlled-remotely"
and "clocks" and is already supported by the bam_dma driver. Examples
for this are the typical BLSP BAM instances on older SoCs, QPIC BAM
(for NAND) and the crypto BAM on some SoCs.

In this case, there is no need to read "num-channels" and
"qcom,num-ees" from the DT. The BAN can be turned on using the clock
so we can just read it from the BAM registers like in the normal case.

Check for the BAM clock earlier and skip reading "num-channels" and
"qcom,num-ees" if it is present to allow simplifying the DT description
a bit.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Link: https://lore.kernel.org/r/20230518-bamclk-dt-v2-1-a1a857b966ca@gerhold.net
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/qcom/bam_dma.c