]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/usb/musb/musb_gadget.c
usb: move the OTG state from the USB PHY to the OTG structure
[karo-tx-linux.git] / drivers / usb / musb / musb_gadget.c
index 4ab1896957e1f26750102805e3692e1da81ac0cd..56c31b769a54f672d64bccfcc155c0a95b66d407 100644 (file)
@@ -1546,7 +1546,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
 
        spin_lock_irqsave(&musb->lock, flags);
 
-       switch (musb->xceiv->state) {
+       switch (musb->xceiv->otg->state) {
        case OTG_STATE_B_PERIPHERAL:
                /* NOTE:  OTG state machine doesn't include B_SUSPENDED;
                 * that's part of the standard usb 1.1 state machine, and
@@ -1587,7 +1587,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
                goto done;
        default:
                dev_dbg(musb->controller, "Unhandled wake: %s\n",
-                       usb_otg_state_string(musb->xceiv->state));
+                       usb_otg_state_string(musb->xceiv->otg->state));
                goto done;
        }
 
@@ -1791,7 +1791,7 @@ int musb_gadget_setup(struct musb *musb)
 
        MUSB_DEV_MODE(musb);
        musb->xceiv->otg->default_a = 0;
-       musb->xceiv->state = OTG_STATE_B_IDLE;
+       musb->xceiv->otg->state = OTG_STATE_B_IDLE;
 
        /* this "gadget" abstracts/virtualizes the controller */
        musb->g.name = musb_driver_name;
@@ -1857,7 +1857,7 @@ static int musb_gadget_start(struct usb_gadget *g,
        musb->is_active = 1;
 
        otg_set_peripheral(otg, &musb->g);
-       musb->xceiv->state = OTG_STATE_B_IDLE;
+       musb->xceiv->otg->state = OTG_STATE_B_IDLE;
        spin_unlock_irqrestore(&musb->lock, flags);
 
        musb_start(musb);
@@ -1941,7 +1941,7 @@ static int musb_gadget_stop(struct usb_gadget *g)
 
        (void) musb_gadget_vbus_draw(&musb->g, 0);
 
-       musb->xceiv->state = OTG_STATE_UNDEFINED;
+       musb->xceiv->otg->state = OTG_STATE_UNDEFINED;
        stop_activity(musb, NULL);
        otg_set_peripheral(musb->xceiv->otg, NULL);
 
@@ -1968,7 +1968,7 @@ static int musb_gadget_stop(struct usb_gadget *g)
 void musb_g_resume(struct musb *musb)
 {
        musb->is_suspended = 0;
-       switch (musb->xceiv->state) {
+       switch (musb->xceiv->otg->state) {
        case OTG_STATE_B_IDLE:
                break;
        case OTG_STATE_B_WAIT_ACON:
@@ -1982,7 +1982,7 @@ void musb_g_resume(struct musb *musb)
                break;
        default:
                WARNING("unhandled RESUME transition (%s)\n",
-                               usb_otg_state_string(musb->xceiv->state));
+                               usb_otg_state_string(musb->xceiv->otg->state));
        }
 }
 
@@ -1994,10 +1994,10 @@ void musb_g_suspend(struct musb *musb)
        devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
        dev_dbg(musb->controller, "devctl %02x\n", devctl);
 
-       switch (musb->xceiv->state) {
+       switch (musb->xceiv->otg->state) {
        case OTG_STATE_B_IDLE:
                if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
-                       musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+                       musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
                break;
        case OTG_STATE_B_PERIPHERAL:
                musb->is_suspended = 1;
@@ -2012,7 +2012,7 @@ void musb_g_suspend(struct musb *musb)
                 * A_PERIPHERAL may need care too
                 */
                WARNING("unhandled SUSPEND transition (%s)\n",
-                               usb_otg_state_string(musb->xceiv->state));
+                               usb_otg_state_string(musb->xceiv->otg->state));
        }
 }
 
@@ -2043,22 +2043,22 @@ void musb_g_disconnect(struct musb *musb)
                spin_lock(&musb->lock);
        }
 
-       switch (musb->xceiv->state) {
+       switch (musb->xceiv->otg->state) {
        default:
                dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n",
-                       usb_otg_state_string(musb->xceiv->state));
-               musb->xceiv->state = OTG_STATE_A_IDLE;
+                       usb_otg_state_string(musb->xceiv->otg->state));
+               musb->xceiv->otg->state = OTG_STATE_A_IDLE;
                MUSB_HST_MODE(musb);
                break;
        case OTG_STATE_A_PERIPHERAL:
-               musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+               musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
                MUSB_HST_MODE(musb);
                break;
        case OTG_STATE_B_WAIT_ACON:
        case OTG_STATE_B_HOST:
        case OTG_STATE_B_PERIPHERAL:
        case OTG_STATE_B_IDLE:
-               musb->xceiv->state = OTG_STATE_B_IDLE;
+               musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                break;
        case OTG_STATE_B_SRP_INIT:
                break;
@@ -2118,13 +2118,13 @@ __acquires(musb->lock)
                 * In that case, do not rely on devctl for setting
                 * peripheral mode.
                 */
-               musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+               musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
                musb->g.is_a_peripheral = 0;
        } else if (devctl & MUSB_DEVCTL_BDEVICE) {
-               musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+               musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
                musb->g.is_a_peripheral = 0;
        } else {
-               musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
+               musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL;
                musb->g.is_a_peripheral = 1;
        }