]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: musb: remove references to default_a of struct usb_otg
authorBin Liu <b-liu@ti.com>
Mon, 21 May 2018 13:42:18 +0000 (08:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 May 2018 10:03:25 +0000 (12:03 +0200)
musb drivers do not use the otg fsm framework, so referencing to
otg->default_a doesn't have any effect, so remove the references.

But tusb6010 glue driver uses it locally to control the vbus power, so
keep the references in tusb6010 only.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/am35x.c
drivers/usb/musb/da8xx.c
drivers/usb/musb/davinci.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_dsps.c
drivers/usb/musb/musb_gadget.c
drivers/usb/musb/musb_host.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/sunxi.c
drivers/usb/musb/ux500.c

index 0ad664efda6bbabc96c2c1c8fdfce3eded9e66f8..660641ab15453c0ae625a166856d304a7a3d0f56 100644 (file)
@@ -201,7 +201,6 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
        struct device *dev = musb->controller;
        struct musb_hdrc_platform_data *plat = dev_get_platdata(dev);
        struct omap_musb_board_data *data = plat->board_data;
-       struct usb_otg *otg = musb->xceiv->otg;
        unsigned long flags;
        irqreturn_t ret = IRQ_NONE;
        u32 epintr, usbintr;
@@ -264,14 +263,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
                        WARNING("VBUS error workaround (delay coming)\n");
                } else if (drvvbus) {
                        MUSB_HST_MODE(musb);
-                       otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        portstate(musb->port1_status |= USB_PORT_STAT_POWER);
                        del_timer(&musb->dev_timer);
                } else {
                        musb->is_active = 0;
                        MUSB_DEV_MODE(musb);
-                       otg->default_a = 0;
                        musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                        portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
                }
index b8295ce7c4fe8b8940eca53e4f16c0393e6f72e5..0e5929e81d26160309138c8db063d2ca9d84523c 100644 (file)
@@ -280,7 +280,6 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
                        WARNING("VBUS error workaround (delay coming)\n");
                } else if (drvvbus) {
                        MUSB_HST_MODE(musb);
-                       otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        portstate(musb->port1_status |= USB_PORT_STAT_POWER);
                        del_timer(&musb->dev_timer);
@@ -295,7 +294,6 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
                         */
                        musb->is_active = 0;
                        MUSB_DEV_MODE(musb);
-                       otg->default_a = 0;
                        musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                        portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
                }
index 2ad39dcd2f4c3191771a1981a261603f5e08b39e..fb6bbd254ab738afba0829d33438cb4ab4ccd368 100644 (file)
@@ -311,14 +311,12 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
                        WARNING("VBUS error workaround (delay coming)\n");
                } else if (drvvbus) {
                        MUSB_HST_MODE(musb);
-                       otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        portstate(musb->port1_status |= USB_PORT_STAT_POWER);
                        del_timer(&musb->dev_timer);
                } else {
                        musb->is_active = 0;
                        MUSB_DEV_MODE(musb);
-                       otg->default_a = 0;
                        musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                        portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
                }
@@ -425,6 +423,9 @@ static int davinci_musb_init(struct musb *musb)
 
 static int davinci_musb_exit(struct musb *musb)
 {
+       int     maxdelay = 30;
+       u8      devctl, warn = 0;
+
        del_timer_sync(&musb->dev_timer);
 
        /* force VBUS off */
@@ -438,31 +439,27 @@ static int davinci_musb_exit(struct musb *musb)
 
        davinci_musb_source_power(musb, 0 /*off*/, 1);
 
-       /* delay, to avoid problems with module reload */
-       if (musb->xceiv->otg->default_a) {
-               int     maxdelay = 30;
-               u8      devctl, warn = 0;
+       /*
+        * delay, to avoid problems with module reload.
+        * if there's no peripheral connected, this can take a
+        * long time to fall, especially on EVM with huge C133.
+        */
+       do {
+               devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+               if (!(devctl & MUSB_DEVCTL_VBUS))
+                       break;
+               if ((devctl & MUSB_DEVCTL_VBUS) != warn) {
+                       warn = devctl & MUSB_DEVCTL_VBUS;
+                       dev_dbg(musb->controller, "VBUS %d\n",
+                               warn >> MUSB_DEVCTL_VBUS_SHIFT);
+               }
+               msleep(1000);
+               maxdelay--;
+       } while (maxdelay > 0);
 
-               /* if there's no peripheral connected, this can take a
-                * long time to fall, especially on EVM with huge C133.
-                */
-               do {
-                       devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-                       if (!(devctl & MUSB_DEVCTL_VBUS))
-                               break;
-                       if ((devctl & MUSB_DEVCTL_VBUS) != warn) {
-                               warn = devctl & MUSB_DEVCTL_VBUS;
-                               dev_dbg(musb->controller, "VBUS %d\n",
-                                       warn >> MUSB_DEVCTL_VBUS_SHIFT);
-                       }
-                       msleep(1000);
-                       maxdelay--;
-               } while (maxdelay > 0);
-
-               /* in OTG mode, another host might be connected */
-               if (devctl & MUSB_DEVCTL_VBUS)
-                       dev_dbg(musb->controller, "VBUS off timeout (devctl %02x)\n", devctl);
-       }
+       /* in OTG mode, another host might be connected */
+       if (devctl & MUSB_DEVCTL_VBUS)
+               dev_dbg(musb->controller, "VBUS off timeout (devctl %02x)\n", devctl);
 
        phy_off();
 
index a3a716197dc14545ac56e1598ad438171f1f3331..5cc64980058b0a6616e3afe0f7f092d20a05b6e5 100644 (file)
@@ -2352,13 +2352,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                musb_writeb(musb->mregs, MUSB_ULPI_BUSCONTROL, busctl);
        }
 
-       if (musb->xceiv->otg->default_a) {
-               MUSB_HST_MODE(musb);
-               musb->xceiv->otg->state = OTG_STATE_A_IDLE;
-       } else {
-               MUSB_DEV_MODE(musb);
-               musb->xceiv->otg->state = OTG_STATE_B_IDLE;
-       }
+       MUSB_DEV_MODE(musb);
+       musb->xceiv->otg->state = OTG_STATE_B_IDLE;
 
        switch (musb->port_mode) {
        case MUSB_HOST:
index 71aec85b9bd4c07557eac9d5a87f6364b9eafe87..34e4dda1d6ac17c7ecf0bec76b2718367759e955 100644 (file)
@@ -360,13 +360,11 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
                        WARNING("VBUS error workaround (delay coming)\n");
                } else if (drvvbus) {
                        MUSB_HST_MODE(musb);
-                       musb->xceiv->otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        dsps_mod_timer_optional(glue);
                } else {
                        musb->is_active = 0;
                        MUSB_DEV_MODE(musb);
-                       musb->xceiv->otg->default_a = 0;
                        musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                }
 
index d082b0cbea938c57dae0fbbb67a129a5ae90a1a4..5b8e6297ebedeec9cc84044226b5af08281252e5 100644 (file)
@@ -1794,7 +1794,6 @@ int musb_gadget_setup(struct musb *musb)
        musb->g.speed = USB_SPEED_UNKNOWN;
 
        MUSB_DEV_MODE(musb);
-       musb->xceiv->otg->default_a = 0;
        musb->xceiv->otg->state = OTG_STATE_B_IDLE;
 
        /* this "gadget" abstracts/virtualizes the controller */
index c8d0617da849e33caad9c085bc22a5865c87b4ad..cd611a97f59e8b6fa3af50d115d3dfeab0084e89 100644 (file)
@@ -2752,7 +2752,6 @@ int musb_host_setup(struct musb *musb, int power_budget)
 
        if (musb->port_mode == MUSB_HOST) {
                MUSB_HST_MODE(musb);
-               musb->xceiv->otg->default_a = 1;
                musb->xceiv->otg->state = OTG_STATE_A_IDLE;
        }
        otg_set_host(musb->xceiv->otg, &hcd->self);
index 3dd6e1c5e04f610faa52c5a86cc9f4186d5c80ac..b1dd81fb5f55e3e9fbe249bb7cc058cc5e5a2e85 100644 (file)
@@ -77,7 +77,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
                        otg_set_vbus(otg, 1);
                } else {
                        musb->is_active = 1;
-                       otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        devctl |= MUSB_DEVCTL_SESSION;
                        MUSB_HST_MODE(musb);
@@ -89,7 +88,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
                 * jumping right to B_IDLE...
                 */
 
-               otg->default_a = 0;
                musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                devctl &= ~MUSB_DEVCTL_SESSION;
 
@@ -148,14 +146,12 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
        struct musb_hdrc_platform_data *pdata =
                dev_get_platdata(musb->controller);
        struct omap_musb_board_data *data = pdata->board_data;
-       struct usb_otg *otg = musb->xceiv->otg;
 
        pm_runtime_get_sync(musb->controller);
        switch (glue->status) {
        case MUSB_ID_GROUND:
                dev_dbg(musb->controller, "ID GND\n");
 
-               otg->default_a = true;
                musb->xceiv->otg->state = OTG_STATE_A_IDLE;
                musb->xceiv->last_event = USB_EVENT_ID;
                if (musb->gadget_driver) {
@@ -168,7 +164,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
        case MUSB_VBUS_VALID:
                dev_dbg(musb->controller, "VBUS Connect\n");
 
-               otg->default_a = false;
                musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                musb->xceiv->last_event = USB_EVENT_VBUS;
                omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
index 62ab2ca03779259b38e961fd931aabd06ba19756..832a41f9ee7d35ba18fb8518fa86f011c2a90f8f 100644 (file)
@@ -105,13 +105,11 @@ static void sunxi_musb_work(struct work_struct *work)
                devctl = readb(musb->mregs + SUNXI_MUSB_DEVCTL);
                if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) {
                        set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
-                       musb->xceiv->otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        MUSB_HST_MODE(musb);
                        devctl |= MUSB_DEVCTL_SESSION;
                } else {
                        clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
-                       musb->xceiv->otg->default_a = 0;
                        musb->xceiv->otg->state = OTG_STATE_B_IDLE;
                        MUSB_DEV_MODE(musb);
                        devctl &= ~MUSB_DEVCTL_SESSION;
index 27b4a77a9e23ef6c0a687bbe8da577b3319071fc..73538d1d05247841d75d0308a3cb8c97fac3166b 100644 (file)
@@ -62,7 +62,6 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on)
 
                } else {
                        musb->is_active = 1;
-                       musb->xceiv->otg->default_a = 1;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
                        devctl |= MUSB_DEVCTL_SESSION;
                        MUSB_HST_MODE(musb);
@@ -73,7 +72,6 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on)
                /* NOTE: we're skipping A_WAIT_VFALL -> A_IDLE and jumping
                 * right to B_IDLE...
                 */
-               musb->xceiv->otg->default_a = 0;
                devctl &= ~MUSB_DEVCTL_SESSION;
                MUSB_DEV_MODE(musb);
        }