dmaengine: sprd: add dma mask interface in probe
[linux-2.6-microblaze.git] / drivers / dma / sprd-dma.c
index 97e3ded..fe3d69c 100644 (file)
@@ -212,7 +212,7 @@ struct sprd_dma_dev {
        struct clk              *ashb_clk;
        int                     irq;
        u32                     total_chns;
-       struct sprd_dma_chn     channels[];
+       struct sprd_dma_chn     channels[] __counted_by(total_chns);
 };
 
 static void sprd_dma_free_desc(struct virt_dma_desc *vd);
@@ -1117,6 +1117,15 @@ static int sprd_dma_probe(struct platform_device *pdev)
        u32 chn_count;
        int ret, i;
 
+       ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
+       if (ret) {
+               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+               if (ret) {
+                       dev_err(&pdev->dev, "unable to set coherent mask to 32\n");
+                       return ret;
+               }
+       }
+
        /* Parse new and deprecated dma-channels properties */
        ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count);
        if (ret)