]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Keep tusb osc_ck enabled during idle even in OTG mode
authorTony Lindgren <tony@atomide.com>
Tue, 14 Aug 2007 11:28:23 +0000 (04:28 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 14 Aug 2007 11:28:23 +0000 (04:28 -0700)
In OTG mode VBUS draw mA can be 8mA which can be less than
musb->min_power. When connected as OTG device, tusb does not
keep osc_ck enabled without this patch.

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

index 70d6f91040cdeb51eca8d4f7ea92af1497ef8ac3..82e055f49c9d33ddc79582fd856501a7b0408240 100644 (file)
@@ -273,6 +273,16 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
        void __iomem    *base = musb->ctrl_base;
        u32             reg;
 
+       /*
+        * Keep clock active when enabled. Note that this is not tied to
+        * drawing VBUS, as with OTG mA can be less than musb->min_power.
+        */
+       if (musb->set_clock)
+               if (mA)
+                       musb->set_clock(musb->clock, 1);
+               else
+                       musb->set_clock(musb->clock, 0);
+
        /* tps65030 seems to consume max 100mA, with maybe 60mA available
         * (measured on one board) for things other than tps and tusb.
         *
@@ -288,15 +298,11 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
 
        reg = musb_readl(base, TUSB_PRCM_MNGMT);
        if (mA) {
-               if (musb->set_clock)
-                       musb->set_clock(musb->clock, 1);
                musb->is_bus_powered = 1;
                reg |= TUSB_PRCM_MNGMT_15_SW_EN | TUSB_PRCM_MNGMT_33_SW_EN;
        } else {
                musb->is_bus_powered = 0;
                reg &= ~(TUSB_PRCM_MNGMT_15_SW_EN | TUSB_PRCM_MNGMT_33_SW_EN);
-               if (musb->set_clock)
-                       musb->set_clock(musb->clock, 0);
        }
        musb_writel(base, TUSB_PRCM_MNGMT, reg);