Commit d3244e7c authored by Tony Lindgren's avatar Tony Lindgren

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: default avatarTony Lindgren <tony@atomide.com>
parent 4e0e0b87
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment