From: Tony Lindgren Date: Tue, 14 Aug 2007 11:28:23 +0000 (-0700) Subject: musb_hdrc: Keep tusb osc_ck enabled during idle even in OTG mode X-Git-Tag: v2.6.23-omap1~227 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d3244e7cb1bd6fd319b21d9d5e2135c49515ebe3;p=linux-2.6-omap-h63xx.git musb_hdrc: Keep tusb osc_ck enabled during idle even in OTG mode 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 --- diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 70d6f91040c..82e055f49c9 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -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);