[PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT

Rajesh Bhagat-2
On certain platforms (e.g. ARM64) the dma_ops needs to be explicitly set
to be able to do DMA allocations, so use the of_dma_configure() helper
to populate the dma properties and assign an appropriate dma_ops.

Signed-off-by: Rajesh Bhagat <[hidden email]>
Reviewed-by: Yang-Leo Li <[hidden email]>
---
 drivers/usb/dwc3/host.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c679f63..4d5b783 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -17,6 +17,7 @@
 
 #include <linux/platform_device.h>
 #include <linux/usb/xhci_pdriver.h>
+#include <linux/of_device.h>
 
 #include "core.h"
 
@@ -32,6 +33,9 @@ int dwc3_host_init(struct dwc3 *dwc)
  return -ENOMEM;
  }
 
+ if (IS_ENABLED(CONFIG_OF) && dwc->dev->of_node)
+ of_dma_configure(&xhci->dev, dwc->dev->of_node);
+
  dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask);
 
  xhci->dev.parent = dwc->dev;
--
2.6.2.198.g614a2ac

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT

Felipe Balbi-7

Hi,

Rajesh Bhagat <[hidden email]> writes:
> On certain platforms (e.g. ARM64) the dma_ops needs to be explicitly set
> to be able to do DMA allocations, so use the of_dma_configure() helper
> to populate the dma properties and assign an appropriate dma_ops.
>
> Signed-off-by: Rajesh Bhagat <[hidden email]>
> Reviewed-by: Yang-Leo Li <[hidden email]>

Cool, nxp is also using dwc3 :-) C'mon Rajesh, send us a glue layer :)

> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index c679f63..4d5b783 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -17,6 +17,7 @@
>  
>  #include <linux/platform_device.h>
>  #include <linux/usb/xhci_pdriver.h>
> +#include <linux/of_device.h>
>  
>  #include "core.h"
>  
> @@ -32,6 +33,9 @@ int dwc3_host_init(struct dwc3 *dwc)
>   return -ENOMEM;
>   }
>  
> + if (IS_ENABLED(CONFIG_OF) && dwc->dev->of_node)
> + of_dma_configure(&xhci->dev, dwc->dev->of_node);
okay, so we have a long discussion about this going on. You can catch up
with it starting here:

http://marc.info/?i=1461612094-30939-1-git-send-email-grygorii.strashko@...

At least for now, this patch will be applied. We need to have a better
solution for this, one that helps not only DT platforms.

--
balbi

signature.asc (834 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT

Rajesh Bhagat-2


> -----Original Message-----
> From: Felipe Balbi [mailto:[hidden email]]
> Sent: Wednesday, May 04, 2016 1:28 PM
> To: Rajesh Bhagat <[hidden email]>; [hidden email]
> Cc: [hidden email]; [hidden email]; Yang-Leo Li
> <[hidden email]>; Sriram Dash <[hidden email]>; Rajesh Bhagat
> <[hidden email]>
> Subject: Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
>
>
> Hi,
>
> Rajesh Bhagat <[hidden email]> writes:
> > On certain platforms (e.g. ARM64) the dma_ops needs to be explicitly
> > set to be able to do DMA allocations, so use the of_dma_configure()
> > helper to populate the dma properties and assign an appropriate dma_ops.
> >
> > Signed-off-by: Rajesh Bhagat <[hidden email]>
> > Reviewed-by: Yang-Leo Li <[hidden email]>

Hi,

>
> Cool, nxp is also using dwc3 :-) C'mon Rajesh, send us a glue layer :)
>

I would surely be sending the glue layer soon :)

> > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index
> > c679f63..4d5b783 100644
> > --- a/drivers/usb/dwc3/host.c
> > +++ b/drivers/usb/dwc3/host.c
> > @@ -17,6 +17,7 @@
> >
> >  #include <linux/platform_device.h>
> >  #include <linux/usb/xhci_pdriver.h>
> > +#include <linux/of_device.h>
> >
> >  #include "core.h"
> >
> > @@ -32,6 +33,9 @@ int dwc3_host_init(struct dwc3 *dwc)
> >   return -ENOMEM;
> >   }
> >
> > + if (IS_ENABLED(CONFIG_OF) && dwc->dev->of_node)
> > + of_dma_configure(&xhci->dev, dwc->dev->of_node);
>
> okay, so we have a long discussion about this going on. You can catch up with it
> starting here:
>
> http://marc.info/?i=1461612094-30939-1-git-send-email-grygorii.strashko@...
>
> At least for now, this patch will be applied. We need to have a better solution for this,
> one that helps not only DT platforms.
>

Thanks for information.

> --
> balbi
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT

Leo Li
In reply to this post by Felipe Balbi-7
On Wed, May 4, 2016 at 2:57 AM, Felipe Balbi
<[hidden email]> wrote:

>
> Hi,
>
> Rajesh Bhagat <[hidden email]> writes:
>> On certain platforms (e.g. ARM64) the dma_ops needs to be explicitly set
>> to be able to do DMA allocations, so use the of_dma_configure() helper
>> to populate the dma properties and assign an appropriate dma_ops.
>>
>> Signed-off-by: Rajesh Bhagat <[hidden email]>
>> Reviewed-by: Yang-Leo Li <[hidden email]>
>
> Cool, nxp is also using dwc3 :-) C'mon Rajesh, send us a glue layer :)
>
>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
>> index c679f63..4d5b783 100644
>> --- a/drivers/usb/dwc3/host.c
>> +++ b/drivers/usb/dwc3/host.c
>> @@ -17,6 +17,7 @@
>>
>>  #include <linux/platform_device.h>
>>  #include <linux/usb/xhci_pdriver.h>
>> +#include <linux/of_device.h>
>>
>>  #include "core.h"
>>
>> @@ -32,6 +33,9 @@ int dwc3_host_init(struct dwc3 *dwc)
>>               return -ENOMEM;
>>       }
>>
>> +     if (IS_ENABLED(CONFIG_OF) && dwc->dev->of_node)
>> +             of_dma_configure(&xhci->dev, dwc->dev->of_node);
>
> okay, so we have a long discussion about this going on. You can catch up
> with it starting here:
>
> http://marc.info/?i=1461612094-30939-1-git-send-email-grygorii.strashko@...
>
> At least for now, this patch will be applied. We need to have a better
> solution for this, one that helps not only DT platforms.

Balbi,

Has the patch from Grygorii been applied?  I don't see it in the
mainline tree yet.  Without fix, the dwc3 driver will fail for all
ARM64 SoCs.

Regards,
Leo
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT

Felipe Balbi-7

Hi,

Leo Li <[hidden email]> writes:

>>> On certain platforms (e.g. ARM64) the dma_ops needs to be explicitly set
>>> to be able to do DMA allocations, so use the of_dma_configure() helper
>>> to populate the dma properties and assign an appropriate dma_ops.
>>>
>>> Signed-off-by: Rajesh Bhagat <[hidden email]>
>>> Reviewed-by: Yang-Leo Li <[hidden email]>
>>
>> Cool, nxp is also using dwc3 :-) C'mon Rajesh, send us a glue layer :)
>>
>>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
>>> index c679f63..4d5b783 100644
>>> --- a/drivers/usb/dwc3/host.c
>>> +++ b/drivers/usb/dwc3/host.c
>>> @@ -17,6 +17,7 @@
>>>
>>>  #include <linux/platform_device.h>
>>>  #include <linux/usb/xhci_pdriver.h>
>>> +#include <linux/of_device.h>
>>>
>>>  #include "core.h"
>>>
>>> @@ -32,6 +33,9 @@ int dwc3_host_init(struct dwc3 *dwc)
>>>               return -ENOMEM;
>>>       }
>>>
>>> +     if (IS_ENABLED(CONFIG_OF) && dwc->dev->of_node)
>>> +             of_dma_configure(&xhci->dev, dwc->dev->of_node);
>>
>> okay, so we have a long discussion about this going on. You can catch up
>> with it starting here:
>>
>> http://marc.info/?i=1461612094-30939-1-git-send-email-grygorii.strashko@...
>>
>> At least for now, this patch will be applied. We need to have a better
>> solution for this, one that helps not only DT platforms.
>
> Balbi,
>
> Has the patch from Grygorii been applied?  I don't see it in the
> mainline tree yet.  Without fix, the dwc3 driver will fail for all
> ARM64 SoCs.
right, it's still broken. But we don't want something that fixes only
OF, right? dwc3 is also broken for PCI when IOMMU is enabled. It breaks
for the same reasons.

We really need a way to inherit DMA bits from parent device here.

--
balbi

signature.asc (834 bytes) Download Attachment