Re: [PATCH] usb: Add Device Tree support to XHCI Platform driver

2013-07-19 Thread Sergei Shtylyov

Hello.

On 07/19/2013 02:40 AM, Sergei Shtylyov wrote:


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

[...]



@@ -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 },



I think just xhci would be enough. We're describing the device, not its
driver with this prop.


   BTW, you need to describe the xHCI DT binding somewhere in 
Documentation/devicetree/bindings/usb/ in the same patch.


PS: Sarah, sorry for commenting on xHCI patches, I hope my comments were more 
to the point this time. :-)


WBR, Sergei

--
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


Re: [PATCH] usb: Add Device Tree support to XHCI Platform driver

2013-07-19 Thread Sarah Sharp
On Fri, Jul 19, 2013 at 10:42:50PM +0400, Sergei Shtylyov wrote:
 Hello.
 
 On 07/19/2013 02:40 AM, Sergei Shtylyov wrote:
 
 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
 [...]
 
 @@ -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 },
 
 I think just xhci would be enough. We're describing the device, not its
 driver with this prop.
 
BTW, you need to describe the xHCI DT binding somewhere in
 Documentation/devicetree/bindings/usb/ in the same patch.
 
 PS: Sarah, sorry for commenting on xHCI patches, I hope my comments
 were more to the point this time. :-)

Yes, they were appropriate.  Thank you for increasing your signal to
noise ratio. :)

Sarah Sharp
--
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


[PATCH] usb: Add Device Tree support to XHCI Platform driver

2013-07-18 Thread Al Cooper
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


Re: [PATCH] usb: Add Device Tree support to XHCI Platform driver

2013-07-18 Thread Sergei Shtylyov

Hello.

On 07/19/2013 02:35 AM, 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 alcoop...@gmail.com

[...]


@@ -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 },


   I think just xhci would be enough. We're describing the device, not its 
driver with this prop.


WBR, Sergei

--
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


Re: [PATCH] usb: Add Device Tree support to XHCI Platform driver

2013-07-18 Thread Sarah Sharp
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 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);
 +

Xenia is already working on a patch to fix the xhci-plat's DMA mask:

http://marc.info/?l=linux-usbm=137304523616938w=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
--
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


Re: [PATCH] usb: Add Device Tree support to XHCI Platform driver

2013-07-18 Thread Xenia Ragiadakou

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 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);
+

Xenia is already working on a patch to fix the xhci-plat's DMA mask:

http://marc.info/?l=linux-usbm=137304523616938w=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 
0x. 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html