public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH 2/6] musb_hdrc: Move tusb PLL locking code into a separate function
Date: Sun, 21 Oct 2007 16:20:52 -0700	[thread overview]
Message-ID: <11930088592326-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <11930088583835-git-send-email-tony@atomide.com>

This needs to be also called when changing L3 speed with cpufreq.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/tusb6010.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 3008b6d..85afdd2 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -316,6 +316,23 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
 #define tusb_draw_power	NULL
 #endif
 
+/* There are issues re-locking the PLL on wakeup */
+static inline void tusb_lock_pll(struct musb *musb)
+{
+	void __iomem	*tbase = musb->ctrl_base;
+	u32		reg;
+	int		i;
+
+	for (i = 0xf7f7f7; i > 0xf7f7f7 - 1000; i--) {
+		musb_writel(tbase, TUSB_SCRATCH_PAD, 0);
+		musb_writel(tbase, TUSB_SCRATCH_PAD, i);
+		reg = musb_readl(tbase, TUSB_SCRATCH_PAD);
+		if (reg == i)
+			break;
+		DBG(6, "TUSB NOR not ready\n");
+	}
+}
+
 /* workaround for issue 13:  change clock during chip idle
  * (to be fixed in rev3 silicon) ... symptoms include disconnect
  * or looping suspend/resume cycles
@@ -824,22 +841,11 @@ static irqreturn_t tusb_interrupt(int irq, void *__hci)
 	/* Acknowledge wake-up source interrupts */
 	if (int_src & TUSB_INT_SRC_DEV_WAKEUP) {
 		u32	reg;
-		u32	i;
 
 		if (tusb_get_revision(musb) == TUSB_REV_30)
 			tusb_wbus_quirk(musb, 0);
 
-		/* there are issues re-locking the PLL on wakeup ... */
-
-		/* work around issue 8 */
-		for (i = 0xf7f7f7; i > 0xf7f7f7 - 1000; i--) {
-			musb_writel(tbase, TUSB_SCRATCH_PAD, 0);
-			musb_writel(tbase, TUSB_SCRATCH_PAD, i);
-			reg = musb_readl(tbase, TUSB_SCRATCH_PAD);
-			if (reg == i)
-				break;
-			DBG(6, "TUSB NOR not ready\n");
-		}
+		tusb_lock_pll(musb);
 
 		/* work around issue 13 (2nd half) */
 		tusb_set_clock_source(musb, 1);
-- 
1.5.2.5

  reply	other threads:[~2007-10-21 23:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-21 23:20 [PATCH 0/6] musb_hdrc: Improve tusb clocking, add musb_platform_wakeup() Tony Lindgren
2007-10-21 23:20 ` [PATCH 1/6] musb_hdrc: Removed nestedness in musb_gadget_ep0 Tony Lindgren
2007-10-21 23:20   ` Tony Lindgren [this message]
2007-10-21 23:20     ` [PATCH 3/6] musb_hdrc: Improve tusb clock handling Tony Lindgren
2007-10-21 23:20       ` [PATCH 4/6] musb_hdrc: Allow more time for HNP as a_wait_bcon Tony Lindgren
2007-10-21 23:20         ` [PATCH 5/6] musb_hdrc: Add musb_platform_wakeup() Tony Lindgren
2007-10-21 23:20           ` [PATCH 6/6] musb_hdrc: Handle b_host in musb_otg_timer_func() 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=11930088592326-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox