public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
@ 2016-05-04  3:41 Rajesh Bhagat
  2016-05-04  7:57 ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: Rajesh Bhagat @ 2016-05-04  3:41 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, balbi, gregkh, leoyang.li, sriram.dash,
	Rajesh Bhagat

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 <rajesh.bhagat@nxp.com>
Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
  2016-05-04  3:41 [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT Rajesh Bhagat
@ 2016-05-04  7:57 ` Felipe Balbi
  2016-05-11  3:45   ` Rajesh Bhagat
  2016-05-25 19:31   ` Leo Li
  0 siblings, 2 replies; 7+ messages in thread
From: Felipe Balbi @ 2016-05-04  7:57 UTC (permalink / raw)
  To: Rajesh Bhagat, linux-usb
  Cc: linux-kernel, gregkh, leoyang.li, sriram.dash, Rajesh Bhagat

[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]


Hi,

Rajesh Bhagat <rajesh.bhagat@nxp.com> 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 <rajesh.bhagat@nxp.com>
> Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>

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@ti.com

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
  2016-05-04  7:57 ` Felipe Balbi
@ 2016-05-11  3:45   ` Rajesh Bhagat
  2016-05-25 19:31   ` Leo Li
  1 sibling, 0 replies; 7+ messages in thread
From: Rajesh Bhagat @ 2016-05-11  3:45 UTC (permalink / raw)
  To: Felipe Balbi, linux-usb@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	Yang-Leo Li, Sriram Dash



> -----Original Message-----
> From: Felipe Balbi [mailto:felipe.balbi@linux.intel.com]
> Sent: Wednesday, May 04, 2016 1:28 PM
> To: Rajesh Bhagat <rajesh.bhagat@nxp.com>; linux-usb@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; gregkh@linuxfoundation.org; Yang-Leo Li
> <leoyang.li@nxp.com>; Sriram Dash <sriram.dash@nxp.com>; Rajesh Bhagat
> <rajesh.bhagat@nxp.com>
> Subject: Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
> 
> 
> Hi,
> 
> Rajesh Bhagat <rajesh.bhagat@nxp.com> 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 <rajesh.bhagat@nxp.com>
> > Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>

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@ti.com
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
  2016-05-04  7:57 ` Felipe Balbi
  2016-05-11  3:45   ` Rajesh Bhagat
@ 2016-05-25 19:31   ` Leo Li
  2016-05-26  8:30     ` Felipe Balbi
  1 sibling, 1 reply; 7+ messages in thread
From: Leo Li @ 2016-05-25 19:31 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Rajesh Bhagat, linux-usb@vger.kernel.org, lkml,
	Greg Kroah-Hartman, Li Yang, sriram.dash

On Wed, May 4, 2016 at 2:57 AM, Felipe Balbi
<felipe.balbi@linux.intel.com> wrote:
>
> Hi,
>
> Rajesh Bhagat <rajesh.bhagat@nxp.com> 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 <rajesh.bhagat@nxp.com>
>> Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>
>
> 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@ti.com
>
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
  2016-05-25 19:31   ` Leo Li
@ 2016-05-26  8:30     ` Felipe Balbi
  2016-05-26 20:56       ` Leo Li
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2016-05-26  8:30 UTC (permalink / raw)
  To: Leo Li
  Cc: Rajesh Bhagat, linux-usb@vger.kernel.org, lkml,
	Greg Kroah-Hartman, Li Yang, sriram.dash

[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]


Hi,

Leo Li <pku.leo@gmail.com> 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 <rajesh.bhagat@nxp.com>
>>> Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>
>>
>> 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@ti.com
>>
>> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
  2016-05-26  8:30     ` Felipe Balbi
@ 2016-05-26 20:56       ` Leo Li
  2016-05-27 13:32         ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Li @ 2016-05-26 20:56 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Rajesh Bhagat, linux-usb@vger.kernel.org, lkml,
	Greg Kroah-Hartman, Li Yang, sriram.dash

On Thu, May 26, 2016 at 3:30 AM, Felipe Balbi
<felipe.balbi@linux.intel.com> wrote:
>
> Hi,
>
> Leo Li <pku.leo@gmail.com> 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 <rajesh.bhagat@nxp.com>
>>>> Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>
>>>
>>> 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@ti.com
>>>
>>> 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.

I agree with your proposal, but the original discussion seems to be on
halt right now.  If it need more time to get to an agreement on proper
fix, probably it's better to have a temporary fix right now to make
the driver working again.

Regards,
Leo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT
  2016-05-26 20:56       ` Leo Li
@ 2016-05-27 13:32         ` Felipe Balbi
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2016-05-27 13:32 UTC (permalink / raw)
  To: Leo Li
  Cc: Rajesh Bhagat, linux-usb@vger.kernel.org, lkml,
	Greg Kroah-Hartman, Li Yang, sriram.dash

[-- Attachment #1: Type: text/plain, Size: 2532 bytes --]


Hi,

Leo Li <pku.leo@gmail.com> writes:
>> Leo Li <pku.leo@gmail.com> 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 <rajesh.bhagat@nxp.com>
>>>>> Reviewed-by: Yang-Leo Li <leoyang.li@nxp.com>
>>>>
>>>> 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@ti.com
>>>>
>>>> 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.
>
> I agree with your proposal, but the original discussion seems to be on
> halt right now.  If it need more time to get to an agreement on proper
> fix, probably it's better to have a temporary fix right now to make
> the driver working again.

if it temporarily solves all users, sure. But if temporarily solves the
problem for just a subset of the users, then that subset will stop
thinking about the solution while the other subset is left alone
thinking about it.

Sorry, but I prefer to get this sorted out for everybody, rather than
for one subset of users.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-05-27 13:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04  3:41 [PATCH] drivers: usb: dwc3 : Configure DMA properties and ops from DT Rajesh Bhagat
2016-05-04  7:57 ` Felipe Balbi
2016-05-11  3:45   ` Rajesh Bhagat
2016-05-25 19:31   ` Leo Li
2016-05-26  8:30     ` Felipe Balbi
2016-05-26 20:56       ` Leo Li
2016-05-27 13:32         ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox