dw_dmac: apply default dma_mask if needed
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 14 Feb 2013 08:41:09 +0000 (10:41 +0200)
committerVinod Koul <vinod.koul@intel.com>
Thu, 14 Feb 2013 09:44:36 +0000 (15:14 +0530)
In some cases we got the device without dma_mask configured. We have to apply
the default value to avoid crashes during memory mapping.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/dw_dmac.c

index 6694676c9b826d82dcc87dceb79fdb7bd64b1cc6..4c83f18803f1b351a09962775d0a78a8ccdef9d7 100644 (file)
@@ -1661,6 +1661,12 @@ static int dw_probe(struct platform_device *pdev)
        if (!regs)
                return -EBUSY;
 
+       /* Apply default dma_mask if needed */
+       if (!pdev->dev.dma_mask) {
+               pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+               pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+       }
+
        dw_params = dma_read_byaddr(regs, DW_PARAMS);
        autocfg = dw_params >> DW_PARAMS_EN & 0x1;