diff options
author | Keshava Munegowda <Keshava_mgowda@ti.com> | 2011-04-21 10:22:43 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-05-02 08:29:26 -0400 |
commit | 6e3d4bec6b1e0829ed8b23be750762255f225019 (patch) | |
tree | 05d867705022dee4f6b37a808eb5e2e47cd67a88 /drivers | |
parent | d11536e4e0e99c26d33c849b44cd279cdd67b032 (diff) |
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')
-rw-r--r-- | drivers/mfd/omap-usb-host.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/ehci-omap.c | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index b3bb3ac5b045..2e165117457b 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/regulator/consumer.h> | ||
29 | #include <plat/usb.h> | 28 | #include <plat/usb.h> |
30 | 29 | ||
31 | #define USBHS_DRIVER_NAME "usbhs-omap" | 30 | #define USBHS_DRIVER_NAME "usbhs-omap" |
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 @@ | |||
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/usb/ulpi.h> | 41 | #include <linux/usb/ulpi.h> |
42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
43 | #include <linux/regulator/consumer.h> | ||
43 | 44 | ||
44 | /* EHCI Register Set */ | 45 | /* EHCI Register Set */ |
45 | #define EHCI_INSNREG04 (0xA0) | 46 | #define EHCI_INSNREG04 (0xA0) |
@@ -118,6 +119,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
118 | struct ehci_hcd *omap_ehci; | 119 | struct ehci_hcd *omap_ehci; |
119 | int ret = -ENODEV; | 120 | int ret = -ENODEV; |
120 | int irq; | 121 | int irq; |
122 | int i; | ||
123 | char supply[7]; | ||
121 | 124 | ||
122 | if (usb_disabled()) | 125 | if (usb_disabled()) |
123 | return -ENODEV; | 126 | return -ENODEV; |
@@ -158,6 +161,23 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
158 | hcd->rsrc_len = resource_size(res); | 161 | hcd->rsrc_len = resource_size(res); |
159 | hcd->regs = regs; | 162 | hcd->regs = regs; |
160 | 163 | ||
164 | /* get ehci regulator and enable */ | ||
165 | for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) { | ||
166 | if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { | ||
167 | pdata->regulator[i] = NULL; | ||
168 | continue; | ||
169 | } | ||
170 | snprintf(supply, sizeof(supply), "hsusb%d", i); | ||
171 | pdata->regulator[i] = regulator_get(dev, supply); | ||
172 | if (IS_ERR(pdata->regulator[i])) { | ||
173 | pdata->regulator[i] = NULL; | ||
174 | dev_dbg(dev, | ||
175 | "failed to get ehci port%d regulator\n", i); | ||
176 | } else { | ||
177 | regulator_enable(pdata->regulator[i]); | ||
178 | } | ||
179 | } | ||
180 | |||
161 | ret = omap_usbhs_enable(dev); | 181 | ret = omap_usbhs_enable(dev); |
162 | if (ret) { | 182 | if (ret) { |
163 | dev_err(dev, "failed to start usbhs with err %d\n", ret); | 183 | dev_err(dev, "failed to start usbhs with err %d\n", ret); |