Commit 47c77850 authored by Tony Lindgren's avatar Tony Lindgren

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: default avatarTony Lindgren <tony@atomide.com>
parent 4ca958be
...@@ -320,6 +320,8 @@ void musb_otg_timer_func(unsigned long data) ...@@ -320,6 +320,8 @@ void musb_otg_timer_func(unsigned long data)
DBG(1, "HNP: a_wait_bcon timeout; back to a_host\n"); DBG(1, "HNP: a_wait_bcon timeout; back to a_host\n");
musb_hnp_stop(musb); musb_hnp_stop(musb);
break; break;
default:
DBG(1, "HNP: Unhandled mode %s\n", otg_state_string(musb));
} }
musb->ignore_disconnect = 0; musb->ignore_disconnect = 0;
spin_unlock_irqrestore(&musb->lock, flags); spin_unlock_irqrestore(&musb->lock, flags);
...@@ -671,6 +673,12 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb, ...@@ -671,6 +673,12 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
case OTG_STATE_A_PERIPHERAL: case OTG_STATE_A_PERIPHERAL:
musb_hnp_stop(musb); musb_hnp_stop(musb);
break; 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 #endif
case OTG_STATE_B_IDLE: case OTG_STATE_B_IDLE:
musb->xceiv.state = OTG_STATE_B_PERIPHERAL; musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
...@@ -813,8 +821,8 @@ static irqreturn_t musb_stage2_irq(struct musb * musb, u8 int_usb, ...@@ -813,8 +821,8 @@ static irqreturn_t musb_stage2_irq(struct musb * musb, u8 int_usb,
musb->is_active = is_otg_enabled(musb) musb->is_active = is_otg_enabled(musb)
&& musb->xceiv.gadget->b_hnp_enable; && musb->xceiv.gadget->b_hnp_enable;
if (musb->is_active) { if (musb->is_active) {
musb->xceiv.state = OTG_STATE_B_WAIT_ACON;
#ifdef CONFIG_USB_MUSB_OTG #ifdef CONFIG_USB_MUSB_OTG
musb->xceiv.state = OTG_STATE_B_WAIT_ACON;
DBG(1, "HNP: Setting timer for b_ase0_brst\n"); DBG(1, "HNP: Setting timer for b_ase0_brst\n");
musb_otg_timer.data = (unsigned long)musb; musb_otg_timer.data = (unsigned long)musb;
mod_timer(&musb_otg_timer, jiffies mod_timer(&musb_otg_timer, jiffies
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment