Message ID | 20240524182702.1317935-3-dave.stevenson@raspberrypi.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | BCM2835 DMA mapping cleanups and fixes | expand |
On Fri, May 24, 2024 at 07:26:46PM +0100, Dave Stevenson wrote: > From: Stefan Wahren <stefan.wahren@i2se.com> > > Nowadays there is a generic property for dma-channel-mask in the DMA > controller binding. So prefer this one instead of the old vendor specific > one. Print a warning in case the old one is used. Btw use the result of > of_property_read_u32() as return code in error case. Use generic 'dma-channel-mask' property. Print a warning in case the old brcm,dma-channel-mask is used. Did you update binding doc? > > Signed-off-by: Stefan Wahren <wahrenst@gmx.net> > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > --- > drivers/dma/bcm2835-dma.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c > index 9d74fe97452e..528c4593b45a 100644 > --- a/drivers/dma/bcm2835-dma.c > +++ b/drivers/dma/bcm2835-dma.c > @@ -941,12 +941,19 @@ 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; > + rc = of_property_read_u32(pdev->dev.of_node, "dma-channel-mask", > + &chans_available); > + > + if (rc) { > + /* Try deprecated property */ > + 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"); > + goto err_no_dma; > + } > + > + dev_warn(&pdev->dev, "brcm,dma-channel-mask deprecated - please update DT\n"); > } > > /* get irqs for each channel that we support */ > -- > 2.34.1 >
diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 9d74fe97452e..528c4593b45a 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -941,12 +941,19 @@ 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; + rc = of_property_read_u32(pdev->dev.of_node, "dma-channel-mask", + &chans_available); + + if (rc) { + /* Try deprecated property */ + 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"); + goto err_no_dma; + } + + dev_warn(&pdev->dev, "brcm,dma-channel-mask deprecated - please update DT\n"); } /* get irqs for each channel that we support */