]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/usb/musb/am35x.c
usb: move the OTG state from the USB PHY to the OTG structure
[karo-tx-linux.git] / drivers / usb / musb / am35x.c
index a2735df24cc65353cd17643ce2972ad69e179661..d836a3e1f8ec62d0feb00657fba2d69c9b86c669 100644 (file)
@@ -149,25 +149,25 @@ static void otg_timer(unsigned long _musb)
         */
        devctl = musb_readb(mregs, MUSB_DEVCTL);
        dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl,
-               usb_otg_state_string(musb->xceiv->state));
+               usb_otg_state_string(musb->xceiv->otg->state));
 
        spin_lock_irqsave(&musb->lock, flags);
-       switch (musb->xceiv->state) {
+       switch (musb->xceiv->otg->state) {
        case OTG_STATE_A_WAIT_BCON:
                devctl &= ~MUSB_DEVCTL_SESSION;
                musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
 
                devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
                if (devctl & MUSB_DEVCTL_BDEVICE) {
-                       musb->xceiv->state = OTG_STATE_B_IDLE;
+                       musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                        MUSB_DEV_MODE(musb);
                } else {
-                       musb->xceiv->state = OTG_STATE_A_IDLE;
+                       musb->xceiv->otg->state = OTG_STATE_A_IDLE;
                        MUSB_HST_MODE(musb);
                }
                break;
        case OTG_STATE_A_WAIT_VFALL:
-               musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+               musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                musb_writel(musb->ctrl_base, CORE_INTR_SRC_SET_REG,
                            MUSB_INTR_VBUSERROR << AM35X_INTR_USB_SHIFT);
                break;
@@ -176,7 +176,7 @@ static void otg_timer(unsigned long _musb)
                if (devctl & MUSB_DEVCTL_BDEVICE)
                        mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
                else
-                       musb->xceiv->state = OTG_STATE_A_IDLE;
+                       musb->xceiv->otg->state = OTG_STATE_A_IDLE;
                break;
        default:
                break;
@@ -193,9 +193,9 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
 
        /* Never idle if active, or when VBUS timeout is not set as host */
        if (musb->is_active || (musb->a_wait_bcon == 0 &&
-                               musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
+                               musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON)) {
                dev_dbg(musb->controller, "%s active, deleting timer\n",
-                       usb_otg_state_string(musb->xceiv->state));
+                       usb_otg_state_string(musb->xceiv->otg->state));
                del_timer(&otg_workaround);
                last_timer = jiffies;
                return;
@@ -208,7 +208,7 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
        last_timer = timeout;
 
        dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n",
-               usb_otg_state_string(musb->xceiv->state),
+               usb_otg_state_string(musb->xceiv->otg->state),
                jiffies_to_msecs(timeout - jiffies));
        mod_timer(&otg_workaround, timeout);
 }
@@ -278,27 +278,27 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
                         * devctl.
                         */
                        musb->int_usb &= ~MUSB_INTR_VBUSERROR;
-                       musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
+                       musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL;
                        mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
                        WARNING("VBUS error workaround (delay coming)\n");
                } else if (drvvbus) {
                        MUSB_HST_MODE(musb);
                        otg->default_a = 1;
-                       musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+                       musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        portstate(musb->port1_status |= USB_PORT_STAT_POWER);
                        del_timer(&otg_workaround);
                } else {
                        musb->is_active = 0;
                        MUSB_DEV_MODE(musb);
                        otg->default_a = 0;
-                       musb->xceiv->state = OTG_STATE_B_IDLE;
+                       musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                        portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
                }
 
                /* NOTE: this must complete power-on within 100 ms. */
                dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
                                drvvbus ? "on" : "off",
-                               usb_otg_state_string(musb->xceiv->state),
+                               usb_otg_state_string(musb->xceiv->otg->state),
                                err ? " ERROR" : "",
                                devctl);
                ret = IRQ_HANDLED;
@@ -324,7 +324,7 @@ eoi:
        }
 
        /* Poll for ID change */
-       if (musb->xceiv->state == OTG_STATE_B_IDLE)
+       if (musb->xceiv->otg->state == OTG_STATE_B_IDLE)
                mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 
        spin_unlock_irqrestore(&musb->lock, flags);