staging: dwc2: Fix dma-enabled platform devices using a default dma_mask
[firefly-linux-kernel-4.4.55.git] / drivers / staging / dwc2 / platform.c
index 1f3d581a10787154acccc04d3bb5a9274731996b..afc515bd8233baedb7ace47d45ee991bdd479a78 100644 (file)
@@ -95,6 +95,14 @@ static int dwc2_driver_probe(struct platform_device *dev)
 
        hsotg->dev = &dev->dev;
 
+       /*
+        * Use reasonable defaults so platforms don't have to provide these.
+        */
+       if (!dev->dev.dma_mask)
+               dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
+       if (!dev->dev.coherent_dma_mask)
+               dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+
        irq = platform_get_irq(dev, 0);
        if (irq < 0) {
                dev_err(&dev->dev, "missing IRQ resource\n");