aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/early/ehci-dbgp.c23
-rw-r--r--include/linux/usb/ehci_def.h1
2 files changed, 23 insertions, 1 deletions
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index b88cb65b64e0..f0a41c647bef 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -478,10 +478,13 @@ int dbgp_external_startup(void)
478 int devnum; 478 int devnum;
479 struct usb_debug_descriptor dbgp_desc; 479 struct usb_debug_descriptor dbgp_desc;
480 int ret; 480 int ret;
481 u32 ctrl, portsc; 481 u32 ctrl, portsc, cmd;
482 int dbg_port = dbgp_phys_port; 482 int dbg_port = dbgp_phys_port;
483 int tries = 3; 483 int tries = 3;
484 int reset_port_tries = 1;
485 int try_hard_once = 1;
484 486
487try_port_reset_again:
485 ret = dbgp_ehci_startup(); 488 ret = dbgp_ehci_startup();
486 if (ret) 489 if (ret)
487 return ret; 490 return ret;
@@ -490,6 +493,24 @@ int dbgp_external_startup(void)
490 ret = ehci_wait_for_port(dbg_port); 493 ret = ehci_wait_for_port(dbg_port);
491 if (ret < 0) { 494 if (ret < 0) {
492 portsc = readl(&ehci_regs->port_status[dbg_port - 1]); 495 portsc = readl(&ehci_regs->port_status[dbg_port - 1]);
496 if (!(portsc & PORT_CONNECT) && try_hard_once) {
497 /* Last ditch effort to try to force enable
498 * the debug device by using the packet test
499 * ehci command to try and wake it up. */
500 try_hard_once = 0;
501 cmd = readl(&ehci_regs->command);
502 cmd &= ~CMD_RUN;
503 writel(cmd, &ehci_regs->command);
504 portsc = readl(&ehci_regs->port_status[dbg_port - 1]);
505 portsc |= PORT_TEST_PKT;
506 writel(portsc, &ehci_regs->port_status[dbg_port - 1]);
507 dbgp_ehci_status("Trying to force debug port online");
508 mdelay(50);
509 dbgp_ehci_controller_reset();
510 goto try_port_reset_again;
511 } else if (reset_port_tries--) {
512 goto try_port_reset_again;
513 }
493 dbgp_printk("No device found in debug port\n"); 514 dbgp_printk("No device found in debug port\n");
494 return -EIO; 515 return -EIO;
495 } 516 }
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 1909d924f816..af4b86f3aca3 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -105,6 +105,7 @@ struct ehci_regs {
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
107/* 19:16 for port testing */ 107/* 19:16 for port testing */
108#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */
108#define PORT_LED_OFF (0<<14) 109#define PORT_LED_OFF (0<<14)
109#define PORT_LED_AMBER (1<<14) 110#define PORT_LED_AMBER (1<<14)
110#define PORT_LED_GREEN (2<<14) 111#define PORT_LED_GREEN (2<<14)