]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Fixes for OPT HS A tests
authorTony Lindgren <tony@atomide.com>
Tue, 7 Aug 2007 12:20:06 +0000 (05:20 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 7 Aug 2007 12:20:06 +0000 (05:20 -0700)
If RESUME is cleared too soon, OPT HS A 6.8 tests will fail.

This patch removes the check for RESUME bit before SUSPEND
is set, and makes virthub sleep until RESUME has been held
for 20 ms. Additionally virthub waits after clearing RESUME
to allow musb to start generating SOFs before RESET.

Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/usb/musb/plat_uds.c
drivers/usb/musb/virthub.c

index 3aca510af90618f2882c301c07035faadfd39f46..36fc5786b556883001744d7b321bf5e2e312a3f2 100644 (file)
@@ -386,26 +386,27 @@ static irqreturn_t musb_stage0_irq(struct musb * pThis, u8 bIntrUSB,
                                /* remote wakeup?  later, GetPortStatus
                                 * will stop RESUME signaling
                                 */
-                               if (power & MGC_M_POWER_RESUME) {
-                                       power &= ~MGC_M_POWER_SUSPENDM;
-                                       musb_writeb(pBase, MGC_O_HDRC_POWER,
+
+                               if (power & MGC_M_POWER_SUSPENDM) {
+                                       /* spurious */
+                                       pThis->int_usb &= ~MGC_M_INTR_SUSPEND;
+                                       DBG(2, "Spurious SUSPENDM\n");
+                                       break;
+                               }
+
+                               power &= ~MGC_M_POWER_SUSPENDM;
+                               musb_writeb(pBase, MGC_O_HDRC_POWER,
                                                power | MGC_M_POWER_RESUME);
 
-                                       pThis->port1_status |=
+                               pThis->port1_status |=
                                                (USB_PORT_STAT_C_SUSPEND << 16)
                                                | MUSB_PORT_STAT_RESUME;
-                                       pThis->rh_timer = jiffies
+                               pThis->rh_timer = jiffies
                                                + msecs_to_jiffies(20);
 
-                                       pThis->xceiv.state = OTG_STATE_A_HOST;
-                                       pThis->is_active = 1;
-                                       usb_hcd_resume_root_hub(
-                                                       musb_to_hcd(pThis));
-
-                               } else if (power & MGC_M_POWER_SUSPENDM) {
-                                       /* spurious */
-                                       pThis->int_usb &= ~MGC_M_INTR_SUSPEND;
-                               }
+                               pThis->xceiv.state = OTG_STATE_A_HOST;
+                               pThis->is_active = 1;
+                               usb_hcd_resume_root_hub(musb_to_hcd(pThis));
                                break;
                        case OTG_STATE_B_WAIT_ACON:
                                pThis->xceiv.state = OTG_STATE_B_PERIPHERAL;
index 5b1163b031c9203168154817fb76de8c66a60235..d4fa7153668cf45c81fe17b73157c79005b056aa 100644 (file)
@@ -129,6 +129,22 @@ static void musb_port_reset(struct musb *musb, u8 bReset)
         */
        power = musb_readb(pBase, MGC_O_HDRC_POWER);
        if (bReset) {
+
+               /*
+                * If RESUME is set, we must make sure it stays minimum 20 ms.
+                * Then we must clear RESUME and wait a bit to let musb start
+                * generating SOFs. If we don't do this, OPT HS A 6.8 tests
+                * fail with "Error! Did not receive an SOF before suspend
+                * detected".
+                */
+               if (power &  MGC_M_POWER_RESUME) {
+                       while (time_before(jiffies, musb->rh_timer))
+                               msleep(1);
+                       musb_writeb(pBase, MGC_O_HDRC_POWER,
+                               power & ~MGC_M_POWER_RESUME);
+                       msleep(1);
+               }
+
                musb->bIgnoreDisconnect = TRUE;
                power &= 0xf0;
                musb_writeb(pBase, MGC_O_HDRC_POWER,