]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Fix stall handling as OTG peripheral
authorTony Lindgren <tony@atomide.com>
Sun, 14 Oct 2007 00:38:44 +0000 (17:38 -0700)
committerTony Lindgren <tony@atomide.com>
Sun, 14 Oct 2007 00:38:44 +0000 (17:38 -0700)
Prevent OTG peripheral trying to change to b_wait_acon if after
file storage CBW stall followed by SUSPEND from host. We switch
back to b_peripheral if RESET in b_wait_acon mode.

Also fix compile warning for missing default case.

And don't try to set b_wait_acon mode unless CONFIG_USB_OTG.

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

index ac9ce46097ebf79b2e6e2d8c9b491d0d4068d1d2..33774a6cc19565a5e9be1c8938379002ec71a504 100644 (file)
@@ -320,6 +320,8 @@ void musb_otg_timer_func(unsigned long data)
                DBG(1, "HNP: a_wait_bcon timeout; back to a_host\n");
                musb_hnp_stop(musb);
                break;
+       default:
+               DBG(1, "HNP: Unhandled mode %s\n", otg_state_string(musb));
        }
        musb->ignore_disconnect = 0;
        spin_unlock_irqrestore(&musb->lock, flags);
@@ -671,6 +673,12 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
                        case OTG_STATE_A_PERIPHERAL:
                                musb_hnp_stop(musb);
                                break;
+                       case OTG_STATE_B_WAIT_ACON:
+                               DBG(1, "HNP: RESET (%s), back to b_peripheral\n",
+                                       otg_state_string(musb));
+                               musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+                               musb_g_reset(musb);
+                               break;
 #endif
                        case OTG_STATE_B_IDLE:
                                musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
@@ -813,8 +821,8 @@ static irqreturn_t musb_stage2_irq(struct musb * musb, u8 int_usb,
                        musb->is_active = is_otg_enabled(musb)
                                        && musb->xceiv.gadget->b_hnp_enable;
                        if (musb->is_active) {
-                               musb->xceiv.state = OTG_STATE_B_WAIT_ACON;
 #ifdef CONFIG_USB_MUSB_OTG
+                               musb->xceiv.state = OTG_STATE_B_WAIT_ACON;
                                DBG(1, "HNP: Setting timer for b_ase0_brst\n");
                                musb_otg_timer.data = (unsigned long)musb;
                                mod_timer(&musb_otg_timer, jiffies