]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Fix host suspend handling, remove earlier hacks
authorTony Lindgren <tony@atomide.com>
Thu, 20 Sep 2007 00:23:49 +0000 (17:23 -0700)
committerTony Lindgren <tony@atomide.com>
Thu, 11 Oct 2007 21:31:33 +0000 (14:31 -0700)
If A-cable was connected and a gadget module was reloaded, root hub
suspend would fail.

This the problem by managing musb inactive state better. The patch also adds
more debug info for cases where suspend is attempted in active state.

Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/usb/musb/musb_host.c
drivers/usb/musb/musb_virthub.c
drivers/usb/musb/tusb6010.c

index 79518ae955dd7f7ecafbeb35188e522180bc68a7..091ae8f548ac7fe63a9813280c886728b1027560 100644 (file)
@@ -2128,9 +2128,11 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
 {
        struct musb     *musb = hcd_to_musb(hcd);
 
-       if (is_host_active(musb) && musb->is_active)
+       if (is_host_active(musb) && musb->is_active) {
+               WARN("trying to suspend as %s is_active=%i\n",
+                       otg_state_string(musb), musb->is_active);
                return -EBUSY;
-       else
+       else
                return 0;
 }
 
index b123d8e6250f6884cc892832f2a7d52c747e31a7..22b1d5e435efe0a5070c79aab9189ebf42845a41 100644 (file)
@@ -190,6 +190,7 @@ void musb_root_disconnect(struct musb *musb)
        case OTG_STATE_A_HOST:
        case OTG_STATE_A_SUSPEND:
                musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+               musb->is_active = 0;
                break;
        case OTG_STATE_A_WAIT_VFALL:
                musb->xceiv.state = OTG_STATE_B_IDLE;
index 5026f2b598174b76dfc2ce946e74d13db06a102f..b3e745d98d3fcf44ac9d9c2296afdcc1e87ee3cd 100644 (file)
@@ -430,7 +430,7 @@ static void musb_do_idle(unsigned long _musb)
                        DBG(4, "Nothing connected %s, turning off VBUS\n",
                                        otg_state_string(musb));
                        tusb_source_power(musb, 0);
-                       musb->xceiv.state = OTG_STATE_A_IDLE;
+                       musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
                        musb->is_active = 0;
                }
                break;
@@ -551,16 +551,14 @@ static void tusb_source_power(struct musb *musb, int is_on)
                if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
                        switch (musb->xceiv.state) {
                        case OTG_STATE_A_WAIT_VFALL:
-                               musb->is_active = 1;
                                break;
                        case OTG_STATE_A_WAIT_VRISE:
-                               musb->is_active = 1;
                                musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
                                break;
                        default:
-                               musb->is_active = 0;
                                musb->xceiv.state = OTG_STATE_A_IDLE;
                        }
+                       musb->is_active = 0;
                        musb->xceiv.default_a = 1;
                        MUSB_HST_MODE(musb);
                } else {
@@ -778,11 +776,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
                                        break;
                                }
                                musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
-                               /* CONNECT can wake if a_wait_bcon is set */
-                               if (musb->a_wait_bcon != 0)
-                                       musb->is_active = 0;
-                               else
-                                       musb->is_active = 1;
+                               musb->is_active = 0;
                                idle_timeout = jiffies
                                        + msecs_to_jiffies(musb->a_wait_bcon);
                        } else {