summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc3/host.c')
-rw-r--r--drivers/usb/dwc3/host.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index 626d87d..f1b9827 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -17,6 +17,8 @@
#include <linux/platform_device.h>
+#include <linux/of_device.h>
+
#include "core.h"
int dwc3_host_init(struct dwc3 *dwc)
@@ -73,12 +75,21 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
- dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask);
+ if (IS_ENABLED(CONFIG_OF) && dwc->dev->of_node)
+ of_dma_configure(&xhci->dev, dwc->dev->of_node);
+ else
+ dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask);
- xhci->dev.parent = dwc->dev;
+ xhci->dev.parent = dwc->dev;
xhci->dev.dma_mask = dwc->dev->dma_mask;
xhci->dev.dma_parms = dwc->dev->dma_parms;
+ /* set DMA operations */
+ if (dwc->dev->of_node && of_dma_is_coherent(dwc->dev->of_node)) {
+ xhci->dev.archdata.dma_ops = dwc->dev->archdata.dma_ops;
+ dev_dbg(dwc->dev, "set dma_ops for usb\n");
+ }
+
dwc->xhci = xhci;
ret = platform_device_add_resources(xhci, dwc->xhci_resources,