linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v2] usb: musb: dsps: fix runtime pm for peripheral mode
@ 2018-12-14 16:38 Bin Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Bin Liu @ 2018-12-14 16:38 UTC (permalink / raw)
  To: linux-usb; +Cc: Tony Lindgren, Bin Liu

Since the runtime PM support was added in musb, dsps relies on the timer
calling otg_timer() to activate the usb subsystem. However the driver
doesn't enable the timer for peripheral port, then the peripheral port is
unable to be enumerated by a host if the other usb port is disabled or in
peripheral mode too.

So let's start the timer for peripheral port too.

Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable@vger.kernel.org # v4.9+
Signed-off-by: Bin Liu <b-liu@ti.com>
---
v2: fix typo in inline comment.

 drivers/usb/musb/musb_dsps.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 1e6d78b1334e..403eb97915f8 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -181,9 +181,11 @@ static void dsps_musb_enable(struct musb *musb)
 
 	musb_writel(reg_base, wrp->epintr_set, epmask);
 	musb_writel(reg_base, wrp->coreintr_set, coremask);
-	/* start polling for ID change in dual-role idle mode */
-	if (musb->xceiv->otg->state == OTG_STATE_B_IDLE &&
-			musb->port_mode == MUSB_OTG)
+	/*
+	 * start polling for runtime PM active and idle,
+	 * and for ID change in dual-role idle mode.
+	 */
+	if (musb->xceiv->otg->state == OTG_STATE_B_IDLE)
 		dsps_mod_timer(glue, -1);
 }
 
@@ -254,6 +256,10 @@ static int dsps_check_status(struct musb *musb, void *unused)
 				musb->xceiv->otg->state = OTG_STATE_A_IDLE;
 				MUSB_HST_MODE(musb);
 			}
+
+			if (musb->port_mode == MUSB_PERIPHERAL)
+				skip_session = 1;
+
 			if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session)
 				musb_writeb(mregs, MUSB_DEVCTL,
 					    MUSB_DEVCTL_SESSION);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [v2] usb: musb: dsps: fix runtime pm for peripheral mode
@ 2018-12-14 16:47 Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2018-12-14 16:47 UTC (permalink / raw)
  To: Bin Liu; +Cc: linux-usb

* Bin Liu <b-liu@ti.com> [181214 16:38]:
> Since the runtime PM support was added in musb, dsps relies on the timer
> calling otg_timer() to activate the usb subsystem. However the driver
> doesn't enable the timer for peripheral port, then the peripheral port is
> unable to be enumerated by a host if the other usb port is disabled or in
> peripheral mode too.
> 
> So let's start the timer for peripheral port too.

Makes sense to me:

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-14 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-14 16:47 [v2] usb: musb: dsps: fix runtime pm for peripheral mode Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2018-12-14 16:38 Bin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).