linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] usb: chipidea: set dma_ops for the created ci_hdrc platform_device
@ 2017-04-25 10:01 Jisheng Zhang
  2017-04-25 11:09 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jisheng Zhang @ 2017-04-25 10:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

After commit 1dccb598df549 ("arm64: simplify dma_get_ops"), the chipidea
driver can't work any more on Marvell Berlin arm64 platforms, the reason
is the created ci_hdrc platform_device's dma_ops is dummy_dma_ops, so all
dma related operations will fail. The fix I can think of would be something
as below:

And I noticed that dwc3 has the same issue[1], and as pointed out in its
discussion, the patch can't fix None-DT platforms, so could you please
guide me what's the proper fix which can be mainlined?

Any suggestion is appreciated!

Thanks,
Jisheng

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-April/425079.html

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 047afdbb7049..acb80457603c 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -62,6 +62,7 @@
 #include <linux/usb/chipidea.h>
 #include <linux/usb/of.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/usb/ehci_def.h>
 
@@ -786,6 +787,7 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
 	pdev->dev.dma_mask = dev->dma_mask;
 	pdev->dev.dma_parms = dev->dma_parms;
 	dma_set_coherent_mask(&pdev->dev, dev->coherent_dma_mask);
+	of_dma_configure(&pdev->dev, dev->of_node);
 
 	ret = platform_device_add_resources(pdev, res, nres);
 	if (ret)

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

* [RFC] usb: chipidea: set dma_ops for the created ci_hdrc platform_device
  2017-04-25 10:01 [RFC] usb: chipidea: set dma_ops for the created ci_hdrc platform_device Jisheng Zhang
@ 2017-04-25 11:09 ` Arnd Bergmann
  2017-04-26  8:41   ` Jisheng Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-04-25 11:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 25, 2017 at 12:01 PM, Jisheng Zhang <jszhang@marvell.com> wrote:
> Hi all,
>
> After commit 1dccb598df549 ("arm64: simplify dma_get_ops"), the chipidea
> driver can't work any more on Marvell Berlin arm64 platforms, the reason
> is the created ci_hdrc platform_device's dma_ops is dummy_dma_ops, so all
> dma related operations will fail. The fix I can think of would be something
> as below:
>
> And I noticed that dwc3 has the same issue[1], and as pointed out in its
> discussion, the patch can't fix None-DT platforms, so could you please
> guide me what's the proper fix which can be mainlined?

I think the right solution is:

- Set the "sysdev" pointer tin the USB device o the device structure that
  was created by DT or the legacy board file and remove the manual
  setting of dma_mask,  parms and the dma_configure. This should
  make everything work as expected in case of DT

- For any legacy board files, set the mask/parms and map_ops at
  the point where the device originally created.

      Arnd

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

* [RFC] usb: chipidea: set dma_ops for the created ci_hdrc platform_device
  2017-04-25 11:09 ` Arnd Bergmann
@ 2017-04-26  8:41   ` Jisheng Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Jisheng Zhang @ 2017-04-26  8:41 UTC (permalink / raw)
  To: linux-arm-kernel


On Tue, 25 Apr 2017 13:09:27 +0200 Arnd Bergmann wrote:

> On Tue, Apr 25, 2017 at 12:01 PM, Jisheng Zhang <jszhang@marvell.com> wrote:
> > Hi all,
> >
> > After commit 1dccb598df549 ("arm64: simplify dma_get_ops"), the chipidea
> > driver can't work any more on Marvell Berlin arm64 platforms, the reason
> > is the created ci_hdrc platform_device's dma_ops is dummy_dma_ops, so all
> > dma related operations will fail. The fix I can think of would be something
> > as below:
> >
> > And I noticed that dwc3 has the same issue[1], and as pointed out in its
> > discussion, the patch can't fix None-DT platforms, so could you please
> > guide me what's the proper fix which can be mainlined?  
> 
> I think the right solution is:
> 
> - Set the "sysdev" pointer tin the USB device o the device structure that
>   was created by DT or the legacy board file and remove the manual
>   setting of dma_mask,  parms and the dma_configure. This should
>   make everything work as expected in case of DT
> 

oh yeah! I see a proper fix in linux-next tree, thanks for fixing it.

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

end of thread, other threads:[~2017-04-26  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-25 10:01 [RFC] usb: chipidea: set dma_ops for the created ci_hdrc platform_device Jisheng Zhang
2017-04-25 11:09 ` Arnd Bergmann
2017-04-26  8:41   ` Jisheng Zhang

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