Re: [PATCH 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-17 Thread Hans Ulli Kroll
Hi Linus

On Fri, 10 Feb 2017, Linus Walleij wrote:

> On Thu, Feb 9, 2017 at 3:20 PM, Hans Ulli Kroll
>  wrote:
> 
> > Add device tree probe for fotg2 driver
> >
> > v2:
> > fix in wrong MODULE_DEVICE_TABLE
> >
> > Signed-off-by: Hans Ulli Kroll 
> 
> Acked-by: Linus Walleij 
> 
> > +   /* Right now device-tree probed devices don't get dma_mask set.
> > +* Since shared usb code relies on it, set it here for now.
> > +* Once we have dma capability bindings this can go away.
> > +*/
> > +
> > +   retval = dma_coerce_mask_and_coherent(>dev, DMA_BIT_MASK(32));
> > +   if (retval)
> > +   goto fail_create_hcd;
> 
> Were you able to test this part? 

The driver itself is tested on my NAS 4220, which has *two* USB Ports. I 
transfered about 4 GB from one USB thumb drive to another one.

I must check my Inventory. I can remember of some Samsung SE-208BW.
It's CD/DVD Wifi device which uses also Gemini SoC, and has one host and 
gadget port.

And with the handling with the gadget port is odd. If this is connected 
with an USB host controller all parts are powerd off, only the CD/DVD part 
is running and the USB lines are passed trough. So there must be some 
switch device here.

There is also some VBUS and USB-ID pins controlled by the Gemini SoC, but 
these are not used on my NAS, maybe the CD/DVD Writer.

> I saw the gemini has some DMA engine
> but I never saw a driver for it. It looks like a reasonable thing to do to
> my untrained DMA eye.

I think the DMA engine is used for other stuff.
Some quick grep with SL2312_GENERAL_DMA_BASE and WRITE_DMA_REG
in the NAS 4420 sources 

drivers/char/gemini_i2s.c
drivers/telephony/gemini_ssp.c
drivers/telephony/gemini_ssp.h
include/asm-arm/arch-sl2312/gemini_i2s.h
include/asm-arm/arch-sl2312/gemini_ssp.h
sound/oss/Storm_ssp.c
sound/oss/storm_ssp.h

sound (via i2s) and telephone ???

Oh and your powercontroler is in
drivers/char/gemini_pwr.c

Greetings
Hans Ulli Kroll

--
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 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-10 Thread Arnd Bergmann
On Friday, February 10, 2017 2:12:36 PM CET Linus Walleij wrote:
> 
> > +   /* Right now device-tree probed devices don't get dma_mask set.
> > +* Since shared usb code relies on it, set it here for now.
> > +* Once we have dma capability bindings this can go away.
> > +*/
> > +
> > +   retval = dma_coerce_mask_and_coherent(>dev, DMA_BIT_MASK(32));
> > +   if (retval)
> > +   goto fail_create_hcd;
> 
> Were you able to test this part? I saw the gemini has some DMA engine
> but I never saw a driver for it. It looks like a reasonable thing to do to
> my untrained DMA eye.

We should never use dma_coerce_mask_and_coherent() for new code, it's
only needed for broken platforms without DT.

A 32-bit mask is set by default.

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 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-10 Thread Greg Kroah-Hartman
On Thu, Feb 09, 2017 at 03:20:49PM +0100, Hans Ulli Kroll wrote:
> 
> Add device tree probe for fotg2 driver
> 
> v2:
> fix in wrong MODULE_DEVICE_TABLE
> 
> Signed-off-by: Hans Ulli Kroll 
> ---
>  drivers/usb/host/fotg210-hcd.c | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 9d0b0518290a..2acc51b0be5a 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -23,6 +23,7 @@
>   * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -5600,6 +5601,15 @@ static int fotg210_hcd_probe(struct platform_device 
> *pdev)
>   if (usb_disabled())
>   return -ENODEV;
>  
> + /* Right now device-tree probed devices don't get dma_mask set.
> +  * Since shared usb code relies on it, set it here for now.
> +  * Once we have dma capability bindings this can go away.
> +  */
> +
> + retval = dma_coerce_mask_and_coherent(>dev, DMA_BIT_MASK(32));
> + if (retval)
> + goto fail_create_hcd;
> +

This change doesn't match up with what the changelog describes :(

--
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 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-10 Thread Linus Walleij
On Thu, Feb 9, 2017 at 3:20 PM, Hans Ulli Kroll
 wrote:

> Add device tree probe for fotg2 driver
>
> v2:
> fix in wrong MODULE_DEVICE_TABLE
>
> Signed-off-by: Hans Ulli Kroll 

Acked-by: Linus Walleij 

> +   /* Right now device-tree probed devices don't get dma_mask set.
> +* Since shared usb code relies on it, set it here for now.
> +* Once we have dma capability bindings this can go away.
> +*/
> +
> +   retval = dma_coerce_mask_and_coherent(>dev, DMA_BIT_MASK(32));
> +   if (retval)
> +   goto fail_create_hcd;

Were you able to test this part? I saw the gemini has some DMA engine
but I never saw a driver for it. It looks like a reasonable thing to do to
my untrained DMA eye.

Yours,
Linus Walleij
--
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 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-09 Thread Hans Ulli Kroll

Add device tree probe for fotg2 driver

v2:
fix in wrong MODULE_DEVICE_TABLE

Signed-off-by: Hans Ulli Kroll 
---
 drivers/usb/host/fotg210-hcd.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 9d0b0518290a..2acc51b0be5a 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -23,6 +23,7 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -5600,6 +5601,15 @@ static int fotg210_hcd_probe(struct platform_device 
*pdev)
if (usb_disabled())
return -ENODEV;
 
+   /* Right now device-tree probed devices don't get dma_mask set.
+* Since shared usb code relies on it, set it here for now.
+* Once we have dma capability bindings this can go away.
+*/
+
+   retval = dma_coerce_mask_and_coherent(>dev, DMA_BIT_MASK(32));
+   if (retval)
+   goto fail_create_hcd;
+
pdev->dev.power.power_state = PMSG_ON;
 
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -5676,9 +5686,18 @@ static int fotg210_hcd_remove(struct platform_device 
*pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id fotg210_ehci_match[] = {
+   { .compatible = "faraday,fotg210-hcd" },
+   {},
+};
+MODULE_DEVICE_TABLE(of, fotg210_ehci_match);
+#endif
+
 static struct platform_driver fotg210_hcd_driver = {
.driver = {
.name   = "fotg210-hcd",
+   .of_match_table = of_match_ptr(fotg210_ehci_match),
},
.probe  = fotg210_hcd_probe,
.remove = fotg210_hcd_remove,
-- 
2.11.0


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