usb: move the OTG state from the USB PHY to the OTG structure
[deliverable/linux.git] / drivers / usb / musb / blackfin.c
index ac4422b33dcdbf31226271ab25046983aa2a6127..f23ce40b4d64cc5c90e021a5242facb3f185baf7 100644 (file)
@@ -185,8 +185,8 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
        }
 
        /* Start sampling ID pin, when plug is removed from MUSB */
-       if ((musb->xceiv->state == OTG_STATE_B_IDLE
-               || musb->xceiv->state == OTG_STATE_A_WAIT_BCON) ||
+       if ((musb->xceiv->otg->state == OTG_STATE_B_IDLE
+               || musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON) ||
                (musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) {
                mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
                musb->a_wait_bcon = TIMER_DELAY;
@@ -205,7 +205,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
        static u8 toggle;
 
        spin_lock_irqsave(&musb->lock, flags);
-       switch (musb->xceiv->state) {
+       switch (musb->xceiv->otg->state) {
        case OTG_STATE_A_IDLE:
        case OTG_STATE_A_WAIT_BCON:
                /* Start a new session */
@@ -219,7 +219,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
 
                if (!(val & MUSB_DEVCTL_BDEVICE)) {
                        gpio_set_value(musb->config->gpio_vrsel, 1);
-                       musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+                       musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
                } else {
                        gpio_set_value(musb->config->gpio_vrsel, 0);
                        /* Ignore VBUSERROR and SUSPEND IRQ */
@@ -229,7 +229,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
 
                        val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
                        musb_writeb(musb->mregs, MUSB_INTRUSB, val);
-                       musb->xceiv->state = OTG_STATE_B_IDLE;
+                       musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                }
                mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
                break;
@@ -245,7 +245,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
 
                if (!(val & MUSB_DEVCTL_BDEVICE)) {
                        gpio_set_value(musb->config->gpio_vrsel, 1);
-                       musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+                       musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
                } else {
                        gpio_set_value(musb->config->gpio_vrsel, 0);
 
@@ -280,13 +280,13 @@ static void musb_conn_timer_handler(unsigned long _musb)
                break;
        default:
                dev_dbg(musb->controller, "%s state not handled\n",
-                       usb_otg_state_string(musb->xceiv->state));
+                       usb_otg_state_string(musb->xceiv->otg->state));
                break;
        }
        spin_unlock_irqrestore(&musb->lock, flags);
 
        dev_dbg(musb->controller, "state is %s\n",
-               usb_otg_state_string(musb->xceiv->state));
+               usb_otg_state_string(musb->xceiv->otg->state));
 }
 
 static void bfin_musb_enable(struct musb *musb)
@@ -307,7 +307,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on)
 
        dev_dbg(musb->controller, "VBUS %s, devctl %02x "
                /* otg %3x conf %08x prcm %08x */ "\n",
-               usb_otg_state_string(musb->xceiv->state),
+               usb_otg_state_string(musb->xceiv->otg->state),
                musb_readb(musb->mregs, MUSB_DEVCTL));
 }
 
@@ -456,16 +456,12 @@ static int bfin_probe(struct platform_device *pdev)
        int                             ret = -ENOMEM;
 
        glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
-       if (!glue) {
-               dev_err(&pdev->dev, "failed to allocate glue context\n");
+       if (!glue)
                goto err0;
-       }
 
        musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
-       if (!musb) {
-               dev_err(&pdev->dev, "failed to allocate musb device\n");
+       if (!musb)
                goto err0;
-       }
 
        musb->dev.parent                = &pdev->dev;
        musb->dev.dma_mask              = &bfin_dmamask;
This page took 0.048528 seconds and 5 git commands to generate.