diff options
author | Girish K S <girish@avatar.(none)> | 2012-10-08 14:06:33 +0900 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2013-05-24 08:36:19 +0530 |
commit | 0859da1729c3ba5744e1f78690a9f2edc71e6f5c (patch) | |
tree | b8e865b2ca50f5a9c75e926a33df87c731a0efc3 | |
parent | 7938a04c2d5ee57c7b5fdfadd3ed7116d2f7fec2 (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.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 319dcfaa8735..36e3214bef35 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c @@ -65,6 +65,26 @@ static const struct hc_driver s5p_ehci_hc_driver = { .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, }; +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; @@ -163,9 +183,16 @@ static int s5p_ehci_probe(struct platform_device *pdev) goto fail_io; } + s5p_setup_hub_gpio(pdev, "samsung,hub-reset", GPIOF_OUT_INIT_LOW); + s5p_setup_hub_gpio(pdev, "samsung,hub-connect", GPIOF_OUT_INIT_LOW); + if (pdata->phy_init) pdata->phy_init(pdev, S5P_USB_PHY_HOST); + 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; |