aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-omap.c
diff options
context:
space:
mode:
authorKeshava Munegowda <keshava_mgowda@ti.com>2012-07-20 05:43:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-10 14:49:12 -0400
commit872c495dd0f9d1f48814a8ee80c2c7b3b7c3b4d9 (patch)
tree09789faf0266ab4c6993d07d699a0e042e9cdbd8 /drivers/usb/host/ehci-omap.c
parent71a5e61b81191cfb5624add64f925990487d64c0 (diff)
OMAP: USB : Fix the EHCI enumeration and core retention issue
This commit 354ab8567ae3107a8cbe7228c3181990ba598aac titled "Fix OMAP EHCI suspend/resume failure (i693)" is causing the usb hub and device detection fails in beagle XM causeing NFS not functional. This affects the core retention too. The same commit logic needs to be revisted adhering to hwmod and device tree framework. for now, this commit id 354ab8567ae3107a8cbe7228c3181990ba598aac titled "Fix OMAP EHCI suspend/resume failure (i693)" reverted. This patch is validated on BeagleXM with NFS support over usb ethernet and USB mass storage and other device detection. Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com> Acked-by: Felipe Balbi <balbi@ti.com> Cc: stable <stable@vger.kernel.org> # 3.5 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci-omap.c')
-rw-r--r--drivers/usb/host/ehci-omap.c167
1 files changed, 1 insertions, 166 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bb55eb4a7d48..d7fe287d0678 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -56,15 +56,6 @@
56#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 56#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
57#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 57#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0
58 58
59/* Errata i693 */
60static struct clk *utmi_p1_fck;
61static struct clk *utmi_p2_fck;
62static struct clk *xclk60mhsp1_ck;
63static struct clk *xclk60mhsp2_ck;
64static struct clk *usbhost_p1_fck;
65static struct clk *usbhost_p2_fck;
66static struct clk *init_60m_fclk;
67
68/*-------------------------------------------------------------------------*/ 59/*-------------------------------------------------------------------------*/
69 60
70static const struct hc_driver ehci_omap_hc_driver; 61static const struct hc_driver ehci_omap_hc_driver;
@@ -80,40 +71,6 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
80 return __raw_readl(base + reg); 71 return __raw_readl(base + reg);
81} 72}
82 73
83/* Erratum i693 workaround sequence */
84static void omap_ehci_erratum_i693(struct ehci_hcd *ehci)
85{
86 int ret = 0;
87
88 /* Switch to the internal 60 MHz clock */
89 ret = clk_set_parent(utmi_p1_fck, init_60m_fclk);
90 if (ret != 0)
91 ehci_err(ehci, "init_60m_fclk set parent"
92 "failed error:%d\n", ret);
93
94 ret = clk_set_parent(utmi_p2_fck, init_60m_fclk);
95 if (ret != 0)
96 ehci_err(ehci, "init_60m_fclk set parent"
97 "failed error:%d\n", ret);
98
99 clk_enable(usbhost_p1_fck);
100 clk_enable(usbhost_p2_fck);
101
102 /* Wait 1ms and switch back to the external clock */
103 mdelay(1);
104 ret = clk_set_parent(utmi_p1_fck, xclk60mhsp1_ck);
105 if (ret != 0)
106 ehci_err(ehci, "xclk60mhsp1_ck set parent"
107 "failed error:%d\n", ret);
108
109 ret = clk_set_parent(utmi_p2_fck, xclk60mhsp2_ck);
110 if (ret != 0)
111 ehci_err(ehci, "xclk60mhsp2_ck set parent"
112 "failed error:%d\n", ret);
113
114 clk_disable(usbhost_p1_fck);
115 clk_disable(usbhost_p2_fck);
116}
117 74
118static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port) 75static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port)
119{ 76{
@@ -195,50 +152,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)
195 return rc; 152 return rc;
196} 153}
197 154
198static int omap_ehci_hub_control(
199 struct usb_hcd *hcd,
200 u16 typeReq,
201 u16 wValue,
202 u16 wIndex,
203 char *buf,
204 u16 wLength
205)
206{
207 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
208 u32 __iomem *status_reg = &ehci->regs->port_status[
209 (wIndex & 0xff) - 1];
210 u32 temp;
211 unsigned long flags;
212 int retval = 0;
213
214 spin_lock_irqsave(&ehci->lock, flags);
215
216 if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) {
217 temp = ehci_readl(ehci, status_reg);
218 if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) {
219 retval = -EPIPE;
220 goto done;
221 }
222
223 temp &= ~PORT_WKCONN_E;
224 temp |= PORT_WKDISC_E | PORT_WKOC_E;
225 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
226
227 omap_ehci_erratum_i693(ehci);
228
229 set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
230 goto done;
231 }
232
233 spin_unlock_irqrestore(&ehci->lock, flags);
234
235 /* Handle the hub control events here */
236 return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
237done:
238 spin_unlock_irqrestore(&ehci->lock, flags);
239 return retval;
240}
241
242static void disable_put_regulator( 155static void disable_put_regulator(
243 struct ehci_hcd_omap_platform_data *pdata) 156 struct ehci_hcd_omap_platform_data *pdata)
244{ 157{
@@ -351,79 +264,9 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
351 goto err_pm_runtime; 264 goto err_pm_runtime;
352 } 265 }
353 266
354 /* get clocks */
355 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
356 if (IS_ERR(utmi_p1_fck)) {
357 ret = PTR_ERR(utmi_p1_fck);
358 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
359 goto err_add_hcd;
360 }
361
362 xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
363 if (IS_ERR(xclk60mhsp1_ck)) {
364 ret = PTR_ERR(xclk60mhsp1_ck);
365 dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
366 goto err_utmi_p1_fck;
367 }
368
369 utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
370 if (IS_ERR(utmi_p2_fck)) {
371 ret = PTR_ERR(utmi_p2_fck);
372 dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
373 goto err_xclk60mhsp1_ck;
374 }
375
376 xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
377 if (IS_ERR(xclk60mhsp2_ck)) {
378 ret = PTR_ERR(xclk60mhsp2_ck);
379 dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
380 goto err_utmi_p2_fck;
381 }
382
383 usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
384 if (IS_ERR(usbhost_p1_fck)) {
385 ret = PTR_ERR(usbhost_p1_fck);
386 dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
387 goto err_xclk60mhsp2_ck;
388 }
389
390 usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
391 if (IS_ERR(usbhost_p2_fck)) {
392 ret = PTR_ERR(usbhost_p2_fck);
393 dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
394 goto err_usbhost_p1_fck;
395 }
396
397 init_60m_fclk = clk_get(dev, "init_60m_fclk");
398 if (IS_ERR(init_60m_fclk)) {
399 ret = PTR_ERR(init_60m_fclk);
400 dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
401 goto err_usbhost_p2_fck;
402 }
403 267
404 return 0; 268 return 0;
405 269
406err_usbhost_p2_fck:
407 clk_put(usbhost_p2_fck);
408
409err_usbhost_p1_fck:
410 clk_put(usbhost_p1_fck);
411
412err_xclk60mhsp2_ck:
413 clk_put(xclk60mhsp2_ck);
414
415err_utmi_p2_fck:
416 clk_put(utmi_p2_fck);
417
418err_xclk60mhsp1_ck:
419 clk_put(xclk60mhsp1_ck);
420
421err_utmi_p1_fck:
422 clk_put(utmi_p1_fck);
423
424err_add_hcd:
425 usb_remove_hcd(hcd);
426
427err_pm_runtime: 270err_pm_runtime:
428 disable_put_regulator(pdata); 271 disable_put_regulator(pdata);
429 pm_runtime_put_sync(dev); 272 pm_runtime_put_sync(dev);
@@ -454,14 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
454 iounmap(hcd->regs); 297 iounmap(hcd->regs);
455 usb_put_hcd(hcd); 298 usb_put_hcd(hcd);
456 299
457 clk_put(utmi_p1_fck);
458 clk_put(utmi_p2_fck);
459 clk_put(xclk60mhsp1_ck);
460 clk_put(xclk60mhsp2_ck);
461 clk_put(usbhost_p1_fck);
462 clk_put(usbhost_p2_fck);
463 clk_put(init_60m_fclk);
464
465 pm_runtime_put_sync(dev); 300 pm_runtime_put_sync(dev);
466 pm_runtime_disable(dev); 301 pm_runtime_disable(dev);
467 302
@@ -532,7 +367,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
532 * root hub support 367 * root hub support
533 */ 368 */
534 .hub_status_data = ehci_hub_status_data, 369 .hub_status_data = ehci_hub_status_data,
535 .hub_control = omap_ehci_hub_control, 370 .hub_control = ehci_hub_control,
536 .bus_suspend = ehci_bus_suspend, 371 .bus_suspend = ehci_bus_suspend,
537 .bus_resume = ehci_bus_resume, 372 .bus_resume = ehci_bus_resume,
538 373