Skip to content

Commit 8975dd4

Browse files
stephan-ghvinodkoul
authored andcommitted
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>
1 parent 353d5c2 commit 8975dd4

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

drivers/dma/qcom/bam_dma.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,15 @@ static int bam_dma_probe(struct platform_device *pdev)
12721272
bdev->powered_remotely = of_property_read_bool(pdev->dev.of_node,
12731273
"qcom,powered-remotely");
12741274

1275-
if (bdev->controlled_remotely || bdev->powered_remotely) {
1275+
if (bdev->controlled_remotely || bdev->powered_remotely)
1276+
bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk");
1277+
else
1278+
bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
1279+
1280+
if (IS_ERR(bdev->bamclk))
1281+
return PTR_ERR(bdev->bamclk);
1282+
1283+
if (!bdev->bamclk) {
12761284
ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
12771285
&bdev->num_channels);
12781286
if (ret)
@@ -1284,14 +1292,6 @@ static int bam_dma_probe(struct platform_device *pdev)
12841292
dev_err(bdev->dev, "num-ees unspecified in dt\n");
12851293
}
12861294

1287-
if (bdev->controlled_remotely || bdev->powered_remotely)
1288-
bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk");
1289-
else
1290-
bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
1291-
1292-
if (IS_ERR(bdev->bamclk))
1293-
return PTR_ERR(bdev->bamclk);
1294-
12951295
ret = clk_prepare_enable(bdev->bamclk);
12961296
if (ret) {
12971297
dev_err(bdev->dev, "failed to prepare/enable clock\n");

0 commit comments

Comments
 (0)