Add 64-bit DMA operation support to the USB DWC3 driver.
First attempt to set the coherent DMA mask for 64-bit DMA.
If that failed, attempt again with 32-bit DMA.
Change-Id: I6d8e0e35ed606aa38d1dbadbb48f5629c1b39552
Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(am from https://patchwork.kernel.org/patch/
8109031/)
dwc->mem = mem;
dwc->dev = dev;
+ /* Try to set 64-bit DMA first */
+ if (!pdev->dev.dma_mask)
+ /* Platform did not initialize dma_mask */
+ ret = dma_coerce_mask_and_coherent(&pdev->dev,
+ DMA_BIT_MASK(64));
+ else
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+
+ /* If seting 64-bit DMA mask fails, fall back to 32-bit DMA mask */
+ if (ret) {
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+ if (ret)
+ return ret;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "missing IRQ\n");