]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Fix HNP for OPT quirks
authorTony Lindgren <tony@atomide.com>
Sat, 8 Sep 2007 02:09:01 +0000 (19:09 -0700)
committerTony Lindgren <tony@atomide.com>
Sat, 8 Sep 2007 02:09:01 +0000 (19:09 -0700)
We cannot stop HNP based on SUSPEND, as devctl may still have
BDEVICE bit still set.

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

index 53cb110f09a2fb9f0b0e9757c52a272d4622cee3..65f288e4d8202c89202dec2d51f7de44ae82f8c5 100644 (file)
@@ -321,6 +321,7 @@ void musb_hnp_stop(struct musb *musb)
        switch (musb->xceiv.state) {
        case OTG_STATE_A_PERIPHERAL:
        case OTG_STATE_A_WAIT_VFALL:
+       case OTG_STATE_A_WAIT_BCON:
                DBG(1, "HNP: Switching back to A-host\n");
                musb_g_disconnect(musb);
                musb->xceiv.state = OTG_STATE_A_IDLE;
@@ -635,9 +636,19 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
                                musb_writeb(mbase, MUSB_DEVCTL, 0);
                        }
                } else if (is_peripheral_capable()) {
-                       DBG(1, "BUS RESET\n");
-
-                       musb_g_reset(musb);
+                       DBG(1, "BUS RESET as %s\n", otg_state_string(musb));
+                       switch (musb->xceiv.state) {
+                       case OTG_STATE_A_PERIPHERAL:
+                       case OTG_STATE_A_WAIT_BCON:     /* OPT TD.4.7-900ms */
+                               musb_hnp_stop(musb);
+                               break;
+                       case OTG_STATE_B_PERIPHERAL:
+                               musb_g_reset(musb);
+                               break;
+                       default:
+                               DBG(1, "Unhandled BUS RESET as %s\n",
+                                       otg_state_string(musb));
+                       }
                        schedule_work(&musb->irq_work);
                }
 
@@ -729,6 +740,7 @@ static irqreturn_t musb_stage2_irq(struct musb * musb, u8 int_usb,
                        musb_hnp_stop(musb);
                        break;
                case OTG_STATE_A_PERIPHERAL:
+                       musb_hnp_stop(musb);
                        musb_root_disconnect(musb);
                        /* FALLTHROUGH */
                case OTG_STATE_B_WAIT_ACON:
@@ -757,7 +769,10 @@ static irqreturn_t musb_stage2_irq(struct musb * musb, u8 int_usb,
                switch (musb->xceiv.state) {
 #ifdef CONFIG_USB_MUSB_OTG
                case OTG_STATE_A_PERIPHERAL:
-                       musb_hnp_stop(musb);
+                       /*
+                        * We cannot stop HNP here, devctl BDEVICE might be
+                        * still set.
+                        */
                        break;
 #endif
                case OTG_STATE_B_PERIPHERAL: