mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vivek Gautam <gautam.vivek@samsung.com>
To: stern@rowland.harvard.edu, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org
Cc: l.majewski@samsung.com, a.kesavan@samsung.com,
	prashanth.g@samsung.com, kmpark@infradead.org, joshi@samsung.com,
	olofj@google.com, thomas.abraham@linaro.org,
	sshtylyov@mvista.com, av.tikhomirov@samsung.com
Subject: [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer
Date: Mon, 16 Jul 2012 11:27:39 +0530	[thread overview]
Message-ID: <1342418259-23802-3-git-send-email-gautam.vivek@samsung.com> (raw)
In-Reply-To: <1342418259-23802-1-git-send-email-gautam.vivek@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>
---
 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


  parent reply	other threads:[~2012-07-16  5:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Vivek Gautam [this message]
2012-07-20  9:51   ` [PATCH 2/2 v3] USB: dwc3-exynos: Add vbus setup function to the exynos dwc3 glue layer Felipe Balbi
     [not found]     ` <CAFp+6iENsdZW0tLRA-9QRPh4AvtyLq-Ebpty9zE+bd=hv3dKog@mail.gmail.com>
2012-07-23 15:24       ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342418259-23802-3-git-send-email-gautam.vivek@samsung.com \
    --to=gautam.vivek@samsung.com \
    --cc=a.kesavan@samsung.com \
    --cc=av.tikhomirov@samsung.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=joshi@samsung.com \
    --cc=kmpark@infradead.org \
    --cc=l.majewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=olofj@google.com \
    --cc=prashanth.g@samsung.com \
    --cc=sshtylyov@mvista.com \
    --cc=stern@rowland.harvard.edu \
    --cc=thomas.abraham@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®