linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] usb:dwc3: Enable support for 64-bit system
@ 2016-01-25 14:26 Thang Q. Nguyen
  2016-01-25 14:26 ` [PATCH v2 2/2] usb:dwc3: pass arch data to xhci-hcd child Thang Q. Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thang Q. Nguyen @ 2016-01-25 14:26 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-omap,
	linux-kernel, linux-arm
  Cc: Thang Nguyen, Phong Vo, Loc Ho, patches

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.

Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com>
---
Changes from v1:
	- Remove WARN_ON if dma_mask is NULL

 drivers/usb/dwc3/core.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index de5e01f..2479c24 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -831,6 +831,21 @@ static int dwc3_probe(struct platform_device *pdev)
 	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");
-- 
2.2.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-03-10  8:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 14:26 [PATCH v2 1/2] usb:dwc3: Enable support for 64-bit system Thang Q. Nguyen
2016-01-25 14:26 ` [PATCH v2 2/2] usb:dwc3: pass arch data to xhci-hcd child Thang Q. Nguyen
     [not found]   ` <1453731985-13835-2-git-send-email-tqnguyen-qTEPVZfXA3Y@public.gmane.org>
2016-02-16 10:56     ` Thang Q. Nguyen
2016-03-10  4:10   ` Thang Q. Nguyen
2016-02-16 10:56 ` [PATCH v2 1/2] usb:dwc3: Enable support for 64-bit system Thang Q. Nguyen
2016-03-10  4:09 ` Thang Q. Nguyen
     [not found]   ` <0167d2d94eb773138609361a34d88f90-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-10  8:15     ` Felipe Balbi
     [not found]       ` <87ziu6d9zz.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-10  8:47         ` Thang Q. Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).