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.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 6e15fc87cf60..6133d93808dc 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -145,6 +145,56 @@ static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port)
145 } 145 }
146} 146}
147 147
148static int omap_ehci_init(struct usb_hcd *hcd)
149{
150 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
151 int rc;
152 struct ehci_hcd_omap_platform_data *pdata;
153
154 pdata = hcd->self.controller->platform_data;
155 if (pdata->phy_reset) {
156 if (gpio_is_valid(pdata->reset_gpio_port[0]))
157 gpio_request_one(pdata->reset_gpio_port[0],
158 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
159
160 if (gpio_is_valid(pdata->reset_gpio_port[1]))
161 gpio_request_one(pdata->reset_gpio_port[1],
162 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
163
164 /* Hold the PHY in RESET for enough time till DIR is high */
165 udelay(10);
166 }
167
168 /* Soft reset the PHY using PHY reset command over ULPI */
169 if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
170 omap_ehci_soft_phy_reset(pdev, 0);
171 if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
172 omap_ehci_soft_phy_reset(pdev, 1);
173
174 /* we know this is the memory we want, no need to ioremap again */
175 ehci->caps = hcd->regs;
176
177 rc = ehci_setup(hcd);
178
179 if (pdata->phy_reset) {
180 /* Hold the PHY in RESET for enough time till
181 * PHY is settled and ready
182 */
183 udelay(10);
184
185 if (gpio_is_valid(pdata->reset_gpio_port[0]))
186 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 1);
187
188 if (gpio_is_valid(pdata->reset_gpio_port[1]))
189 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
190 }
191
192 /* root ports should always stay powered */
193 ehci_port_power(ehci, 1);
194
195 return rc;
196}
197
148static int omap_ehci_hub_control( 198static int omap_ehci_hub_control(
149 struct usb_hcd *hcd, 199 struct usb_hcd *hcd,
150 u16 typeReq, 200 u16 typeReq,
@@ -219,7 +269,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
219 struct resource *res; 269 struct resource *res;
220 struct usb_hcd *hcd; 270 struct usb_hcd *hcd;
221 void __iomem *regs; 271 void __iomem *regs;
222 struct ehci_hcd *omap_ehci;
223 int ret = -ENODEV; 272 int ret = -ENODEV;
224 int irq; 273 int irq;
225 int i; 274 int i;
@@ -281,19 +330,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
281 } 330 }
282 } 331 }
283 332
284 if (pdata->phy_reset) {
285 if (gpio_is_valid(pdata->reset_gpio_port[0]))
286 gpio_request_one(pdata->reset_gpio_port[0],
287 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
288
289 if (gpio_is_valid(pdata->reset_gpio_port[1]))
290 gpio_request_one(pdata->reset_gpio_port[1],
291 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
292
293 /* Hold the PHY in RESET for enough time till DIR is high */
294 udelay(10);
295 }
296
297 pm_runtime_enable(dev); 333 pm_runtime_enable(dev);
298 pm_runtime_get_sync(dev); 334 pm_runtime_get_sync(dev);
299 335
@@ -309,50 +345,12 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
309 ehci_write(regs, EHCI_INSNREG04, 345 ehci_write(regs, EHCI_INSNREG04,
310 EHCI_INSNREG04_DISABLE_UNSUSPEND); 346 EHCI_INSNREG04_DISABLE_UNSUSPEND);
311 347
312 /* Soft reset the PHY using PHY reset command over ULPI */
313 if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
314 omap_ehci_soft_phy_reset(pdev, 0);
315 if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
316 omap_ehci_soft_phy_reset(pdev, 1);
317
318 omap_ehci = hcd_to_ehci(hcd);
319 omap_ehci->sbrn = 0x20;
320
321 /* we know this is the memory we want, no need to ioremap again */
322 omap_ehci->caps = hcd->regs;
323 omap_ehci->regs = hcd->regs
324 + HC_LENGTH(ehci, readl(&omap_ehci->caps->hc_capbase));
325
326 dbg_hcs_params(omap_ehci, "reset");
327 dbg_hcc_params(omap_ehci, "reset");
328
329 /* cache this readonly data; minimize chip reads */
330 omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params);
331
332 ehci_reset(omap_ehci);
333
334 if (pdata->phy_reset) {
335 /* Hold the PHY in RESET for enough time till
336 * PHY is settled and ready
337 */
338 udelay(10);
339
340 if (gpio_is_valid(pdata->reset_gpio_port[0]))
341 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 1);
342
343 if (gpio_is_valid(pdata->reset_gpio_port[1]))
344 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
345 }
346
347 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 348 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
348 if (ret) { 349 if (ret) {
349 dev_err(dev, "failed to add hcd with err %d\n", ret); 350 dev_err(dev, "failed to add hcd with err %d\n", ret);
350 goto err_pm_runtime; 351 goto err_pm_runtime;
351 } 352 }
352 353
353 /* root ports should always stay powered */
354 ehci_port_power(omap_ehci, 1);
355
356 /* get clocks */ 354 /* get clocks */
357 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk"); 355 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
358 if (IS_ERR(utmi_p1_fck)) { 356 if (IS_ERR(utmi_p1_fck)) {
@@ -512,7 +510,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
512 /* 510 /*
513 * basic lifecycle operations 511 * basic lifecycle operations
514 */ 512 */
515 .reset = ehci_init, 513 .reset = omap_ehci_init,
516 .start = ehci_run, 514 .start = ehci_run,
517 .stop = ehci_stop, 515 .stop = ehci_stop,
518 .shutdown = ehci_shutdown, 516 .shutdown = ehci_shutdown,