diff mbox series

[02/10] dmaengine: bcm2835: also support generic dma-channel-mask

Message ID 20230604121223.9625-3-stefan.wahren@i2se.com
State New
Headers show
Series ARM: dts: bcm283x: Improve device-trees and bindings | expand

Commit Message

Stefan Wahren June 4, 2023, 12:12 p.m. UTC
Since commit e2d896c08ca3 ("Documentation: bindings: dma: Add
binding for dma-channel-mask") there is a generic property to list
available DMA channels for the kernel to use. The generic property
has been implemented by some other platforms.
So implement support for the generic one and consider the
vendor specific one as deprecated. This also simplifies the YAML
conversion of the BCM2835 DMA DT bindings a little bit.

Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/dma/bcm2835-dma.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

Stefan Wahren June 10, 2023, 10:52 a.m. UTC | #1
Hi,

Am 04.06.23 um 14:12 schrieb Stefan Wahren:
> Since commit e2d896c08ca3 ("Documentation: bindings: dma: Add
> binding for dma-channel-mask") there is a generic property to list
> available DMA channels for the kernel to use. The generic property
> has been implemented by some other platforms.
> So implement support for the generic one and consider the
> vendor specific one as deprecated. This also simplifies the YAML
> conversion of the BCM2835 DMA DT bindings a little bit.
> 
> Cc: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>

as Rob Herring pointed out that the matching DTS change (patch 4) breaks 
ABI compatibility, i will drop this patch and rework patch 4 in V2 of 
this series. This should make everything smoother ...
diff mbox series

Patch

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index 0807fb9eb262..a0573977a373 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -941,12 +941,18 @@  static int bcm2835_dma_probe(struct platform_device *pdev)
 	}
 
 	/* Request DMA channel mask from device tree */
-	if (of_property_read_u32(pdev->dev.of_node,
-			"brcm,dma-channel-mask",
-			&chans_available)) {
-		dev_err(&pdev->dev, "Failed to get channel mask\n");
-		rc = -EINVAL;
-		goto err_no_dma;
+	if (of_property_read_u32(pdev->dev.of_node, "dma-channel-mask",
+				 &chans_available)) {
+		if (of_property_read_u32(pdev->dev.of_node,
+					 "brcm,dma-channel-mask",
+					 &chans_available)) {
+			dev_err(&pdev->dev, "Failed to get channel mask\n");
+			rc = -EINVAL;
+			goto err_no_dma;
+		} else {
+			dev_warn(&pdev->dev,
+				 "brcm,dma-channel-mask is deprecated, update your device-tree\n");
+		}
 	}
 
 	/* get irqs for each channel that we support */