Re: [PATCH] USB: EHCI: DT support for generic bus glue

2013-03-27 Thread Matthijs Kooijman
Hi folks,

 I don't think we are consistent in any way. PowerPC sets up a 32 bit
 DMA mask for all devices during DT probe from arch code, while the
 common code sets up coherent_dma_mask but not dma_mask, except
 for AMBA devices, which also get the 32 bit mask.
 
 The MIPS Octeon and PowerPC PS3 EHCI backends set up the dma mask
 because platform code doesn't do it for them, but both drivers are
 not using DT. The Xilinx and PPC-OF EHCI back-end do not set it up,
 because on microblaze and powerpc it does come from the platform
 code.
 
 I think it's a horrible mess and if anyone has an idea of what the
 right solution is, we should probably implement that, but from what
 I see here, setting a 32-bit dma mask unless there is already one
 is a reasonable choice.

I also ran into this issue with loading the dwc2 driver from OF
recently, and stumbled upon this (unfinished) patch that sets up the
dma_mask using a dma-mask property in the DT, which looks like the
proper way to do this to me:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-March/013172.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-March/013179.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-March/013293.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/135991.html

It's probably not up to you guys to implement this, but perhaps it helps
to get some perspective?

Gr.

Matthijs
--
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: EHCI: DT support for generic bus glue

2013-03-27 Thread Peter Vasil
Hi again,
the patch works fine on my WM8850 netbook. I didn't get any
unused-function warning on build, most likely because I have CONFIG_PM
set in kernel config.
Regards,
Peter
--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Tony Prisk
On Mon, 2013-03-25 at 19:03 +, Arnd Bergmann wrote:
 On Monday 25 March 2013, Tony Prisk wrote:
  I'll take a look at this and get back to you before Easter.
  
 
 Great, thanks a lot!
 
   Arnd

I couldn't get this patch to apply cleanly on 3.9-rc2, -rc3 or -rc4 for
some reason. Applied it by hand and tested it on WM8850 tablet - all ok.
You can add my tested-by:

Tested-by: Tony Prisk li...@prisktech.co.nz

Regards
Tony P

--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Peter Vasil
On Tue, Mar 26, 2013 at 7:34 AM, Tony Prisk li...@prisktech.co.nz wrote:

 On Mon, 2013-03-25 at 19:03 +, Arnd Bergmann wrote:
  On Monday 25 March 2013, Tony Prisk wrote:
   I'll take a look at this and get back to you before Easter.
  
 
  Great, thanks a lot!
 
Arnd

 I couldn't get this patch to apply cleanly on 3.9-rc2, -rc3 or -rc4 for
 some reason. Applied it by hand and tested it on WM8850 tablet - all ok.
 You can add my tested-by:

 Tested-by: Tony Prisk li...@prisktech.co.nz

 Regards
 Tony P

 --
 You received this message because you are subscribed to the Google Groups 
 VT8500/WM8505 Linux Kernel group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to vt8500-wm8505-linux-kernel+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



Hi everyone,
patch doesn't apply because there are missing details about
drivers/usb/host/ehci-vt8500.c removal at the end. With those details
included I've applied it to latest Torvalds' repo successfully, but
the testing (on wm8850 netbook) will have to wait a few hours till I
get home tonight.
Regards,
Peter
--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Tony Prisk
Hi Alan,

I noticed when testing Arnd's patch that I get an unused function
warning:

drivers/usb/host/ehci-q.c:1320:13: warning:
‘unlink_empty_async_suspended’ defined but not used [-Wunused-function]


It looks like this function is called from ehci-hub.c:ehci_bus_suspend()
which is wrapped in a #ifdef CONFIG_PM.

I guess the forward decl in ehci-hcd.c:
static void unlink_empty_async_suspended(struct ehci_hcd *ehci)

and the actual function in ehci-q.c need to be wrapped in a #ifdef
CONFIG_PM as well.

Let me know if you want me to send a patch for this.

Regards
Tony P

--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Alan Stern
On Tue, 26 Mar 2013, Tony Prisk wrote:

 Hi Alan,
 
 I noticed when testing Arnd's patch that I get an unused function
 warning:
 
 drivers/usb/host/ehci-q.c:1320:13: warning:
 ‘unlink_empty_async_suspended’ defined but not used [-Wunused-function]
 
 
 It looks like this function is called from ehci-hub.c:ehci_bus_suspend()
 which is wrapped in a #ifdef CONFIG_PM.

Ooh, yes.

 I guess the forward decl in ehci-hcd.c:
 static void unlink_empty_async_suspended(struct ehci_hcd *ehci)
 
 and the actual function in ehci-q.c need to be wrapped in a #ifdef
 CONFIG_PM as well.

Well, the declaration doesn't matter.  But the function itself does 
need to be wrapped.

 Let me know if you want me to send a patch for this.

Yes, please.

Alan Stern

--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Alan Stern
On Mon, 25 Mar 2013, Arnd Bergmann wrote:

 On Monday 25 March 2013, Alan Stern wrote:

   + if (!dev-dev.platform_data) {
   + dev-dev.platform_data = ehci_platform_defaults;
   + dev-dev.dma_mask = dev-dev.coherent_dma_mask;
   + dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);
  
  In view of Felipe's comment, shouldn't these last two lines be 
  controlled by dev-dev.of_node != NULL instead?
 
 We could do that, or alternatively like this
 
   if (!dev-dev.platform_data) {
   dev-dev.platform_data = ehci_platform_defaults;
   if (!dev-dev.dma_mask)
   dev-dev.dma_mask = dev-dev.coherent_dma_mask;
   if (!dev-dev.coherent_dma_mask)
   dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
 which would have the additional advantage that platforms can then
 call platform_device_register_resndata() to create the device
 and get a reasonable default dma mask (EHCI should always have
 32 bit DMA, unless the platform is really screwed), rather than
 statically declaring platform devices.

That's up to platform guys.  I wasn't aware of any common practice 
whereby drivers would fill in a missing dma_mask, except in the DT 
case.

Don't forget that EHCI is theoretically capable of using 64-bit DMA.  
This may not matter for any of the platforms you're concerned about 
now, but it may matter in the future.

Alan Stern

--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Arnd Bergmann
On Tuesday 26 March 2013, Alan Stern wrote:
 That's up to platform guys.  I wasn't aware of any common practice 
 whereby drivers would fill in a missing dma_mask, except in the DT 
 case.

I don't think we are consistent in any way. PowerPC sets up a 32 bit
DMA mask for all devices during DT probe from arch code, while the
common code sets up coherent_dma_mask but not dma_mask, except
for AMBA devices, which also get the 32 bit mask.

The MIPS Octeon and PowerPC PS3 EHCI backends set up the dma mask
because platform code doesn't do it for them, but both drivers are
not using DT. The Xilinx and PPC-OF EHCI back-end do not set it up,
because on microblaze and powerpc it does come from the platform
code.

I think it's a horrible mess and if anyone has an idea of what the
right solution is, we should probably implement that, but from what
I see here, setting a 32-bit dma mask unless there is already one
is a reasonable choice.

 Don't forget that EHCI is theoretically capable of using 64-bit DMA.  
 This may not matter for any of the platforms you're concerned about 
 now, but it may matter in the future.

Ah, I wasn't aware of that. I had previously used a platform EHCI on
PowerPC64 and the hardware manual said that it was 32-bit only.
Apparently the chip designers screwed up there.

Arnd
--
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: EHCI: DT support for generic bus glue

2013-03-26 Thread Alan Stern
On Tue, 26 Mar 2013, Arnd Bergmann wrote:

 I think it's a horrible mess and if anyone has an idea of what the
 right solution is, we should probably implement that, but from what
 I see here, setting a 32-bit dma mask unless there is already one
 is a reasonable choice.

Okay.

  Don't forget that EHCI is theoretically capable of using 64-bit DMA.  
  This may not matter for any of the platforms you're concerned about 
  now, but it may matter in the future.
 
 Ah, I wasn't aware of that. I had previously used a platform EHCI on
 PowerPC64 and the hardware manual said that it was 32-bit only.
 Apparently the chip designers screwed up there.

It's not as bad as that.  Until recently, EHCI hardware didn't support
the 64-bit option at all, or if it did, the support was buggy.  Even
now, I don't think it is very widespread.

Alan Stern

--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Arnd Bergmann
This lets us use the ehci-generic driver on platforms without special
requirements for their ehci controllers. In particular, this is true
for the vt8500/wm8x50 platforms, which currently have a separate
driver that causes problems with multiplatform configurations.

Cc: Tony Prisk li...@prisktech.co.nz
Cc: Alexey Charkov alch...@gmail.com
Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Arnd Bergmann a...@arndb.de
---
Tony, Alexey et al: could one of you test if this works for you?

 drivers/usb/host/ehci-hcd.c  |   5 --
 drivers/usb/host/ehci-platform.c |  28 ++--
 drivers/usb/host/ehci-vt8500.c   | 150 -
 3 files changed, 22 insertions(+), 161 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 0c3314c..960e7cf 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1286,11 +1286,6 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERehci_octeon_driver
 #endif
 
-#ifdef CONFIG_ARCH_VT8500
-#include ehci-vt8500.c
-#definePLATFORM_DRIVER vt8500_ehci_driver
-#endif
-
 #ifdef CONFIG_PLAT_SPEAR
 #include ehci-spear.c
 #define PLATFORM_DRIVERspear_ehci_hcd_driver
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index ca75063..27e9227 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -18,11 +18,13 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+#include linux/dma-mapping.h
 #include linux/err.h
 #include linux/kernel.h
 #include linux/hrtimer.h
 #include linux/io.h
 #include linux/module.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/usb.h
 #include linux/usb/hcd.h
@@ -62,22 +64,26 @@ static const struct ehci_driver_overrides 
platform_overrides __initdata = {
.reset =ehci_platform_reset,
 };
 
+static struct usb_ehci_pdata ehci_platform_defaults;
+
 static int ehci_platform_probe(struct platform_device *dev)
 {
struct usb_hcd *hcd;
struct resource *res_mem;
-   struct usb_ehci_pdata *pdata = dev-dev.platform_data;
+   struct usb_ehci_pdata *pdata;
int irq;
int err = -ENOMEM;
 
-   if (!pdata) {
-   WARN_ON(1);
-   return -ENODEV;
-   }
-
if (usb_disabled())
return -ENODEV;
 
+   if (!dev-dev.platform_data) {
+   dev-dev.platform_data = ehci_platform_defaults;
+   dev-dev.dma_mask = dev-dev.coherent_dma_mask;
+   dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);
+   }
+   pdata = dev-dev.platform_data;
+
irq = platform_get_irq(dev, 0);
if (irq  0) {
dev_err(dev-dev, no irq provided);
@@ -139,6 +145,9 @@ static int ehci_platform_remove(struct platform_device *dev)
if (pdata-power_off)
pdata-power_off(dev);
 
+   if (pdata == ehci_platform_defaults)
+   dev-dev.platform_data = NULL;
+
return 0;
 }
 
@@ -183,6 +192,12 @@ static int ehci_platform_resume(struct device *dev)
 #define ehci_platform_resume   NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id vt8500_ehci_ids[] = {
+   { .compatible = via,vt8500-ehci, },
+   { .compatible = wm,prizm-ehci, },
+   {}
+};
+
 static const struct platform_device_id ehci_platform_table[] = {
{ ehci-platform, 0 },
{ }
@@ -203,6 +218,7 @@ static struct platform_driver ehci_platform_driver = {
.owner  = THIS_MODULE,
.name   = ehci-platform,
.pm = ehci_platform_pm_ops,
+   .of_match_table = of_match_ptr(vt8500_ehci_ids),
}
 };
 
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c
deleted file mode 100644
index 7ecf709..000
--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Felipe Balbi
Hi,

On Mon, Mar 25, 2013 at 04:20:42PM +, Arnd Bergmann wrote:
 This lets us use the ehci-generic driver on platforms without special
 requirements for their ehci controllers. In particular, this is true
 for the vt8500/wm8x50 platforms, which currently have a separate
 driver that causes problems with multiplatform configurations.
 
 Cc: Tony Prisk li...@prisktech.co.nz
 Cc: Alexey Charkov alch...@gmail.com
 Acked-by: Alan Stern st...@rowland.harvard.edu
 Signed-off-by: Arnd Bergmann a...@arndb.de
 ---
 Tony, Alexey et al: could one of you test if this works for you?
 
  drivers/usb/host/ehci-hcd.c  |   5 --
  drivers/usb/host/ehci-platform.c |  28 ++--
  drivers/usb/host/ehci-vt8500.c   | 150 -
  3 files changed, 22 insertions(+), 161 deletions(-)
 
 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
 index 0c3314c..960e7cf 100644
 --- a/drivers/usb/host/ehci-hcd.c
 +++ b/drivers/usb/host/ehci-hcd.c
 @@ -1286,11 +1286,6 @@ MODULE_LICENSE (GPL);
  #define PLATFORM_DRIVER  ehci_octeon_driver
  #endif
  
 -#ifdef CONFIG_ARCH_VT8500
 -#include ehci-vt8500.c
 -#define  PLATFORM_DRIVER vt8500_ehci_driver
 -#endif
 -
  #ifdef CONFIG_PLAT_SPEAR
  #include ehci-spear.c
  #define PLATFORM_DRIVER  spear_ehci_hcd_driver
 diff --git a/drivers/usb/host/ehci-platform.c 
 b/drivers/usb/host/ehci-platform.c
 index ca75063..27e9227 100644
 --- a/drivers/usb/host/ehci-platform.c
 +++ b/drivers/usb/host/ehci-platform.c
 @@ -18,11 +18,13 @@
   *
   * Licensed under the GNU/GPL. See COPYING for details.
   */
 +#include linux/dma-mapping.h
  #include linux/err.h
  #include linux/kernel.h
  #include linux/hrtimer.h
  #include linux/io.h
  #include linux/module.h
 +#include linux/of.h
  #include linux/platform_device.h
  #include linux/usb.h
  #include linux/usb/hcd.h
 @@ -62,22 +64,26 @@ static const struct ehci_driver_overrides 
 platform_overrides __initdata = {
   .reset =ehci_platform_reset,
  };
  
 +static struct usb_ehci_pdata ehci_platform_defaults;

this ehci_platform_defaults is quite a hack. Would be much better to see
a proper re-factoring of the code so that it actually learns about DT
*and* platform_data.

So, if dev-dev.platform_data is NULL, you shouldn't error, rather you
should just assume the default, rather than this quick little hack.

Alan has final saying though.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] USB: EHCI: DT support for generic bus glue

2013-03-25 Thread Alan Stern
On Mon, 25 Mar 2013, Felipe Balbi wrote:

  @@ -62,22 +64,26 @@ static const struct ehci_driver_overrides 
  platform_overrides __initdata = {
  .reset =ehci_platform_reset,
   };
   
  +static struct usb_ehci_pdata ehci_platform_defaults;
 
 this ehci_platform_defaults is quite a hack. Would be much better to see
 a proper re-factoring of the code so that it actually learns about DT
 *and* platform_data.
 
 So, if dev-dev.platform_data is NULL, you shouldn't error, rather you
 should just assume the default, rather than this quick little hack.
 
 Alan has final saying though.

IMO, using ehci_platform_defaults _is_ a way of assuming the default.  
In other words, it's not a bad hack.  I'm okay with this this approach
(in fact, it was my suggestion originally).

On the other hand, it would be nice to have a clearer way of indicating 
that the driver was invoked because of a DT match, something better 
than just noticing that dev-dev.platform_data is NULL.  But I guess 
this is a legitimate option even for regular platform drivers -- if 
they don't have any specific requirements, they may as well pass a NULL 
pointer instead of a pointer to an empty structure.

Alan Stern

--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Tony Prisk
On Mon, 2013-03-25 at 16:20 +, Arnd Bergmann wrote:
 This lets us use the ehci-generic driver on platforms without special
 requirements for their ehci controllers. In particular, this is true
 for the vt8500/wm8x50 platforms, which currently have a separate
 driver that causes problems with multiplatform configurations.
 
 Cc: Tony Prisk li...@prisktech.co.nz
 Cc: Alexey Charkov alch...@gmail.com
 Acked-by: Alan Stern st...@rowland.harvard.edu
 Signed-off-by: Arnd Bergmann a...@arndb.de
 ---
 Tony, Alexey et al: could one of you test if this works for you?
 
  drivers/usb/host/ehci-hcd.c  |   5 --
  drivers/usb/host/ehci-platform.c |  28 ++--
  drivers/usb/host/ehci-vt8500.c   | 150 -
  3 files changed, 22 insertions(+), 161 deletions(-)

I'll take a look at this and get back to you before Easter.

Regards
Tony P

--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Arnd Bergmann
On Monday 25 March 2013, Tony Prisk wrote:
 I'll take a look at this and get back to you before Easter.
 

Great, thanks a lot!

Arnd
--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Felipe Balbi
On Mon, Mar 25, 2013 at 01:47:19PM -0400, Alan Stern wrote:
 On Mon, 25 Mar 2013, Felipe Balbi wrote:
 
   @@ -62,22 +64,26 @@ static const struct ehci_driver_overrides 
   platform_overrides __initdata = {
 .reset =ehci_platform_reset,
};

   +static struct usb_ehci_pdata ehci_platform_defaults;
  
  this ehci_platform_defaults is quite a hack. Would be much better to see
  a proper re-factoring of the code so that it actually learns about DT
  *and* platform_data.
  
  So, if dev-dev.platform_data is NULL, you shouldn't error, rather you
  should just assume the default, rather than this quick little hack.
  
  Alan has final saying though.
 
 IMO, using ehci_platform_defaults _is_ a way of assuming the default.  
 In other words, it's not a bad hack.  I'm okay with this this approach
 (in fact, it was my suggestion originally).
 
 On the other hand, it would be nice to have a clearer way of indicating 
 that the driver was invoked because of a DT match, something better 
 than just noticing that dev-dev.platform_data is NULL.  But I guess 
 this is a legitimate option even for regular platform drivers -- if 

usually we check that dev-of_node is a valid pointer.

 they don't have any specific requirements, they may as well pass a NULL 
 pointer instead of a pointer to an empty structure.

that was my point.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] USB: EHCI: DT support for generic bus glue

2013-03-25 Thread Arnd Bergmann
On Monday 25 March 2013, Alan Stern wrote:
 On Mon, 25 Mar 2013, Felipe Balbi wrote:

  this ehci_platform_defaults is quite a hack. Would be much better to see
  a proper re-factoring of the code so that it actually learns about DT
  and platform_data.
  
  So, if dev-dev.platform_data is NULL, you shouldn't error, rather you
  should just assume the default, rather than this quick little hack.
  
  Alan has final saying though.
 
 IMO, using ehci_platform_defaults is a way of assuming the default.  
 In other words, it's not a bad hack.  I'm okay with this this approach
 (in fact, it was my suggestion originally).

I intentionally did not add any properties for the fields in the current
usb_ehci_pdata. It's not possible to implement the callbacks using just
DT, and the flags are all defined so that 'false' is the default that
happens to be used by the compatible=wm,prizm-ehci binding.

We can easily extend this driver to also cover the flags or the
caps_offset, or we can add support for regulators and clocks, but
I would prefer to do those only when we actually add support for
a device that needs them.

 On the other hand, it would be nice to have a clearer way of indicating 
 that the driver was invoked because of a DT match, something better 
 than just noticing that dev-dev.platform_data is NULL.  But I guess 
 this is a legitimate option even for regular platform drivers -- if 
 they don't have any specific requirements, they may as well pass a NULL 
 pointer instead of a pointer to an empty structure.

I'm certainly fine doing it either way: leave the defaults for pdata=NULL
or require either a DT match or a pdata pointer (or both, in case of
auxdata, I guess).

Arnd
--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Alan Stern
On Mon, 25 Mar 2013, Arnd Bergmann wrote:

 This lets us use the ehci-generic driver on platforms without special
 requirements for their ehci controllers. In particular, this is true
 for the vt8500/wm8x50 platforms, which currently have a separate
 driver that causes problems with multiplatform configurations.

  static int ehci_platform_probe(struct platform_device *dev)
  {
   struct usb_hcd *hcd;
   struct resource *res_mem;
 - struct usb_ehci_pdata *pdata = dev-dev.platform_data;
 + struct usb_ehci_pdata *pdata;
   int irq;
   int err = -ENOMEM;
  
 - if (!pdata) {
 - WARN_ON(1);
 - return -ENODEV;
 - }
 -
   if (usb_disabled())
   return -ENODEV;
  
 + if (!dev-dev.platform_data) {
 + dev-dev.platform_data = ehci_platform_defaults;
 + dev-dev.dma_mask = dev-dev.coherent_dma_mask;
 + dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);

In view of Felipe's comment, shouldn't these last two lines be 
controlled by dev-dev.of_node != NULL instead?

Alan Stern

--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Arnd Bergmann
On Monday 25 March 2013, Alan Stern wrote:
   
  + if (!dev-dev.platform_data) {
  + dev-dev.platform_data = ehci_platform_defaults;
  + dev-dev.dma_mask = dev-dev.coherent_dma_mask;
  + dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
 In view of Felipe's comment, shouldn't these last two lines be 
 controlled by dev-dev.of_node != NULL instead?

We could do that, or alternatively like this

if (!dev-dev.platform_data) {
dev-dev.platform_data = ehci_platform_defaults;
if (!dev-dev.dma_mask)
dev-dev.dma_mask = dev-dev.coherent_dma_mask;
if (!dev-dev.coherent_dma_mask)
dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);

which would have the additional advantage that platforms can then
call platform_device_register_resndata() to create the device
and get a reasonable default dma mask (EHCI should always have
32 bit DMA, unless the platform is really screwed), rather than
statically declaring platform devices.

Arnd
--
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: EHCI: DT support for generic bus glue

2013-03-25 Thread Tony Prisk
On Mon, 2013-03-25 at 22:23 +, Arnd Bergmann wrote:
 On Monday 25 March 2013, Alan Stern wrote:

   + if (!dev-dev.platform_data) {
   + dev-dev.platform_data = ehci_platform_defaults;
   + dev-dev.dma_mask = dev-dev.coherent_dma_mask;
   + dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);
  
  In view of Felipe's comment, shouldn't these last two lines be 
  controlled by dev-dev.of_node != NULL instead?
 
 We could do that, or alternatively like this
 
   if (!dev-dev.platform_data) {
   dev-dev.platform_data = ehci_platform_defaults;
   if (!dev-dev.dma_mask)
   dev-dev.dma_mask = dev-dev.coherent_dma_mask;
   if (!dev-dev.coherent_dma_mask)
   dev-dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
 which would have the additional advantage that platforms can then
 call platform_device_register_resndata() to create the device
 and get a reasonable default dma mask (EHCI should always have
 32 bit DMA, unless the platform is really screwed), rather than
 statically declaring platform devices.
 
   Arnd
 

Should I be expecting a v2 or should I just test this patch as is?

Regards
Tony P

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