All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH 6/12] musb_hdrc: Improve tusb host state handling for a_idle
Date: Thu, 11 Oct 2007 10:05:19 -0700	[thread overview]
Message-ID: <11921223321890-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <11921223311131-git-send-email-tony@atomide.com>

This patch makes the changes happen based on vbus change.
This also seems to make enumeration work better.

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

diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index b3e745d..16eaa48 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -422,18 +422,15 @@ static void musb_do_idle(unsigned long _musb)
 
 	switch (musb->xceiv.state) {
 	case OTG_STATE_A_WAIT_BCON:
-	case OTG_STATE_A_WAIT_VRISE:
-	case OTG_STATE_A_IDLE:
 		if ((musb->a_wait_bcon != 0)
 			&& (musb->idle_timeout == 0
 				|| time_after(jiffies, musb->idle_timeout))) {
 			DBG(4, "Nothing connected %s, turning off VBUS\n",
 					otg_state_string(musb));
-			tusb_source_power(musb, 0);
-			musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
-			musb->is_active = 0;
 		}
-		break;
+		/* FALLTHROUGH */
+	case OTG_STATE_A_IDLE:
+		tusb_source_power(musb, 0);
 	default:
 		break;
 	}
@@ -533,7 +530,6 @@ static void tusb_source_power(struct musb *musb, int is_on)
 	if (is_on) {
 		if (musb->set_clock)
 			musb->set_clock(musb->clock, 1);
-		musb->is_active = 1;
 		timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE);
 		musb->xceiv.default_a = 1;
 		musb->xceiv.state = OTG_STATE_A_WAIT_VRISE;
@@ -550,11 +546,13 @@ static void tusb_source_power(struct musb *musb, int is_on)
 		otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT);
 		if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
 			switch (musb->xceiv.state) {
-			case OTG_STATE_A_WAIT_VFALL:
-				break;
 			case OTG_STATE_A_WAIT_VRISE:
+			case OTG_STATE_A_WAIT_BCON:
 				musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
 				break;
+			case OTG_STATE_A_WAIT_VFALL:
+				musb->xceiv.state = OTG_STATE_A_IDLE;
+				break;
 			default:
 				musb->xceiv.state = OTG_STATE_A_IDLE;
 			}
@@ -798,6 +796,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 			break;
 		}
 	}
+	schedule_work(&musb->irq_work);
 
 	return idle_timeout;
 }
-- 
1.5.2.5

  reply	other threads:[~2007-10-11 17:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11 17:05 [PATCH 0/12] musb_hdrc: Host and OTG updates Tony Lindgren
2007-10-11 17:05 ` [PATCH 1/12] musb_hdrc: Allow tusb3.0 and greater to use multichannel DMA Tony Lindgren
2007-10-11 17:05   ` [PATCH 2/12] musb_hdrc: Add more sysfs notify events Tony Lindgren
2007-10-11 17:05     ` [PATCH 3/12] musb_hdrc: Remove old sysfs entry cable, use mode instead Tony Lindgren
2007-10-11 17:05       ` [PATCH 4/12] musb_hdrc: Remove non-debug otg_state_string Tony Lindgren
2007-10-11 17:05         ` [PATCH 5/12] musb_hdrc: Fix host suspend handling, remove earlier hacks Tony Lindgren
2007-10-11 17:05           ` Tony Lindgren [this message]
2007-10-11 17:05             ` [PATCH 7/12] musb_hdrc: Don't idle as host if VBUS timeout is 0 Tony Lindgren
2007-10-11 17:05               ` [PATCH 8/12] musb_hdrc: Add timer for returning to host mode from HNP Tony Lindgren
2007-10-11 17:05                 ` [PATCH 9/12] musb_hdrc: Make HNP more reliable Tony Lindgren
2007-10-11 17:05                   ` [PATCH 10/12] musb_hdrc: Make vbus sysfs entry report current Vbus status Tony Lindgren
2007-10-11 17:05                     ` [PATCH 11/12] musb_hdrc: Allow suspend if host is already suspended Tony Lindgren
2007-10-11 17:05                       ` musb_hdrc: Fix compile if CONFIG_ARCH_OMAP_OTG is not set Tony Lindgren
2007-10-11 20:07                       ` [PATCH 11/12] musb_hdrc: Allow suspend if host is already suspended Felipe Balbi
2007-10-11 20:21                         ` David Brownell
2007-10-11 20:38                           ` Felipe Balbi
2007-10-12  0:56       ` [PATCH 3/12] musb_hdrc: Remove old sysfs entry cable, use mode instead David Brownell
2007-10-12 20:32 ` [PATCH 0/12] musb_hdrc: Host and OTG updates 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=11921223321890-git-send-email-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap-open-source@linux.omap.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.