diff mbox series

etnaviv: Make sure DMA is setup

Message ID 20180912154420.GA29839@bogon.m.sigxcpu.org (mailing list archive)
State New, archived
Headers show
Series etnaviv: Make sure DMA is setup | expand

Commit Message

Guido Günther Sept. 12, 2018, 3:44 p.m. UTC
Since we don't want to setup up DMA via device tree we end up with
arm64's dummy_dma_ops otherwise.

Links: https://lists.freedesktop.org/archives/etnaviv/2018-August/001925.html
Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Lucas Stach Sept. 12, 2018, 3:50 p.m. UTC | #1
Hi Guido,

I've just sent out a patch which should hopefully also fix this issue,
in a (slightly) more correct way. I don't have my MX8M system up right
now, so would appreciate if you could test drive this patch.

Regards,
Lucas

Am Mittwoch, den 12.09.2018, 17:44 +0200 schrieb Guido Günther:
> Since we don't want to setup up DMA via device tree we end up with
> arm64's dummy_dma_ops otherwise.
> 
> Links: https://lists.freedesktop.org/archives/etnaviv/2018-August/001925.html
> > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 9b2720b41571..e488c07f333c 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -591,8 +591,19 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
>  {
> >  	struct device *dev = &pdev->dev;
> >  	struct component_match *match = NULL;
> > +	int ret;
> +
> > +	ret = of_dma_configure(dev, NULL, true);
> > +	if (ret) {
> > +		dev_err(&pdev->dev, "Setting up dma ops failed\n");
> > +		return ret;
> > +	};
>  
> > -	dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> > +	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +	if (ret) {
> > +		dev_err(&pdev->dev, "dma_coerce_mask_and_coherent failed\n");
> > +		return ret;
> > +	};
>  
> >  	if (!dev->platform_data) {
> >  		struct device_node *core_node;
Lucas Stach Sept. 12, 2018, 4:39 p.m. UTC | #2
Am Mittwoch, den 12.09.2018, 17:50 +0200 schrieb Lucas Stach:
> Hi Guido,
> 
> I've just sent out a patch which should hopefully also fix this issue,
> in a (slightly) more correct way. I don't have my MX8M system up right
> now, so would appreciate if you could test drive this patch.

And I just realized that sharing the DT node has it's own set of
issues, so please don't bother with this patch, I'll send a follow-up
tomorrow.


> Regards,
> Lucas
> 
> Am Mittwoch, den 12.09.2018, 17:44 +0200 schrieb Guido Günther:
> > Since we don't want to setup up DMA via device tree we end up with
> > arm64's dummy_dma_ops otherwise.
> > 
> > Links: https://lists.freedesktop.org/archives/etnaviv/2018-August/001925.html
> > > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> > 
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > index 9b2720b41571..e488c07f333c 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > @@ -591,8 +591,19 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
> >  {
> > > > > >  	struct device *dev = &pdev->dev;
> > > > > >  	struct component_match *match = NULL;
> > > +	int ret;
> > 
> > +
> > > > > > +	ret = of_dma_configure(dev, NULL, true);
> > > > > > +	if (ret) {
> > > > > > +		dev_err(&pdev->dev, "Setting up dma ops failed\n");
> > > > > > +		return ret;
> > > +	};
> > 
> >  
> > > > > > -	dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> > > > > > +	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > > > > > +	if (ret) {
> > > > > > +		dev_err(&pdev->dev, "dma_coerce_mask_and_coherent failed\n");
> > > > > > +		return ret;
> > > +	};
> > 
> >  
> > > > > >  	if (!dev->platform_data) {
> > >  		struct device_node *core_node;
> 
> _______________________________________________
> etnaviv mailing list
> etnaviv@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 9b2720b41571..e488c07f333c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -591,8 +591,19 @@  static int etnaviv_pdev_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct component_match *match = NULL;
+	int ret;
+
+	ret = of_dma_configure(dev, NULL, true);
+	if (ret) {
+		dev_err(&pdev->dev, "Setting up dma ops failed\n");
+		return ret;
+	};
 
-	dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (ret) {
+		dev_err(&pdev->dev, "dma_coerce_mask_and_coherent failed\n");
+		return ret;
+	};
 
 	if (!dev->platform_data) {
 		struct device_node *core_node;