linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Bin Liu <b-liu-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 08/10] usb: musb: Remove try_idle for 2430 glue layer
Date: Thu, 28 Apr 2016 10:33:18 -0700	[thread overview]
Message-ID: <1461864800-29979-9-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1461864800-29979-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

This is no longer needed with PM runtime at least for 2430 glue.
We can now rely only on PM runtime and cable detection.

The other glue layers can probably remove try_idle too, but that
needs to be tested for each platform before doing it.

Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/musb/omap2430.c | 91 ---------------------------------------------
 1 file changed, 91 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index b274923..c352511 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -54,92 +54,6 @@ struct omap2430_glue {
 
 static struct omap2430_glue	*_glue;
 
-static struct timer_list musb_idle_timer;
-
-static void musb_do_idle(unsigned long _musb)
-{
-	struct musb	*musb = (void *)_musb;
-	unsigned long	flags;
-	u8	power;
-	u8	devctl;
-
-	spin_lock_irqsave(&musb->lock, flags);
-
-	switch (musb->xceiv->otg->state) {
-	case OTG_STATE_A_WAIT_BCON:
-
-		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-		if (devctl & MUSB_DEVCTL_BDEVICE) {
-			musb->xceiv->otg->state = OTG_STATE_B_IDLE;
-			MUSB_DEV_MODE(musb);
-		} else {
-			musb->xceiv->otg->state = OTG_STATE_A_IDLE;
-			MUSB_HST_MODE(musb);
-		}
-		break;
-	case OTG_STATE_A_SUSPEND:
-		/* finish RESUME signaling? */
-		if (musb->port1_status & MUSB_PORT_STAT_RESUME) {
-			power = musb_readb(musb->mregs, MUSB_POWER);
-			power &= ~MUSB_POWER_RESUME;
-			dev_dbg(musb->controller, "root port resume stopped, power %02x\n", power);
-			musb_writeb(musb->mregs, MUSB_POWER, power);
-			musb->is_active = 1;
-			musb->port1_status &= ~(USB_PORT_STAT_SUSPEND
-						| MUSB_PORT_STAT_RESUME);
-			musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
-			usb_hcd_poll_rh_status(musb->hcd);
-			/* NOTE: it might really be A_WAIT_BCON ... */
-			musb->xceiv->otg->state = OTG_STATE_A_HOST;
-		}
-		break;
-	case OTG_STATE_A_HOST:
-		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-		if (devctl &  MUSB_DEVCTL_BDEVICE)
-			musb->xceiv->otg->state = OTG_STATE_B_IDLE;
-		else
-			musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
-	default:
-		break;
-	}
-	spin_unlock_irqrestore(&musb->lock, flags);
-}
-
-
-static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
-{
-	unsigned long		default_timeout = jiffies + msecs_to_jiffies(3);
-	static unsigned long	last_timer;
-
-	if (timeout == 0)
-		timeout = default_timeout;
-
-	/* Never idle if active, or when VBUS timeout is not set as host */
-	if (musb->is_active || ((musb->a_wait_bcon == 0)
-			&& (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) {
-		dev_dbg(musb->controller, "%s active, deleting timer\n",
-			usb_otg_state_string(musb->xceiv->otg->state));
-		del_timer(&musb_idle_timer);
-		last_timer = jiffies;
-		return;
-	}
-
-	if (time_after(last_timer, timeout)) {
-		if (!timer_pending(&musb_idle_timer))
-			last_timer = timeout;
-		else {
-			dev_dbg(musb->controller, "Longer idle timer already pending, ignoring\n");
-			return;
-		}
-	}
-	last_timer = timeout;
-
-	dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n",
-		usb_otg_state_string(musb->xceiv->otg->state),
-		(unsigned long)jiffies_to_msecs(timeout - jiffies));
-	mod_timer(&musb_idle_timer, timeout);
-}
-
 static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 {
 	struct usb_otg	*otg = musb->xceiv->otg;
@@ -427,8 +341,6 @@ static int omap2430_musb_init(struct musb *musb)
 			musb_readl(musb->mregs, OTG_INTERFSEL),
 			musb_readl(musb->mregs, OTG_SIMENABLE));
 
-	setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
-
 	if (glue->status != MUSB_UNKNOWN)
 		omap_musb_set_mailbox(glue);
 
@@ -493,7 +405,6 @@ static int omap2430_musb_exit(struct musb *musb)
 	struct device *dev = musb->controller;
 	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
 
-	del_timer_sync(&musb_idle_timer);
 	pm_runtime_get_sync(glue->dev);
 	omap2430_low_level_exit(musb);
 	pm_runtime_put_sync_suspend(glue->dev);
@@ -515,8 +426,6 @@ static const struct musb_platform_ops omap2430_ops = {
 	.exit		= omap2430_musb_exit,
 
 	.set_mode	= omap2430_musb_set_mode,
-	.try_idle	= omap2430_musb_try_idle,

  parent reply	other threads:[~2016-04-28 17:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 17:33 [PATCH 00/10] Get MUSB PM runtime working again Tony Lindgren
     [not found] ` <1461864800-29979-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-28 17:33   ` [PATCH 01/10] usb: phy: Fix initial state for twl6030 Tony Lindgren
2016-04-28 17:33   ` [PATCH 02/10] usb: musb: Fix idling after host mode by increasing autosuspend delay Tony Lindgren
     [not found]     ` <1461864800-29979-3-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 15:02       ` Bin Liu
2016-05-05 17:04         ` Tony Lindgren
     [not found]           ` <20160505170439.GX5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 17:47             ` Bin Liu
2016-05-06  6:45               ` Felipe Balbi
     [not found]                 ` <87k2j7it0f.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-05-09 19:57                   ` Tony Lindgren
2016-04-28 17:33   ` [PATCH 03/10] usb: musb: Fix PM runtime handling for connected cable Tony Lindgren
     [not found]     ` <1461864800-29979-4-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-28 17:53       ` Sergei Shtylyov
     [not found]         ` <57224E1F.7040707-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2016-04-28 18:07           ` Tony Lindgren
     [not found]             ` <20160428180741.GF5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-29 15:52               ` Tony Lindgren
2016-04-28 17:33   ` [PATCH 04/10] usb: musb: Remove unnecessary shutdown function Tony Lindgren
     [not found]     ` <1461864800-29979-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 19:20       ` Bin Liu
2016-05-05 19:28         ` Tony Lindgren
     [not found]           ` <20160505192852.GD5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 19:49             ` Bin Liu
2016-04-28 17:33   ` [PATCH 05/10] usb: musb: Fix PM runtime autosuspend Tony Lindgren
2016-04-28 17:33   ` [PATCH 06/10] usb: musb: Split PM runtime between wrapper IP and musb core Tony Lindgren
2016-04-28 17:33   ` [PATCH 07/10] usb: musb: Manage USB phy from PM runtime calls Tony Lindgren
2016-04-28 17:33   ` Tony Lindgren [this message]
2016-04-28 17:33   ` [PATCH 09/10] usb: musb: Fix PM runtime with delayed work Tony Lindgren
2016-04-28 17:33   ` [PATCH 10/10] usb: musb: Remove pm_runtime_set_irq_safe Tony Lindgren
2016-05-01  6:33   ` [PATCH 00/10] Get MUSB PM runtime working again Ivaylo Dimitrov
     [not found]     ` <5725A31D.8020508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-03 16:25       ` Tony Lindgren
     [not found]         ` <20160503162528.GM5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-03 17:43           ` Ivaylo Dimitrov
     [not found]             ` <5728E334.3090000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-11 23:03               ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461864800-29979-9-git-send-email-tony@atomide.com \
    --to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \
    --cc=b-liu-l0cyMroinI0@public.gmane.org \
    --cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=george.cherian-l0cyMroinI0@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).