aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-omap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-omap.c')
-rw-r--r--drivers/usb/host/ehci-omap.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bba9850f32f0..5c78f9e71466 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -42,6 +42,7 @@
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/regulator/consumer.h> 43#include <linux/regulator/consumer.h>
44#include <linux/pm_runtime.h> 44#include <linux/pm_runtime.h>
45#include <linux/gpio.h>
45 46
46/* EHCI Register Set */ 47/* EHCI Register Set */
47#define EHCI_INSNREG04 (0xA0) 48#define EHCI_INSNREG04 (0xA0)
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
191 } 192 }
192 } 193 }
193 194
195 if (pdata->phy_reset) {
196 if (gpio_is_valid(pdata->reset_gpio_port[0]))
197 gpio_request_one(pdata->reset_gpio_port[0],
198 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
199
200 if (gpio_is_valid(pdata->reset_gpio_port[1]))
201 gpio_request_one(pdata->reset_gpio_port[1],
202 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
203
204 /* Hold the PHY in RESET for enough time till DIR is high */
205 udelay(10);
206 }
207
194 pm_runtime_enable(dev); 208 pm_runtime_enable(dev);
195 pm_runtime_get_sync(dev); 209 pm_runtime_get_sync(dev);
196 210
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
237 /* root ports should always stay powered */ 251 /* root ports should always stay powered */
238 ehci_port_power(omap_ehci, 1); 252 ehci_port_power(omap_ehci, 1);
239 253
254 if (pdata->phy_reset) {
255 /* Hold the PHY in RESET for enough time till
256 * PHY is settled and ready
257 */
258 udelay(10);
259
260 if (gpio_is_valid(pdata->reset_gpio_port[0]))
261 gpio_set_value(pdata->reset_gpio_port[0], 1);
262
263 if (gpio_is_valid(pdata->reset_gpio_port[1]))
264 gpio_set_value(pdata->reset_gpio_port[1], 1);
265 }
266
240 return 0; 267 return 0;
241 268
242err_add_hcd: 269err_add_hcd:
@@ -259,8 +286,9 @@ err_io:
259 */ 286 */
260static int ehci_hcd_omap_remove(struct platform_device *pdev) 287static int ehci_hcd_omap_remove(struct platform_device *pdev)
261{ 288{
262 struct device *dev = &pdev->dev; 289 struct device *dev = &pdev->dev;
263 struct usb_hcd *hcd = dev_get_drvdata(dev); 290 struct usb_hcd *hcd = dev_get_drvdata(dev);
291 struct ehci_hcd_omap_platform_data *pdata = dev->platform_data;
264 292
265 usb_remove_hcd(hcd); 293 usb_remove_hcd(hcd);
266 disable_put_regulator(dev->platform_data); 294 disable_put_regulator(dev->platform_data);
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
269 pm_runtime_put_sync(dev); 297 pm_runtime_put_sync(dev);
270 pm_runtime_disable(dev); 298 pm_runtime_disable(dev);
271 299
300 if (pdata->phy_reset) {
301 if (gpio_is_valid(pdata->reset_gpio_port[0]))
302 gpio_free(pdata->reset_gpio_port[0]);
303
304 if (gpio_is_valid(pdata->reset_gpio_port[1]))
305 gpio_free(pdata->reset_gpio_port[1]);
306 }
272 return 0; 307 return 0;
273} 308}
274 309