public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP3: PM: reset USB OTG module on boot
@ 2009-06-24  0:27 Kevin Hilman
  2009-06-24  6:53 ` Niilo Minkkinen
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Hilman @ 2009-06-24  0:27 UTC (permalink / raw)
  To: linux-omap

Rather than simply setting force-idle mode on boot, do a reset of the
OTG module.  This really ensures that any bootloader/bootstrap code
that leaves it active will not prevent future retention.  After reset,
OTG module will be in force-idle, force-standby mode.

In addition, ensure that the iclk is enabled before attempting a write
to the module SYSCONFIG register.

Problem reported by Mike Chan <mikechan@google.com>

Tested-by: Mike Chan <mikechan@google.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
If no comments/issues, this will be applied to PM branch and
backported to pm-2.6.29.

 arch/arm/mach-omap2/usb-musb.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index d85296d..85731b8 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -32,12 +32,27 @@
 #include <mach/usb.h>
 
 #define OTG_SYSCONFIG	(OMAP34XX_HSUSB_OTG_BASE + 0x404)
+#define OTG_SYSC_SOFTRESET BIT(1)
 
 static void __init usb_musb_pm_init(void)
 {
-	/* Ensure force-idle mode for OTG controller */
-	if (cpu_is_omap34xx())
-		omap_writel(0, OTG_SYSCONFIG);
+	struct clk *iclk;
+
+	if (!cpu_is_omap34xx())
+		return;
+
+	iclk = clk_get(NULL, "hsotgusb_ick");
+	if (WARN_ON(!iclk))
+		return;
+
+	clk_enable(iclk);
+
+	/* Reset OTG controller.  After reset, it will be in
+	 * force-idle, force-standby mode. */
+	omap_writel(OTG_SYSC_SOFTRESET, OTG_SYSCONFIG);
+
+	clk_disable(iclk);
+	clk_put(iclk);
 }
 
 #ifdef CONFIG_USB_MUSB_SOC
-- 
1.6.3.2


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

end of thread, other threads:[~2009-06-24 14:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-24  0:27 [PATCH] OMAP3: PM: reset USB OTG module on boot Kevin Hilman
2009-06-24  6:53 ` Niilo Minkkinen
2009-06-24 13:21   ` Kevin Hilman
2009-06-24 13:50     ` Niilo Minkkinen
2009-06-24 14:07       ` Kevin Hilman
2009-06-24 14:09         ` Niilo Minkkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox