On 07/19/2013 02:12 AM, Sarah Sharp wrote:
On Thu, Jul 18, 2013 at 06:35:13PM -0400, Al Cooper wrote:
Add Device Tree match table. Setup dma_mask and coherent_dma_mask
if they're not already set.
Signed-off-by: Al Cooper <alcooperx@xxxxxxxxx>
---
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);
+
Xenia is already working on a patch to fix the xhci-plat's DMA mask:
http://marc.info/?l=linux-usb&m=137304523616938&w=2
Please rebase this patch on top of her patch.
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
Sarah Sharp
Hi Al and Sarah,
I think it is the best idea to add the initialization of dma mask in the
probe function.
In that way, will be no need to set the uses_dma flag in the
xhci_plat_setup(), which
as Alan said should not be set manually in the hcd.
One thing that bothers me is if a 32bit dma bitmask will be supported on any
host system, so that there is no need to call dma_set_mask() (or
dma_set_coherent_mask())
for 32bit dma bitmask and check on the return value.
Also, what if dma_mask is set but it is assigned a value less than
0xffffffff. The above
patch will not set it to 32bits.
Maybe I make up strange senarios now, but this is due to lack of
knowledge :)
regards,
ksenia
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html