aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorVivek Gautam <gautam.vivek@samsung.com>2012-07-17 00:40:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-17 13:48:29 -0400
commitfd81d59c90d38661e4891ee2f4c9b7c051e93022 (patch)
tree3c1280657ba2c8aa549d2931e634b90c5a9d7f51 /drivers/usb
parentd81a5d1956731c453b85c141458d4ff5d6cc5366 (diff)
USB: ehci-s5p: Add vbus setup function to the s5p ehci glue layer
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-s5p.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 37d84cf9a408..9d8f1dd57cb3 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -15,6 +15,7 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/of_gpio.h>
18#include <plat/ehci.h> 19#include <plat/ehci.h>
19#include <plat/usb-phy.h> 20#include <plat/usb-phy.h>
20 21
@@ -64,6 +65,24 @@ static const struct hc_driver s5p_ehci_hc_driver = {
64 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 65 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
65}; 66};
66 67
68static void s5p_setup_vbus_gpio(struct platform_device *pdev)
69{
70 int err;
71 int gpio;
72
73 if (!pdev->dev.of_node)
74 return;
75
76 gpio = of_get_named_gpio(pdev->dev.of_node,
77 "samsung,vbus-gpio", 0);
78 if (!gpio_is_valid(gpio))
79 return;
80
81 err = gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "ehci_vbus_gpio");
82 if (err)
83 dev_err(&pdev->dev, "can't request ehci vbus gpio %d", gpio);
84}
85
67static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); 86static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
68 87
69static int __devinit s5p_ehci_probe(struct platform_device *pdev) 88static int __devinit s5p_ehci_probe(struct platform_device *pdev)
@@ -92,6 +111,8 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
92 if (!pdev->dev.coherent_dma_mask) 111 if (!pdev->dev.coherent_dma_mask)
93 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 112 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
94 113
114 s5p_setup_vbus_gpio(pdev);
115
95 s5p_ehci = devm_kzalloc(&pdev->dev, sizeof(struct s5p_ehci_hcd), 116 s5p_ehci = devm_kzalloc(&pdev->dev, sizeof(struct s5p_ehci_hcd),
96 GFP_KERNEL); 117 GFP_KERNEL);
97 if (!s5p_ehci) 118 if (!s5p_ehci)