aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/musb_gadget.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-03-31 15:35:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:41 -0400
commitab983f2a1be582b00f706013f40f658769d0823a (patch)
tree95dce5821b73726351f323d2d1bd4a80bea9ceb3 /drivers/usb/musb/musb_gadget.c
parent1de00dae8036dfee44ebea2c38f942fb6072e0b7 (diff)
musb: support disconnect after HNP roleswitch
Adjust HNP state machines in MUSB driver so that they handle the case where the cable is disconnected. The A-side machine was very wrong (unrecoverable); the B-Side was much less so. - A_PERIPHERAL ... as usual, the non-observability of the ID pin through Mentor's registers makes trouble. We can't go directly to A_WAIT_VFALL to end the session and start the disconnect processing. We can however sense link suspending, go to A_WAIT_BCON, and from there use OTG timeouts to finally trigger that A_WAIT_VFALL transition. (Hoping that nobody reconnects quickly to that port and notices the wrong state.) - B_HOST ... actually clear the Host Request (HR) bit as the messages say, disconnect the peripheral from the root hub, and don't detour through a suspend state. (In some cases this would eventually have cleaned up.) Also adjust the A_SUSPEND transition to respect the A_AIDL_BDIS timeout, so if HNP doesn't trigger quickly enough the A_WAIT_VFALL transition happens as it should. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb/musb_gadget.c')
-rw-r--r--drivers/usb/musb/musb_gadget.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 3c4da75fbc7b..858d005fae6d 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1962,9 +1962,11 @@ void musb_g_disconnect(struct musb *musb)
1962 DBG(2, "Unhandled disconnect %s, setting a_idle\n", 1962 DBG(2, "Unhandled disconnect %s, setting a_idle\n",
1963 otg_state_string(musb)); 1963 otg_state_string(musb));
1964 musb->xceiv->state = OTG_STATE_A_IDLE; 1964 musb->xceiv->state = OTG_STATE_A_IDLE;
1965 MUSB_HST_MODE(musb);
1965 break; 1966 break;
1966 case OTG_STATE_A_PERIPHERAL: 1967 case OTG_STATE_A_PERIPHERAL:
1967 musb->xceiv->state = OTG_STATE_A_WAIT_BCON; 1968 musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
1969 MUSB_HST_MODE(musb);
1968 break; 1970 break;
1969 case OTG_STATE_B_WAIT_ACON: 1971 case OTG_STATE_B_WAIT_ACON:
1970 case OTG_STATE_B_HOST: 1972 case OTG_STATE_B_HOST: