Add Device Tree match table. Setup dma_mask and coherent_dma_mask
if they're not already set.

Signed-off-by: Al Cooper <alcoop...@gmail.com>
---
 drivers/usb/host/xhci-plat.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 51e22bf..60b3ff4 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -14,6 +14,8 @@
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/dma-mapping.h>
 
 #include "xhci.h"
 
@@ -91,6 +93,16 @@ static int xhci_plat_probe(struct platform_device *pdev)
        int                     ret;
        int                     irq;
 
+       /*
+        * Right now device-tree probed devices don't get dma_mask set.
+        * Since shared usb code relies on it, set it here for now.
+        * Once we have dma capability bindings this can go away.
+        */
+       if (!pdev->dev.dma_mask)
+               pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+       if (!pdev->dev.coherent_dma_mask)
+               pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+
        if (usb_disabled())
                return -ENODEV;
 
@@ -186,11 +198,17 @@ static int xhci_plat_remove(struct platform_device *dev)
        return 0;
 }
 
+static const struct of_device_id usb_xhci_of_match[] = {
+       { .compatible = "xhci-hcd" },
+       {},
+};
+
 static struct platform_driver usb_xhci_driver = {
        .probe  = xhci_plat_probe,
        .remove = xhci_plat_remove,
        .driver = {
                .name = "xhci-hcd",
+               .of_match_table = of_match_ptr(usb_xhci_of_match),
        },
 };
 MODULE_ALIAS("platform:xhci-hcd");
-- 
1.7.6


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to