devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3 v2] USB: host: Add Device tree support for ohci-exynos & ehci-s5p
@ 2012-07-12  5:55 Vivek Gautam
       [not found] ` <1342072512-29945-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  2012-07-12  5:55 ` [PATCH 3/3 v2] USB: ehci-s5p: Add vbus setup function to the s5p ehci glue layer Vivek Gautam
  0 siblings, 2 replies; 6+ messages in thread
From: Vivek Gautam @ 2012-07-12  5:55 UTC (permalink / raw)
  To: stern, linux-usb, linux-kernel, devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, jg1.han,
	jy0922.shim, sshtylyov, olofj, Ajay Kumar

From: Ajay Kumar <ajaykumar.rs@samsung.com>

Changes from v1:
1) Added comment to explain inclusion of dma_mask through pdata.
2) Replaced gpio_request() with gpio_request_one()
3) Removed gpio_set_value()

This patchset is based and tested on 3.5 rc5.
Abhilash Kesavan (1):
  USB: ehci-s5p: Add vbus setup function to the s5p ehci glue layer

Vivek Gautam (2):
  USB: ohci-exynos: Add support for device tree
  USB: ehci-s5p: Add support for device tree

 drivers/usb/host/ehci-s5p.c    |   47 ++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci-exynos.c |   22 ++++++++++++++++++
 2 files changed, 69 insertions(+), 0 deletions(-)

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

* [PATCH 1/3 v2] USB: ohci-exynos: Add support for device tree
       [not found] ` <1342072512-29945-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2012-07-12  5:55   ` Vivek Gautam
  2012-07-13  7:04     ` Jingoo Han
  2012-07-12  5:55   ` [PATCH 2/3 v2] USB: ehci-s5p: " Vivek Gautam
  1 sibling, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2012-07-12  5:55 UTC (permalink / raw)
  To: stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: l.majewski-Sze3O3UU22JBDgjK7y7TUQ,
	a.kesavan-Sze3O3UU22JBDgjK7y7TUQ,
	prashanth.g-Sze3O3UU22JBDgjK7y7TUQ, kmpark-wEGCiKHe2LqWVfeAwA7xHQ,
	joshi-Sze3O3UU22JBDgjK7y7TUQ, jg1.han-Sze3O3UU22JBDgjK7y7TUQ,
	jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ,
	sshtylyov-Igf4POYTYCDQT0dZR+AlfA, olofj-hpIqsD4AKlfQT0dZR+AlfA

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

Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Signed-off-by: Abhilash Kesavan <a.kesavan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Vivek Gautam <gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 2909621..c4ad60f 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <mach/ohci.h>
 #include <plat/usb-phy.h>
@@ -71,6 +72,8 @@ static const struct hc_driver exynos_ohci_hc_driver = {
 	.start_port_reset	= ohci_start_port_reset,
 };
 
+static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32);
+
 static int __devinit exynos_ohci_probe(struct platform_device *pdev)
 {
 	struct exynos4_ohci_platdata *pdata;
@@ -87,6 +90,16 @@ static int __devinit exynos_ohci_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	/*
+	 * 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 = &ohci_exynos_dma_mask;
+	if (!pdev->dev.coherent_dma_mask)
+		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+
 	exynos_ohci = kzalloc(sizeof(struct exynos_ohci_hcd), GFP_KERNEL);
 	if (!exynos_ohci)
 		return -ENOMEM;
@@ -258,6 +271,14 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {
 	.resume		= exynos_ohci_resume,
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id exynos_ohci_match[] = {
+	{ .compatible = "samsung,exynos-ohci" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, exynos_ohci_match);
+#endif
+
 static struct platform_driver exynos_ohci_driver = {
 	.probe		= exynos_ohci_probe,
 	.remove		= __devexit_p(exynos_ohci_remove),
@@ -266,6 +287,7 @@ static struct platform_driver exynos_ohci_driver = {
 		.name	= "exynos-ohci",
 		.owner	= THIS_MODULE,
 		.pm	= &exynos_ohci_pm_ops,
+		.of_match_table	= of_match_ptr(exynos_ohci_match),
 	}
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/3 v2] USB: ehci-s5p: Add support for device tree
       [not found] ` <1342072512-29945-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  2012-07-12  5:55   ` [PATCH 1/3 v2] USB: ohci-exynos: Add support for device tree Vivek Gautam
@ 2012-07-12  5:55   ` Vivek Gautam
  2012-07-13  7:03     ` Jingoo Han
  1 sibling, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2012-07-12  5:55 UTC (permalink / raw)
  To: stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
  Cc: l.majewski-Sze3O3UU22JBDgjK7y7TUQ,
	a.kesavan-Sze3O3UU22JBDgjK7y7TUQ,
	prashanth.g-Sze3O3UU22JBDgjK7y7TUQ, kmpark-wEGCiKHe2LqWVfeAwA7xHQ,
	joshi-Sze3O3UU22JBDgjK7y7TUQ, jg1.han-Sze3O3UU22JBDgjK7y7TUQ,
	jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ,
	sshtylyov-Igf4POYTYCDQT0dZR+AlfA, olofj-hpIqsD4AKlfQT0dZR+AlfA

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

Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Signed-off-by: Abhilash Kesavan <a.kesavan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Vivek Gautam <gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index c474cec..52d0049 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -13,6 +13,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <plat/ehci.h>
 #include <plat/usb-phy.h>
@@ -63,6 +64,8 @@ static const struct hc_driver s5p_ehci_hc_driver = {
 	.clear_tt_buffer_complete	= ehci_clear_tt_buffer_complete,
 };
 
+static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
+
 static int __devinit s5p_ehci_probe(struct platform_device *pdev)
 {
 	struct s5p_ehci_platdata *pdata;
@@ -79,6 +82,16 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	/*
+	 * 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 = &ehci_s5p_dma_mask;
+	if (!pdev->dev.coherent_dma_mask)
+		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+
 	s5p_ehci = kzalloc(sizeof(struct s5p_ehci_hcd), GFP_KERNEL);
 	if (!s5p_ehci)
 		return -ENOMEM;
@@ -298,6 +311,14 @@ static int s5p_ehci_resume(struct device *dev)
 #define s5p_ehci_resume		NULL
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id exynos_ehci_match[] = {
+	{ .compatible = "samsung,exynos-ehci" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, exynos_ehci_match);
+#endif
+
 static const struct dev_pm_ops s5p_ehci_pm_ops = {
 	.suspend	= s5p_ehci_suspend,
 	.resume		= s5p_ehci_resume,
@@ -311,6 +332,7 @@ static struct platform_driver s5p_ehci_driver = {
 		.name	= "s5p-ehci",
 		.owner	= THIS_MODULE,
 		.pm	= &s5p_ehci_pm_ops,
+		.of_match_table = of_match_ptr(exynos_ehci_match),
 	}
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/3 v2] USB: ehci-s5p: Add vbus setup function to the s5p ehci glue layer
  2012-07-12  5:55 [PATCH 0/3 v2] USB: host: Add Device tree support for ohci-exynos & ehci-s5p Vivek Gautam
       [not found] ` <1342072512-29945-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2012-07-12  5:55 ` Vivek Gautam
  1 sibling, 0 replies; 6+ messages in thread
From: Vivek Gautam @ 2012-07-12  5:55 UTC (permalink / raw)
  To: stern, linux-usb, linux-kernel, devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, jg1.han,
	jy0922.shim, sshtylyov, olofj

From: Abhilash Kesavan <a.kesavan@samsung.com>

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>

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 52d0049..9f9870c 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -15,6 +15,7 @@
 #include <linux/clk.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/of_gpio.h>
 #include <plat/ehci.h>
 #include <plat/usb-phy.h>
 
@@ -64,6 +65,28 @@ static const struct hc_driver s5p_ehci_hc_driver = {
 	.clear_tt_buffer_complete	= ehci_clear_tt_buffer_complete,
 };
 
+static int s5p_ehci_setup_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, "ehci_vbus_gpio");
+	if (err) {
+		dev_err(&pdev->dev, "can't request ehci vbus gpio %d", gpio);
+		return err;
+	}
+
+	return err;
+}
+
 static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
 
 static int __devinit s5p_ehci_probe(struct platform_device *pdev)
@@ -92,6 +115,8 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
 	if (!pdev->dev.coherent_dma_mask)
 		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
+	s5p_ehci_setup_gpio(pdev);
+
 	s5p_ehci = kzalloc(sizeof(struct s5p_ehci_hcd), GFP_KERNEL);
 	if (!s5p_ehci)
 		return -ENOMEM;
-- 
1.7.0.4

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

* Re: [PATCH 2/3 v2] USB: ehci-s5p: Add support for device tree
  2012-07-12  5:55   ` [PATCH 2/3 v2] USB: ehci-s5p: " Vivek Gautam
@ 2012-07-13  7:03     ` Jingoo Han
  0 siblings, 0 replies; 6+ messages in thread
From: Jingoo Han @ 2012-07-13  7:03 UTC (permalink / raw)
  To: 'Vivek Gautam', stern, linux-usb, linux-kernel,
	devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, jy0922.shim,
	sshtylyov, olofj, 'Jingoo Han'

On Thursday, July 12, 2012 2:55 PM, Vivek Gautam wrote:
> 
> This patch adds support to parse probe data for
> ehci driver for exynos using device tree
> 
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> 
> diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
> index c474cec..52d0049 100644
> --- a/drivers/usb/host/ehci-s5p.c
> +++ b/drivers/usb/host/ehci-s5p.c
> @@ -13,6 +13,7 @@
>   */
> 
>  #include <linux/clk.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <plat/ehci.h>
>  #include <plat/usb-phy.h>
> @@ -63,6 +64,8 @@ static const struct hc_driver s5p_ehci_hc_driver = {
>  	.clear_tt_buffer_complete	= ehci_clear_tt_buffer_complete,
>  };
> 
> +static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
> +
>  static int __devinit s5p_ehci_probe(struct platform_device *pdev)
>  {
>  	struct s5p_ehci_platdata *pdata;
> @@ -79,6 +82,16 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
> 
> +	/*
> +	 * 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 = &ehci_s5p_dma_mask;
> +	if (!pdev->dev.coherent_dma_mask)
> +		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +
>  	s5p_ehci = kzalloc(sizeof(struct s5p_ehci_hcd), GFP_KERNEL);

This makes conflict on 'usb-next' branch.
Please re-base the patch on 'usb-next' branch.


>  	if (!s5p_ehci)
>  		return -ENOMEM;
> @@ -298,6 +311,14 @@ static int s5p_ehci_resume(struct device *dev)
>  #define s5p_ehci_resume		NULL
>  #endif
> 
> +#ifdef CONFIG_OF
> +static const struct of_device_id exynos_ehci_match[] = {
> +	{ .compatible = "samsung,exynos-ehci" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, exynos_ehci_match);
> +#endif
> +

Please move " struct of_device_id exynos_ehci_match[]"
to the next of "struct dev_pm_ops s5p_ehci_pm_ops",
as you did at 1st patch '[PATCH 1/3 v2] USB: ohci-exynos: Add support for device tree'.

Please keep the code sync as possible.

>  static const struct dev_pm_ops s5p_ehci_pm_ops = {
>  	.suspend	= s5p_ehci_suspend,
>  	.resume		= s5p_ehci_resume,
> @@ -311,6 +332,7 @@ static struct platform_driver s5p_ehci_driver = {
>  		.name	= "s5p-ehci",
>  		.owner	= THIS_MODULE,
>  		.pm	= &s5p_ehci_pm_ops,
> +		.of_match_table = of_match_ptr(exynos_ehci_match),
>  	}
>  };
> 
> --
> 1.7.0.4

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

* Re: [PATCH 1/3 v2] USB: ohci-exynos: Add support for device tree
  2012-07-12  5:55   ` [PATCH 1/3 v2] USB: ohci-exynos: Add support for device tree Vivek Gautam
@ 2012-07-13  7:04     ` Jingoo Han
  0 siblings, 0 replies; 6+ messages in thread
From: Jingoo Han @ 2012-07-13  7:04 UTC (permalink / raw)
  To: 'Vivek Gautam', stern, linux-usb, linux-kernel,
	devicetree-discuss
  Cc: l.majewski, a.kesavan, prashanth.g, kmpark, joshi, jy0922.shim,
	sshtylyov, olofj, 'Jingoo Han'

On Thursday, July 12, 2012 2:55 PM, Vivek Gautam wrote:
> 
> This patch adds support to parse probe data for
> ohci driver for exynos using device tree.
> 
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> 
> diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
> index 2909621..c4ad60f 100644
> --- a/drivers/usb/host/ohci-exynos.c
> +++ b/drivers/usb/host/ohci-exynos.c
> @@ -12,6 +12,7 @@
>   */
> 
>  #include <linux/clk.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <mach/ohci.h>
>  #include <plat/usb-phy.h>
> @@ -71,6 +72,8 @@ static const struct hc_driver exynos_ohci_hc_driver = {
>  	.start_port_reset	= ohci_start_port_reset,
>  };
> 
> +static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32);
> +
>  static int __devinit exynos_ohci_probe(struct platform_device *pdev)
>  {
>  	struct exynos4_ohci_platdata *pdata;
> @@ -87,6 +90,16 @@ static int __devinit exynos_ohci_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
> 
> +	/*
> +	 * 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 = &ohci_exynos_dma_mask;
> +	if (!pdev->dev.coherent_dma_mask)
> +		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +
>  	exynos_ohci = kzalloc(sizeof(struct exynos_ohci_hcd), GFP_KERNEL);

This makes conflict on 'usb-next' branch.
Please re-base the patch on 'usb-next' branch.

>  	if (!exynos_ohci)
>  		return -ENOMEM;
> @@ -258,6 +271,14 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {
>  	.resume		= exynos_ohci_resume,
>  };
> 
> +#ifdef CONFIG_OF
> +static const struct of_device_id exynos_ohci_match[] = {
> +	{ .compatible = "samsung,exynos-ohci" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, exynos_ohci_match);
> +#endif
> +
>  static struct platform_driver exynos_ohci_driver = {
>  	.probe		= exynos_ohci_probe,
>  	.remove		= __devexit_p(exynos_ohci_remove),
> @@ -266,6 +287,7 @@ static struct platform_driver exynos_ohci_driver = {
>  		.name	= "exynos-ohci",
>  		.owner	= THIS_MODULE,
>  		.pm	= &exynos_ohci_pm_ops,
> +		.of_match_table	= of_match_ptr(exynos_ohci_match),
>  	}
>  };
> 
> --
> 1.7.0.4

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

end of thread, other threads:[~2012-07-13  7:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12  5:55 [PATCH 0/3 v2] USB: host: Add Device tree support for ohci-exynos & ehci-s5p Vivek Gautam
     [not found] ` <1342072512-29945-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-07-12  5:55   ` [PATCH 1/3 v2] USB: ohci-exynos: Add support for device tree Vivek Gautam
2012-07-13  7:04     ` Jingoo Han
2012-07-12  5:55   ` [PATCH 2/3 v2] USB: ehci-s5p: " Vivek Gautam
2012-07-13  7:03     ` Jingoo Han
2012-07-12  5:55 ` [PATCH 3/3 v2] USB: ehci-s5p: Add vbus setup function to the s5p ehci glue layer Vivek Gautam

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