linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device
@ 2016-06-06  5:56 Baolin Wang
  2016-06-06 14:59 ` Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: Baolin Wang @ 2016-06-06  5:56 UTC (permalink / raw)
  To: balbi, gregkh; +Cc: broonie, linux-usb, linux-kernel, baolin.wang

On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
it did not call 'arch_setup_dma_ops' at device creation time, that will
cause failure when setting the dma mask for device.

Thus this patch set the xhci device dma_ops from the parent device if
the xhci device dma_ops is 'dummy_dma_ops'.

Changes since v1:
 - Add CONFIG_ARM64 macro.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/usb/dwc3/host.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c679f63..edb666d 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc)
 		return -ENOMEM;
 	}
 
+#ifdef CONFIG_ARM64
+	if (get_dma_ops(&xhci->dev) == get_dma_ops(NULL))
+		xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev);
+#endif
+
 	dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask);
 
 	xhci->dev.parent	= dwc->dev;
-- 
1.7.9.5

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

* Re: [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device
  2016-06-06  5:56 [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device Baolin Wang
@ 2016-06-06 14:59 ` Felipe Balbi
  2016-06-07  2:11   ` Baolin Wang
  2016-06-08  8:18   ` Baolin Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Felipe Balbi @ 2016-06-06 14:59 UTC (permalink / raw)
  To: Baolin Wang, gregkh; +Cc: broonie, linux-usb, linux-kernel, baolin.wang

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


Hi,

Baolin Wang <baolin.wang@linaro.org> writes:
> On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
> it did not call 'arch_setup_dma_ops' at device creation time, that will
> cause failure when setting the dma mask for device.
>
> Thus this patch set the xhci device dma_ops from the parent device if
> the xhci device dma_ops is 'dummy_dma_ops'.
>
> Changes since v1:
>  - Add CONFIG_ARM64 macro.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
>  drivers/usb/dwc3/host.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index c679f63..edb666d 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc)
>  		return -ENOMEM;
>  	}
>  
> +#ifdef CONFIG_ARM64
> +	if (get_dma_ops(&xhci->dev) == get_dma_ops(NULL))
> +		xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev);
> +#endif

I don't like the ifdef and also don't like that this is done in dwc3
itself. Seems like we need something like this done from the
platform_bus core.

-- 
balbi

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

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

* Re: [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device
  2016-06-06 14:59 ` Felipe Balbi
@ 2016-06-07  2:11   ` Baolin Wang
  2016-06-08  8:18   ` Baolin Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Baolin Wang @ 2016-06-07  2:11 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Greg KH, Mark Brown, USB, LKML

On 6 June 2016 at 22:59, Felipe Balbi <balbi@kernel.org> wrote:
>
> Hi,
>
> Baolin Wang <baolin.wang@linaro.org> writes:
>> On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
>> it did not call 'arch_setup_dma_ops' at device creation time, that will
>> cause failure when setting the dma mask for device.
>>
>> Thus this patch set the xhci device dma_ops from the parent device if
>> the xhci device dma_ops is 'dummy_dma_ops'.
>>
>> Changes since v1:
>>  - Add CONFIG_ARM64 macro.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> ---
>>  drivers/usb/dwc3/host.c |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
>> index c679f63..edb666d 100644
>> --- a/drivers/usb/dwc3/host.c
>> +++ b/drivers/usb/dwc3/host.c
>> @@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc)
>>               return -ENOMEM;
>>       }
>>
>> +#ifdef CONFIG_ARM64
>> +     if (get_dma_ops(&xhci->dev) == get_dma_ops(NULL))
>> +             xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev);
>> +#endif
>
> I don't like the ifdef and also don't like that this is done in dwc3
> itself. Seems like we need something like this done from the
> platform_bus core.

OK. I will try to fix this issue in platform_bus core. Thanks.

>
> --
> balbi



-- 
Baolin.wang
Best Regards

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

* Re: [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device
  2016-06-06 14:59 ` Felipe Balbi
  2016-06-07  2:11   ` Baolin Wang
@ 2016-06-08  8:18   ` Baolin Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Baolin Wang @ 2016-06-08  8:18 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Greg KH, Mark Brown, USB, LKML

Hi,

On 6 June 2016 at 22:59, Felipe Balbi <balbi@kernel.org> wrote:
>
> Hi,
>
> Baolin Wang <baolin.wang@linaro.org> writes:
>> On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
>> it did not call 'arch_setup_dma_ops' at device creation time, that will
>> cause failure when setting the dma mask for device.
>>
>> Thus this patch set the xhci device dma_ops from the parent device if
>> the xhci device dma_ops is 'dummy_dma_ops'.
>>
>> Changes since v1:
>>  - Add CONFIG_ARM64 macro.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> ---
>>  drivers/usb/dwc3/host.c |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
>> index c679f63..edb666d 100644
>> --- a/drivers/usb/dwc3/host.c
>> +++ b/drivers/usb/dwc3/host.c
>> @@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc)
>>               return -ENOMEM;
>>       }
>>
>> +#ifdef CONFIG_ARM64
>> +     if (get_dma_ops(&xhci->dev) == get_dma_ops(NULL))
>> +             xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev);
>> +#endif
>
> I don't like the ifdef and also don't like that this is done in dwc3
> itself. Seems like we need something like this done from the
> platform_bus core.

I've sent one patch to fix this issue in platform_bus core, and Robin
explained "DMA-capable devices are real hardware, therefore don't
spring out of thin air without being described in DT or ACPI."
But the problem is here, how can we handle this issue to make the host
work well? What about below modification? Thanks.

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c679f63..f7c58f9 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"

@@ -37,6 +38,7 @@ int dwc3_host_init(struct dwc3 *dwc)
        xhci->dev.parent        = dwc->dev;
        xhci->dev.dma_mask      = dwc->dev->dma_mask;
        xhci->dev.dma_parms     = dwc->dev->dma_parms;
+       of_dma_configure(&xhci->dev, dwc->dev->of_node);

        dwc->xhci = xhci;

-- 
Baolin.wang
Best Regards

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

end of thread, other threads:[~2016-06-08  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06  5:56 [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device Baolin Wang
2016-06-06 14:59 ` Felipe Balbi
2016-06-07  2:11   ` Baolin Wang
2016-06-08  8:18   ` Baolin Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).