]> Pileus Git - ~andy/linux/commitdiff
usb: musb: move otg specific initializations from twl to glue
authorKishon Vijay Abraham I <kishon@ti.com>
Fri, 22 Jun 2012 12:10:53 +0000 (17:40 +0530)
committerFelipe Balbi <balbi@ti.com>
Mon, 25 Jun 2012 11:08:42 +0000 (14:08 +0300)
Moved otg specific state(OTG_STATE_B_IDLE, OTG_STATE_A_IDLE) initializations
from twl to glue. These initializations are removed from twl4030 and
twl6030 and moved to the mailbox API defined in glue.
This is part of the cleanup in preparation to make use of usb2 phy
driver.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/omap2430.c
drivers/usb/otg/twl4030-usb.c
drivers/usb/otg/twl6030-usb.c

index 063687085d1efe6da1ac649ef405be495b79076d..c4dc92bd7e85276f3df87bbfaaf4fdb3af72e021 100644 (file)
@@ -249,11 +249,14 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
        struct device *dev = musb->controller;
        struct musb_hdrc_platform_data *pdata = dev->platform_data;
        struct omap_musb_board_data *data = pdata->board_data;
+       struct usb_otg *otg = musb->xceiv->otg;
 
        switch (glue->status) {
        case OMAP_MUSB_ID_GROUND:
                dev_dbg(dev, "ID GND\n");
 
+               otg->default_a = true;
+               musb->xceiv->state = OTG_STATE_A_IDLE;
                musb->xceiv->last_event = USB_EVENT_ID;
                if (!is_otg_enabled(musb) || musb->gadget_driver) {
                        pm_runtime_get_sync(dev);
@@ -265,6 +268,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
        case OMAP_MUSB_VBUS_VALID:
                dev_dbg(dev, "VBUS Connect\n");
 
+               otg->default_a = false;
+               musb->xceiv->state = OTG_STATE_B_IDLE;
                musb->xceiv->last_event = USB_EVENT_VBUS;
                if (musb->gadget_driver)
                        pm_runtime_get_sync(dev);
index a7b809e217ea2aa751d549a47c9f5d32d574d0c3..4d0d98bc40cdf70a8104650012414fe2c29eb711 100644 (file)
@@ -251,7 +251,6 @@ static enum omap_musb_vbus_id_status
 {
        int     status;
        enum omap_musb_vbus_id_status linkstat = OMAP_MUSB_UNKNOWN;
-       struct usb_otg *otg = twl->phy.otg;
 
        twl->vbus_supplied = false;
 
@@ -291,13 +290,6 @@ static enum omap_musb_vbus_id_status
 
        spin_lock_irq(&twl->lock);
        twl->linkstat = linkstat;
-       if (linkstat == OMAP_MUSB_ID_GROUND) {
-               otg->default_a = true;
-               twl->phy.state = OTG_STATE_A_IDLE;
-       } else {
-               otg->default_a = false;
-               twl->phy.state = OTG_STATE_B_IDLE;
-       }
        spin_unlock_irq(&twl->lock);
 
        return linkstat;
index 6c758836cfb13f24a8f74c1219233f55580ee11a..66cfea735557839319a18934186674d9eddc13db 100644 (file)
@@ -256,7 +256,6 @@ static DEVICE_ATTR(vbus, 0444, twl6030_usb_vbus_show, NULL);
 static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 {
        struct twl6030_usb *twl = _twl;
-       struct usb_otg *otg = twl->phy.otg;
        enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
        u8 vbus_state, hw_state;
 
@@ -269,8 +268,6 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
                        regulator_enable(twl->usb3v3);
                        twl->asleep = 1;
                        status = OMAP_MUSB_VBUS_VALID;
-                       otg->default_a = false;
-                       twl->phy.state = OTG_STATE_B_IDLE;
                        twl->linkstat = status;
                        omap_musb_mailbox(status);
                } else {
@@ -293,7 +290,6 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 {
        struct twl6030_usb *twl = _twl;
-       struct usb_otg *otg = twl->phy.otg;
        enum omap_musb_vbus_id_status status = OMAP_MUSB_UNKNOWN;
        u8 hw_state;
 
@@ -307,8 +303,6 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
                twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
                                                                0x10);
                status = OMAP_MUSB_ID_GROUND;
-               otg->default_a = true;
-               twl->phy.state = OTG_STATE_A_IDLE;
                twl->linkstat = status;
                omap_musb_mailbox(status);
        } else  {