diff options
author | Keshava Munegowda <Keshava_mgowda@ti.com> | 2011-04-21 18:22:43 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-05-02 16:29:26 +0400 |
commit | 6e3d4bec6b1e0829ed8b23be750762255f225019 (patch) | |
tree | 05d867705022dee4f6b37a808eb5e2e47cd67a88 /drivers/usb | |
parent | d11536e4e0e99c26d33c849b44cd279cdd67b032 (diff) | |
download | linux-6e3d4bec6b1e0829ed8b23be750762255f225019.tar.xz |
omap:usb: add regulator support for EHCI
in case of ehci phy mode; regulator of phy
should be enabled before initializing the
usbhs core driver.
Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>
Tested-by: Steve Calfee <stevecalfee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ehci-omap.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 7e41a95c5ceb..627f3a678759 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -40,6 +40,7 @@ #include <linux/slab.h> #include <linux/usb/ulpi.h> #include <plat/usb.h> +#include <linux/regulator/consumer.h> /* EHCI Register Set */ #define EHCI_INSNREG04 (0xA0) @@ -118,6 +119,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) struct ehci_hcd *omap_ehci; int ret = -ENODEV; int irq; + int i; + char supply[7]; if (usb_disabled()) return -ENODEV; @@ -158,6 +161,23 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) hcd->rsrc_len = resource_size(res); hcd->regs = regs; + /* get ehci regulator and enable */ + for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) { + if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { + pdata->regulator[i] = NULL; + continue; + } + snprintf(supply, sizeof(supply), "hsusb%d", i); + pdata->regulator[i] = regulator_get(dev, supply); + if (IS_ERR(pdata->regulator[i])) { + pdata->regulator[i] = NULL; + dev_dbg(dev, + "failed to get ehci port%d regulator\n", i); + } else { + regulator_enable(pdata->regulator[i]); + } + } + ret = omap_usbhs_enable(dev); if (ret) { dev_err(dev, "failed to start usbhs with err %d\n", ret); |