From 47c7785083ea67a7be90c7ace22ea639fa2e48f4 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sat, 13 Oct 2007 17:38:44 -0700 Subject: [PATCH] musb_hdrc: Fix stall handling as OTG peripheral 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 --- drivers/usb/musb/musb_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ac9ce46097e..33774a6cc19 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -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 -- 2.41.1