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;
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_IDLE:
+ musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+ /* FALLTHROUGH */
+ 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);
}
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:
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: