aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGirish K S <girish@avatar.(none)>2012-10-08 14:06:33 +0900
committerTushar Behera <tushar.behera@linaro.org>2013-05-09 15:22:02 +0530
commitc2c80b67494281569a7a70c7e6077e78e10a271e (patch)
tree50e542809bf25549e5966eb4861779dbf8fe19c4
parent94f98ac293ffc2a52707ec280f88795d45f466ff (diff)
drivers: usb: add the HSIC port initialization
The hub-reset and hub-connect pins should be pulled low before phy init and need to be pulled high after completion of phy init. Signed-off-by: Girish K S <ks.giri@samsung.com>
-rw-r--r--drivers/usb/host/ehci-s5p.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 20ebf6a8b7f4..a93ab9903ada 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -90,6 +90,26 @@ static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
}
+static void s5p_setup_hub_gpio(struct platform_device *pdev, const char *propname, int level)
+{
+ int err;
+ int gpio;
+
+ if (!pdev->dev.of_node)
+ return;
+
+ gpio = of_get_named_gpio(pdev->dev.of_node, propname, 0);
+ if (!gpio_is_valid(gpio))
+ return;
+
+ err = gpio_request_one(gpio, level, "ehci_vbus_gpio");
+
+ if (err)
+ dev_err(&pdev->dev, "can't request ehci hub-reset gpio %d", gpio);
+ else
+ gpio_free(gpio);
+}
+
static void s5p_setup_vbus_gpio(struct platform_device *pdev)
{
int err;
@@ -200,8 +220,15 @@ static int s5p_ehci_probe(struct platform_device *pdev)
if (s5p_ehci->otg)
s5p_ehci->otg->set_host(s5p_ehci->otg, &s5p_ehci->hcd->self);
+ s5p_setup_hub_gpio(pdev, "samsung,hub-reset", GPIOF_OUT_INIT_LOW);
+ s5p_setup_hub_gpio(pdev, "samsung,hub-connect", GPIOF_OUT_INIT_LOW);
+
s5p_ehci_phy_enable(s5p_ehci);
+ mdelay(1);
+ s5p_setup_hub_gpio(pdev, "samsung,hub-reset", GPIOF_OUT_INIT_HIGH);
+ s5p_setup_hub_gpio(pdev, "samsung,hub-connect", GPIOF_OUT_INIT_HIGH);
+
ehci = hcd_to_ehci(hcd);
ehci->caps = hcd->regs;