linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2 v3] USB: host: Add Device tree support for dwc3-exynos
@ 2012-07-16  5:57 Vivek Gautam
  2012-07-16  5:57 ` [PATCH 1/2 v3] USB: dwc3-exynos: Add support for device tree Vivek Gautam
  2012-07-16  5:57 ` [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer Vivek Gautam
  0 siblings, 2 replies; 6+ messages in thread
From: Vivek Gautam @ 2012-07-16  5:57 UTC (permalink / raw)
  To: stern, linux-usb, linux-kernel, devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, olofj,
	thomas.abraham, sshtylyov, av.tikhomirov

Changes from v1:
1) Rebased on 'usb-next' branch.

Vivek Gautam (2):
  USB: dwc3-exynos: Add support for device tree
  USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue
    layer

 drivers/usb/dwc3/dwc3-exynos.c |   47 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)


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

* [PATCH 1/2 v3] USB: dwc3-exynos: Add support for device tree
  2012-07-16  5:57 [PATCH 0/2 v3] USB: host: Add Device tree support for dwc3-exynos Vivek Gautam
@ 2012-07-16  5:57 ` Vivek Gautam
  2012-07-20  9:49   ` Felipe Balbi
  2012-07-16  5:57 ` [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer Vivek Gautam
  1 sibling, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2012-07-16  5:57 UTC (permalink / raw)
  To: stern, linux-usb, linux-kernel, devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, olofj,
	thomas.abraham, sshtylyov, av.tikhomirov

This patch adds support to parse probe data for
dwc3 driver for exynos using device tree

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 drivers/usb/dwc3/dwc3-exynos.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index b8f0038..a293c69 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -19,6 +19,7 @@
 #include <linux/platform_data/dwc3-exynos.h>
 #include <linux/dma-mapping.h>
 #include <linux/clk.h>
+#include <linux/of.h>
 
 #include "core.h"
 
@@ -29,6 +30,8 @@ struct dwc3_exynos {
 	struct clk		*clk;
 };
 
+static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
+
 static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
 {
 	struct dwc3_exynos_data	*pdata = pdev->dev.platform_data;
@@ -45,6 +48,16 @@ static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
 		goto err0;
 	}
 
+	/*
+	 * 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 move to full device tree support this will vanish off.
+	 */
+	if (!pdev->dev.dma_mask)
+		pdev->dev.dma_mask = &dwc3_exynos_dma_mask;
+	if (!pdev->dev.coherent_dma_mask)
+		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+
 	platform_set_drvdata(pdev, exynos);
 
 	devid = dwc3_get_device_id();
@@ -134,11 +147,20 @@ static int __devexit dwc3_exynos_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id exynos_xhci_match[] = {
+	{ .compatible = "samsung,exynos-xhci" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, exynos_xhci_match);
+#endif
+
 static struct platform_driver dwc3_exynos_driver = {
 	.probe		= dwc3_exynos_probe,
 	.remove		= __devexit_p(dwc3_exynos_remove),
 	.driver		= {
 		.name	= "exynos-dwc3",
+		.of_match_table = of_match_ptr(exynos_xhci_match),
 	},
 };
 
-- 
1.7.0.4


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

* [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer
  2012-07-16  5:57 [PATCH 0/2 v3] USB: host: Add Device tree support for dwc3-exynos Vivek Gautam
  2012-07-16  5:57 ` [PATCH 1/2 v3] USB: dwc3-exynos: Add support for device tree Vivek Gautam
@ 2012-07-16  5:57 ` Vivek Gautam
  2012-07-20  9:51   ` Felipe Balbi
  1 sibling, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2012-07-16  5:57 UTC (permalink / raw)
  To: stern, linux-usb, linux-kernel, devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, olofj,
	thomas.abraham, sshtylyov, av.tikhomirov

This patch retrieves and configures the vbus control gpio via
the device tree. The suspend/resume callbacks will be later
modified for vbus control.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 drivers/usb/dwc3/dwc3-exynos.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index a293c69..9b0238f 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -20,6 +20,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/clk.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 
 #include "core.h"
 
@@ -30,6 +31,28 @@ struct dwc3_exynos {
 	struct clk		*clk;
 };
 
+static int dwc3_setup_vbus_gpio(struct platform_device *pdev)
+{
+	int err;
+	int gpio;
+
+	if (!pdev->dev.of_node)
+		return 0;
+
+	gpio = of_get_named_gpio(pdev->dev.of_node,
+				"samsung,vbus-gpio", 0);
+	if (!gpio_is_valid(gpio))
+		return 0;
+
+	err = gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "dwc3_vbus_gpio");
+	if (err) {
+		dev_err(&pdev->dev, "can't request dwc3 vbus gpio %d", gpio);
+		return err;
+	}
+
+	return err;
+}
+
 static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
 
 static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
@@ -58,6 +81,8 @@ static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
 	if (!pdev->dev.coherent_dma_mask)
 		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
+	dwc3_setup_vbus_gpio(pdev);
+
 	platform_set_drvdata(pdev, exynos);
 
 	devid = dwc3_get_device_id();
-- 
1.7.0.4


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

* Re: [PATCH 1/2 v3] USB: dwc3-exynos: Add support for device tree
  2012-07-16  5:57 ` [PATCH 1/2 v3] USB: dwc3-exynos: Add support for device tree Vivek Gautam
@ 2012-07-20  9:49   ` Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2012-07-20  9:49 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: stern, linux-usb, linux-kernel, devicetree-discuss, l.majewski,
	a.kesavan, prashanth.g, kmpark, joshi, olofj, thomas.abraham,
	sshtylyov, av.tikhomirov

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

Hi,

On Mon, Jul 16, 2012 at 11:27:38AM +0530, Vivek Gautam wrote:
> This patch adds support to parse probe data for
> dwc3 driver for exynos using device tree
> 
> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  drivers/usb/dwc3/dwc3-exynos.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index b8f0038..a293c69 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -19,6 +19,7 @@
>  #include <linux/platform_data/dwc3-exynos.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/clk.h>
> +#include <linux/of.h>
>  
>  #include "core.h"
>  
> @@ -29,6 +30,8 @@ struct dwc3_exynos {
>  	struct clk		*clk;
>  };
>  
> +static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
> +
>  static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
>  {
>  	struct dwc3_exynos_data	*pdata = pdev->dev.platform_data;
> @@ -45,6 +48,16 @@ static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
>  		goto err0;
>  	}
>  
> +	/*
> +	 * 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 move to full device tree support this will vanish off.
> +	 */
> +	if (!pdev->dev.dma_mask)
> +		pdev->dev.dma_mask = &dwc3_exynos_dma_mask;
> +	if (!pdev->dev.coherent_dma_mask)
> +		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +
>  	platform_set_drvdata(pdev, exynos);
>  
>  	devid = dwc3_get_device_id();
> @@ -134,11 +147,20 @@ static int __devexit dwc3_exynos_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id exynos_xhci_match[] = {
> +	{ .compatible = "samsung,exynos-xhci" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, exynos_xhci_match);

this is not an xhci device. It contains one inside of it, but it's not
an xhci device.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer
  2012-07-16  5:57 ` [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer Vivek Gautam
@ 2012-07-20  9:51   ` Felipe Balbi
       [not found]     ` <CAFp+6iENsdZW0tLRA-9QRPh4AvtyLq-Ebpty9zE+bd=hv3dKog@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2012-07-20  9:51 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: stern, linux-usb, linux-kernel, devicetree-discuss, l.majewski,
	a.kesavan, prashanth.g, kmpark, joshi, olofj, thomas.abraham,
	sshtylyov, av.tikhomirov

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

Hi,

On Mon, Jul 16, 2012 at 11:27:39AM +0530, Vivek Gautam wrote:
> This patch retrieves and configures the vbus control gpio via
> the device tree. The suspend/resume callbacks will be later
> modified for vbus control.
> 
> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  drivers/usb/dwc3/dwc3-exynos.c |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index a293c69..9b0238f 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -20,6 +20,7 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/clk.h>
>  #include <linux/of.h>
> +#include <linux/of_gpio.h>
>  
>  #include "core.h"
>  
> @@ -30,6 +31,28 @@ struct dwc3_exynos {
>  	struct clk		*clk;
>  };
>  
> +static int dwc3_setup_vbus_gpio(struct platform_device *pdev)
> +{
> +	int err;
> +	int gpio;
> +
> +	if (!pdev->dev.of_node)
> +		return 0;
> +
> +	gpio = of_get_named_gpio(pdev->dev.of_node,
> +				"samsung,vbus-gpio", 0);
> +	if (!gpio_is_valid(gpio))
> +		return 0;
> +
> +	err = gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "dwc3_vbus_gpio");
> +	if (err) {
> +		dev_err(&pdev->dev, "can't request dwc3 vbus gpio %d", gpio);
> +		return err;
> +	}
> +
> +	return err;
> +}
> +
>  static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
>  
>  static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
> @@ -58,6 +81,8 @@ static int __devinit dwc3_exynos_probe(struct platform_device *pdev)
>  	if (!pdev->dev.coherent_dma_mask)
>  		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>  
> +	dwc3_setup_vbus_gpio(pdev);

I think this should be handled by the gpio-vbus transceiver. No ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer
       [not found]     ` <CAFp+6iENsdZW0tLRA-9QRPh4AvtyLq-Ebpty9zE+bd=hv3dKog@mail.gmail.com>
@ 2012-07-23 15:24       ` Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2012-07-23 15:24 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: balbi, Vivek Gautam, stern, linux-usb, linux-kernel,
	devicetree-discuss, l.majewski, a.kesavan, prashanth.g, kmpark,
	joshi, olofj, thomas.abraham, sshtylyov, av.tikhomirov

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

Hi,

On Tue, Jul 24, 2012 at 12:09:47AM +0900, Vivek Gautam wrote:
<snip>
> > > @@ -58,6 +81,8 @@ static int __devinit dwc3_exynos_probe(struct
> > platform_device *pdev)
> > >       if (!pdev->dev.coherent_dma_mask)
> > >               pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> > >
> > > +     dwc3_setup_vbus_gpio(pdev);
> >
> > I think this should be handled by the gpio-vbus transceiver. No ?
> >
> > I can understand that we can use gpio-vbus transceiver. But i have one
> confusion here.
> We have ehci as well as this dwc3 which need gpio to be setup to
> control vbus. So do we have two instances of this gpio-vbus driver to
> facilitate both ehci and dwc3, because both may be on different gpio
> lines.

Sure... one for dwc3 and one for ehci.

> Moreover, the gpio line right now is parsed from the DT node of the
> device, so while assigning the 'gpio_vbus' field in
> 'gpio_vbus_mach_info', how do we provide that. Please suggest.

gpio-vbus doesn't have support for DT today, just add it ;-)

> One more suggestion please. Now that we are moving to DT we should be
> making changes for gpio-vbus transceiver also for device tree support.

yes, it needs support for DT before you can use it then.

cheers

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-07-23 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16  5:57 [PATCH 0/2 v3] USB: host: Add Device tree support for dwc3-exynos Vivek Gautam
2012-07-16  5:57 ` [PATCH 1/2 v3] USB: dwc3-exynos: Add support for device tree Vivek Gautam
2012-07-20  9:49   ` Felipe Balbi
2012-07-16  5:57 ` [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer Vivek Gautam
2012-07-20  9:51   ` Felipe Balbi
     [not found]     ` <CAFp+6iENsdZW0tLRA-9QRPh4AvtyLq-Ebpty9zE+bd=hv3dKog@mail.gmail.com>
2012-07-23 15:24       ` Felipe Balbi

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