aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-10-15 12:29:23 -0400
committerFelipe Balbi <balbi@ti.com>2013-10-17 10:55:05 -0400
commit8b9fcce2d88586b9a120ff3e039d8f42413f0bb0 (patch)
tree07f1ba04397da036b71860492b52ae6a79d696d9 /drivers/usb/musb
parentae44df2e21b50f9fff28ac75c57e399c04df812c (diff)
usb: musb: dsps: move try_idle to start hook
The timer is initialized right after musb is probed. There is actually no need to have this timer running because _nothing_ will happen until we have the gadget loaded. Also we need this timer only if we run in OTG mode _and_ we need it also after the gadget has been replaced with another one. I've been looking at am35x.c, da8xx.c, omap2430.c, tusb6010.c. da8xx seem to have the same problem as dsps and doing mostly the same thing. tusb6010 seem to do something different and do some actual "idle / power saving" work so I am not too comfortable to remove musb_platform_try_idle() from musb_gadget_setup(). Therefore this patch does not start the timer if there is no gadget active (which is at musb_gadget_setup() at time). In order to have the timer active after the gadget is loaded it will be triggered from dsps_musb_enable(). Cc: stable@vger.kernel.org # v3.11 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_dsps.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index c7fe16db6bb6..e0d81b8318ab 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -121,6 +121,7 @@ struct dsps_glue {
121 unsigned long last_timer; /* last timer data for each instance */ 121 unsigned long last_timer; /* last timer data for each instance */
122}; 122};
123 123
124static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout);
124/** 125/**
125 * dsps_musb_enable - enable interrupts 126 * dsps_musb_enable - enable interrupts
126 */ 127 */
@@ -143,6 +144,7 @@ static void dsps_musb_enable(struct musb *musb)
143 /* Force the DRVVBUS IRQ so we can start polling for ID change. */ 144 /* Force the DRVVBUS IRQ so we can start polling for ID change. */
144 dsps_writel(reg_base, wrp->coreintr_set, 145 dsps_writel(reg_base, wrp->coreintr_set,
145 (1 << wrp->drvvbus) << wrp->usb_shift); 146 (1 << wrp->drvvbus) << wrp->usb_shift);
147 dsps_musb_try_idle(musb, 0);
146} 148}
147 149
148/** 150/**
@@ -234,6 +236,9 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
234 if (musb->port_mode == MUSB_PORT_MODE_HOST) 236 if (musb->port_mode == MUSB_PORT_MODE_HOST)
235 return; 237 return;
236 238
239 if (!musb->g.dev.driver)
240 return;
241
237 if (time_after(glue->last_timer, timeout) && 242 if (time_after(glue->last_timer, timeout) &&
238 timer_pending(&glue->timer)) { 243 timer_pending(&glue->timer)) {
239 dev_dbg(musb->controller, 244 dev_dbg(musb->controller,