aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShow Liu <show.liu@linaro.org>2013-12-25 10:59:12 +0800
committerShow Liu <show.liu@linaro.org>2014-04-15 23:52:20 +0800
commitb56a5f3fa531842e78ca97e569371242b608485b (patch)
tree38476d3d78d483fe6db44b6e1051ce1c57b9f754
parent861b526e125e3f32f27998ca3da0eda73628c325 (diff)
add ehci USB device and hub detect supportlsk-14.01_hdmi_mali.r3p0_arndale
-rw-r--r--drivers/usb/host/ehci-s5p.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 379037f51a2..42acff61cab 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -52,6 +52,25 @@ struct s5p_ehci_hcd {
#define to_s5p_ehci(hcd) (struct s5p_ehci_hcd *)(hcd_to_ehci(hcd)->priv)
+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)
{
struct device *dev = &pdev->dev;
@@ -65,10 +84,15 @@ static void s5p_setup_vbus_gpio(struct platform_device *pdev)
if (!gpio_is_valid(gpio))
return;
- err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
+ err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_LOW,
"ehci_vbus_gpio");
- if (err)
+ if (err) {
dev_err(dev, "can't request ehci vbus gpio %d", gpio);
+ return;
+ }
+
+ mdelay(1);
+ __gpio_set_value(gpio, 1);
}
static int s5p_ehci_probe(struct platform_device *pdev)
@@ -92,8 +116,6 @@ static int s5p_ehci_probe(struct platform_device *pdev)
if (!pdev->dev.coherent_dma_mask)
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
- s5p_setup_vbus_gpio(pdev);
-
hcd = usb_create_hcd(&s5p_ehci_hc_driver,
&pdev->dev, dev_name(&pdev->dev));
if (!hcd) {
@@ -116,6 +138,8 @@ static int s5p_ehci_probe(struct platform_device *pdev)
s5p_ehci->otg = phy->otg;
}
+ s5p_setup_vbus_gpio(pdev);
+
s5p_ehci->clk = devm_clk_get(&pdev->dev, "usbhost");
if (IS_ERR(s5p_ehci->clk)) {
@@ -154,11 +178,18 @@ static int s5p_ehci_probe(struct platform_device *pdev)
if (s5p_ehci->otg)
s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
+ s5p_setup_hub_gpio(pdev, "hub-reset", GPIOF_OUT_INIT_LOW);
+ s5p_setup_hub_gpio(pdev, "hub-connect", GPIOF_OUT_INIT_LOW);
+
if (s5p_ehci->phy)
usb_phy_init(s5p_ehci->phy);
else if (s5p_ehci->pdata->phy_init)
s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
+ mdelay(1);
+ s5p_setup_hub_gpio(pdev, "hub-reset", GPIOF_OUT_INIT_HIGH);
+ s5p_setup_hub_gpio(pdev, "hub-connect", GPIOF_OUT_INIT_HIGH);
+
ehci = hcd_to_ehci(hcd);
ehci->caps = hcd->regs;